fix(cli): bridge terminal.cwd config to TERMINAL_CWD in TUI gateway#14079
Closed
konsisumer wants to merge 1 commit into
Closed
fix(cli): bridge terminal.cwd config to TERMINAL_CWD in TUI gateway#14079konsisumer wants to merge 1 commit into
konsisumer wants to merge 1 commit into
Conversation
In TUI mode (`hermes chat` with --tui), cli.py and its load_cli_config()
are never imported, so terminal.cwd from config.yaml was never bridged to
the TERMINAL_CWD environment variable. This caused the terminal tool to
use the launch directory (os.getcwd()) rather than the configured path.
- Add config.yaml → env var bridge to tui_gateway/server.py startup,
mirroring the equivalent bridge already present in gateway/run.py.
Placeholder cwd values (".", "auto", "cwd") are skipped so they don't
overwrite a pre-resolved TERMINAL_CWD.
- Fix complete.path handler to resolve relative paths against TERMINAL_CWD
instead of the process launch directory, so TUI path completions also
honour the configured working directory.
- Update existing test_complete_path_at_filter tests to use
monkeypatch.setenv("TERMINAL_CWD", ...) rather than monkeypatch.chdir,
matching the new resolution order.
Fixes NousResearch#14044
Contributor
Author
19 tasks
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.
When
hermes chatlaunches the TUI,cli.pyand itsload_cli_config()are never imported, soterminal.cwdinconfig.yamlwas never bridged to theTERMINAL_CWDenvironment variable. Everything in the TUI gateway then fell back toos.getcwd()(the directory wherehermes chatwas invoked), ignoring the configured path.What changed and why
tui_gateway/server.pystartup: Added aconfig.yaml→ env var bridge for allterminal.*settings, mirroring the equivalent bridge already present ingateway/run.py. Placeholdercwdvalues (".","auto","cwd") are skipped to avoid overwriting a pre-resolvedTERMINAL_CWD.complete.pathhandler: Changed relative path resolution to useTERMINAL_CWD(falling back toos.getcwd()) as the base directory instead of the hardcoded process CWD (".")). Also fixedos.path.relpath()calls to be relative toTERMINAL_CWD, so completion texts are correct.test_complete_path_at_filter.py): Updated four tests to usemonkeypatch.setenv("TERMINAL_CWD", ...)instead ofmonkeypatch.chdir(), matching the new resolution order and making them robust to any pre-setTERMINAL_CWDin the test environment.tests/tui_gateway/test_cwd_config_bridge.py): 14 tests covering the config bridge semantics (placeholder skipping, override behaviour) andcomplete.pathresolution againstTERMINAL_CWD.How to test
terminal.cwd: /some/absolute/pathin~/.hermes/config.yamlhermes chat(TUI mode)pwd— it should report/some/absolute/path./in the chat input — file completions should list contents of/some/absolute/path, not the launch directorypytest tests/tui_gateway/test_cwd_config_bridge.py tests/gateway/test_complete_path_at_filter.py -vWhat platforms tested on
Fixes #14044