fix(gateway): don't clobber resolved TERMINAL_CWD with raw config value#4673
Closed
HenkDz wants to merge 1 commit into
Closed
fix(gateway): don't clobber resolved TERMINAL_CWD with raw config value#4673HenkDz wants to merge 1 commit into
HenkDz wants to merge 1 commit into
Conversation
When cli.py imports, it resolves terminal.cwd='.' to os.getcwd() and sets TERMINAL_CWD to the absolute path. But gateway/run.py is later imported as a plugin, and its module-level config bridging code re-reads the raw '.' from config.yaml and overwrites TERMINAL_CWD. The subsequent fallback logic (line 208-211) then treats '.' as unresolved and defaults to Path.home(). This causes the terminal to always open in $HOME instead of the directory where hermes was launched. Fix: skip setting cwd in the terminal env bridge when TERMINAL_CWD is already set to an absolute path.
Contributor
Author
malaiwah
added a commit
to malaiwah/hermes-agent
that referenced
this pull request
Apr 5, 2026
…ge config and invalid workdir bypass - PR NousResearch#4350: Load config.yaml terminal block as fallback before hardcoded defaults - Fixes docker_image in config.yaml not being loaded - Adds cfg.get() fallbacks for all terminal config options - PR NousResearch#4673: Don't clobber already-resolved absolute TERMINAL_CWD - Fixes invalid workdir bypassing terminal.cwd config - Skips config override when env var already has absolute path
malaiwah
added a commit
to malaiwah/hermes-agent
that referenced
this pull request
Apr 11, 2026
…ge config and invalid workdir bypass - PR NousResearch#4350: Load config.yaml terminal block as fallback before hardcoded defaults - Fixes docker_image in config.yaml not being loaded - Adds cfg.get() fallbacks for all terminal config options - PR NousResearch#4673: Don't clobber already-resolved absolute TERMINAL_CWD - Fixes invalid workdir bypassing terminal.cwd config - Skips config override when env var already has absolute path
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
Fixes #4672
When
cli.pyresolvesterminal.cwd: "."toos.getcwd()and setsTERMINAL_CWDto the absolute path,gateway/run.pyis later imported as a plugin and its module-level config bridging code re-reads the raw"."fromconfig.yaml, overwriting the resolved value. The subsequent fallback logic then defaults toPath.home().This causes the terminal to always open in
$HOMEinstead of the directory where hermes was launched.Change
In
gateway/run.py, skip settingcwdin the terminal env bridge whenTERMINAL_CWDis already set to an absolute path: