Repository navigation
Conversation
reset(scenario_config=...) wrote into the shared scenario config, so the overrides persisted into later plain resets. Apply them to a copy of the base scenario on every reset.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
reset(scenario_config={...})wrote the overrides into the shared scenario config, so they persisted into later plain resets. Afterreset(scenario_config={"max_steps": 2})and thenreset(),scenario.config.max_stepswas still 2.The env now keeps a
_base_scenario, and eachreset()deep-copies it and applies the overrides to the copy. Overrides from the constructor and scenario switches persist as before. Scenarios hold only their config and small per-episode fields, no simulator handles, so the copy is cheap.Type of Change
Alignment Checklist
Before submitting, verify:
.claude/docs/PRINCIPLES.mdand this PR aligns with our principles.claude/docs/INVARIANTS.mdand no invariants are violated/pre-submit-pr(orbash .claude/hooks/lint.shand tests) and addressed all issuesRFC Status
Test Plan
test_reset_scenario_config_applies_to_one_episodeintests/envs/test_carla_environment.py(mock mode). Onmain: 1 failed, 62 passed. With the fix: 63 passed (WSL, Python 3.12).bash .claude/hooks/lint.shpasses.Claude Code Review
Alignment review by Opus 5.5, in the format of
.claude/skills/alignment-review/SKILL.md.Automated Checks
bash .claude/hooks/lint.shTier 1: Fixes Required
None.
Tier 2: Alignment Discussion
None. The
reset()docstring now says overrides apply to that episode only.Note
Low Risk
Localized reset/scenario lifecycle change in the CARLA mock environment with a regression test; no auth or infra impact.
Overview
Fixes a bug where
reset(scenario_config={...})mutated the shared scenario object, so overrides such asmax_stepsstuck around on later plainreset()calls.CarlaEnvironmentnow keeps a_base_scenario(from the constructor or when the scenario name changes) and deep-copies it on everyreset(), applyingscenario_configonly to that episode’s copy. Thereset()docstring now states that overrides are per-episode.Adds
test_reset_scenario_config_applies_to_one_episodeto assert overrides apply for one reset and revert afterward.Reviewed by Cursor Bugbot for commit c8d4fcf. Bugbot is set up for automated code reviews on this repo. Configure here.