fix(terminal): honor configured cwd at session init#14828
Closed
zwcf5200 wants to merge 1 commit into
Closed
Conversation
Apply upstream PR NousResearch#7802 behavior so BaseEnvironment captures its initial snapshot after cd'ing into the configured cwd. This preserves SSH terminal.cwd instead of letting the remote login shell home directory overwrite it. Upstream-PR: NousResearch#7802 Upstream-Commit: 12e3ef9
Collaborator
1 similar comment
Collaborator
This was referenced Apr 24, 2026
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
Apply upstream PR #7802 behavior so
BaseEnvironment.init_session()captures its initial snapshot after cd'ing into the configured cwd. This preserves SSH terminal.cwd instead of letting the remote login shell home directory overwrite it.Upstream reference: #7802
Upstream commit: 12e3ef9
Changes
tools/environments/base.py_quote_cwd_for_shell()static method to extract cwd quoting logic.init_session()bootstrap script to includecd {quoted_cwd} || exit 126before writing pwd, so the initial snapshot captures environment from the configured working directory.quoted_cwdcomputation in_wrap_command()to use the new static method.tests/tools/test_base_environment.pyTestInitSessionFailure.test_init_session_bootstrap_changes_to_configured_cwd: verifies thatinit_session()runs a login shell withcdinto the configured cwd and sets_snapshot_ready = True._wait_for_processreturn values instead of raw process handles.Testing
All 16 tests in
tests/tools/test_base_environment.pypass (CI-parity viascripts/run_tests.sh).