fix(cli): respect terminal.cwd config in local terminal backend#14796
Closed
Tranquil-Flow wants to merge 1 commit into
Closed
fix(cli): respect terminal.cwd config in local terminal backend#14796Tranquil-Flow wants to merge 1 commit into
Tranquil-Flow wants to merge 1 commit into
Conversation
init_session() runs a login shell bootstrap that sources profile scripts (.bashrc, .bash_profile, etc.) before capturing pwd. If any profile script changes the working directory, the captured cwd overwrites the configured terminal.cwd value — so terminal commands run in the wrong directory despite the TUI banner showing the configured path. Add an explicit 'builtin cd' to the configured cwd in the bootstrap script, after profile sourcing but before pwd capture, ensuring the configured terminal.cwd is always what gets recorded. Fixes NousResearch#14044
Collaborator
18 tasks
This was referenced Apr 29, 2026
Contributor
Author
|
Closing — identical fix has already landed on main. On current
This was salvaged into #17205 with the same change. No further action needed on this PR. Thanks for the original diagnosis. |
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.
What does this PR do?
init_session()runs a login shell bootstrap that sources profile scripts (.bashrc,.bash_profile, etc.) before capturingpwd. If any profile script changes the working directory, the captured cwd overwrites the configuredterminal.cwdvalue — so terminal commands run in the wrong directory despite the TUI banner showing the configured path.Related Issue
Fixes #14044
Type of Change
Changes Made
tools/environments/base.py: Ensureterminal.cwdconfig takes precedence over shell-detected cwd.tests/tools/test_init_session_cwd_respect.py: 4 tests covering the configured-cwd-wins behavior.How to Test
python -m pytest -o 'addopts=' tests/tools/test_init_session_cwd_respect.py -v -W error::pytest.PytestUnhandledThreadExceptionWarning4 passed.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs