Conversation
Author
|
Closing at contributor request. |
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
Use
TERMINAL_CWDwhen building local environment hints so the prompt reports the same current working directory that the terminal tool will use by default.If
TERMINAL_CWDis not set, the existingos.getcwd()behavior is preserved.Why
Long-running Hermes processes can be launched from one directory while a session, cron job, worktree, or worker is configured to run terminal commands from another directory.
In that case, the terminal tool may correctly default to
TERMINAL_CWD, but the prompt still reports the process cwd fromos.getcwd(). This can mislead the model into passing the stale prompt cwd back as an explicitworkdir, overriding the intended terminal default.Changes
TERMINAL_CWDoveros.getcwd()inbuild_environment_hints().~in the reported cwd for consistency.TERMINAL_CWD.Test plan
python -m pytest tests/agent/test_prompt_builder.py::TestEnvironmentHints::test_build_environment_hints_uses_terminal_cwd_for_local_backend -q -o 'addopts='Also run together with the related delegate timeout diagnostic tests:
python -m pytest \ tests/agent/test_prompt_builder.py::TestEnvironmentHints::test_build_environment_hints_uses_terminal_cwd_for_local_backend \ tests/tools/test_delegate_subagent_timeout_diagnostic.py \ -q -o 'addopts='Result: