fix(tui): read terminal.cwd from config.yaml in _completion_cwd() - #38757
fix(tui): read terminal.cwd from config.yaml in _completion_cwd()#38757yeeyuny wants to merge 1 commit into
Conversation
The TUI's _completion_cwd() function resolves the working directory for new sessions and completions, but its priority chain falls through to os.getcwd() without ever checking the profile's terminal.cwd setting in config.yaml. This means that regardless of what the user configured, the TUI always uses the directory from which `hermes --tui` was launched. In contrast, the WebUI bypasses this by injecting a [Workspace::v1: ...] tag into every user message, overriding the cwd at the agent level. Fix: insert a config.yaml terminal.cwd read into the _completion_cwd() priority chain, between TERMINAL_CWD and os.getcwd(). This makes the TUI respect the configured workspace automatically, while preserving all existing priorities (explicit user choice > session cwd > TERMINAL_CWD env > config > fallback). Priority chain after this change: 1. params['cwd'] (explicit user/workspace choice from frontend) 2. session['cwd'] (existing session's cwd) 3. TERMINAL_CWD env var (worktree mode) 4. config.yaml terminal.cwd (profile-configured workspace) <-- NEW 5. os.getcwd() (final fallback)
|
Closing in favor of #40892, which fixes this area correctly and is ready to merge. This change reads #40892 reads the bound profile's own Appreciate the attempt here. |
The TUI's _completion_cwd() function resolves the working directory for new sessions and completions, but its priority chain falls through to os.getcwd() without ever checking the profile's terminal.cwd setting in config.yaml. This means that regardless of what the user configured, the TUI always uses the directory from which
hermes --tuiwas launched.In contrast, the WebUI bypasses this by injecting a [Workspace::v1: ...] tag into every user message, overriding the cwd at the agent level.
Fix: insert a config.yaml terminal.cwd read into the _completion_cwd() priority chain, between TERMINAL_CWD and os.getcwd(). This makes the TUI respect the configured workspace automatically, while preserving all existing priorities (explicit user choice > session cwd > TERMINAL_CWD env > config > fallback).
Priority chain after this change:
What does this PR do?
Related Issue
Fixes #
Type of Change
Changes Made
How to Test
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/AFor New Skills
hermes --toolsets skills -q "Use the X skill to do Y"Screenshots / Logs