hermes - ✅(Solved) Fix [Bug]: terminal.cwd is not respected by terminal tool [3 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#14044Fetched 2026-04-23 07:47:10
View on GitHub
Comments
2
Participants
2
Timeline
10
Reactions
0
Timeline (top)
labeled ×5cross-referenced ×3commented ×2

Error Message

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

PR fix notes

PR #14079: fix(cli): bridge terminal.cwd config to TERMINAL_CWD in TUI gateway

Description (problem / solution / changelog)

When hermes chat launches the TUI, cli.py and its load_cli_config() are never imported, so terminal.cwd in config.yaml was never bridged to the TERMINAL_CWD environment variable. Everything in the TUI gateway then fell back to os.getcwd() (the directory where hermes chat was invoked), ignoring the configured path.

What changed and why

  • tui_gateway/server.py startup: Added a config.yaml → env var bridge for all terminal.* settings, mirroring the equivalent bridge already present in gateway/run.py. Placeholder cwd values (".", "auto", "cwd") are skipped to avoid overwriting a pre-resolved TERMINAL_CWD.
  • complete.path handler: Changed relative path resolution to use TERMINAL_CWD (falling back to os.getcwd()) as the base directory instead of the hardcoded process CWD (".")). Also fixed os.path.relpath() calls to be relative to TERMINAL_CWD, so completion texts are correct.
  • Existing tests (test_complete_path_at_filter.py): Updated four tests to use monkeypatch.setenv("TERMINAL_CWD", ...) instead of monkeypatch.chdir(), matching the new resolution order and making them robust to any pre-set TERMINAL_CWD in the test environment.
  • New tests (tests/tui_gateway/test_cwd_config_bridge.py): 14 tests covering the config bridge semantics (placeholder skipping, override behaviour) and complete.path resolution against TERMINAL_CWD.

How to test

  • Set terminal.cwd: /some/absolute/path in ~/.hermes/config.yaml
  • Run hermes chat (TUI mode)
  • Ask the model to run pwd — it should report /some/absolute/path
  • Type ./ in the chat input — file completions should list contents of /some/absolute/path, not the launch directory
  • Run pytest tests/tui_gateway/test_cwd_config_bridge.py tests/gateway/test_complete_path_at_filter.py -v

What platforms tested on

  • macOS on darwin-arm64 (local)

Fixes #14044

<!-- autocontrib:worker-id=issue-new-81f7c474 kind=pr-open -->

Changed files

  • tests/gateway/test_complete_path_at_filter.py (modified, +4/-4)
  • tests/tui_gateway/test_cwd_config_bridge.py (added, +212/-0)
  • tui_gateway/server.py (modified, +66/-7)

PR #14136: fix(cli): respect terminal.cwd in chat sessions

Description (problem / solution / changelog)

Fixes #14044.

Summary

  • seed environment snapshots from the configured terminal cwd so chat sessions stop resetting to the launch directory
  • resolve relative CLI path completions from TERMINAL_CWD instead of the process cwd
  • add regressions covering both the local terminal session cwd and interactive path completion behavior

Testing

  • pytest -o addopts= tests/hermes_cli/test_path_completion.py
  • pytest -o addopts= tests/tools/test_local_shell_init.py

Changed files

  • hermes_cli/commands.py (modified, +12/-4)
  • tests/hermes_cli/test_path_completion.py (modified, +17/-0)
  • tests/tools/test_local_shell_init.py (modified, +21/-0)
  • tools/environments/base.py (modified, +7/-1)

PR #14264: fix(terminal): use TERMINAL_CWD for local backend default_cwd

Description (problem / solution / changelog)

Previously, the 'local' backend always defaulted to os.getcwd() regardless of the terminal.cwd config / TERMINAL_CWD env var, because the local branch set default_cwd before the shared TERMINAL_CWD lookup. Now the local branch also respects TERMINAL_CWD when set.

Closes #14044

Changed files

  • agent/error_classifier.py (modified, +8/-0)
  • gateway/run.py (modified, +1/-1)
  • plugins/memory/holographic/retrieval.py (modified, +15/-1)
  • tools/terminal_tool.py (modified, +3/-1)

Code Example

Debug report uploaded:
  Report     https://paste.rs/KJqq8
  agent.log  https://paste.rs/EUd0D

---
RAW_BUFFERClick to expand / collapse

Bug Description

I have terminal.cwd in config.yaml set to absolute path e.g. /home/username/projects. The path shows up in TUI/CLI, but the actual calls to terminal tool (e.g. pwd) show that the working dir is the one I have run hermes command in. File & path completions in the TUI's input field resolve relative to the directory where I invoked "hermes chat" command.

Steps to Reproduce

  1. set terminal.cwd to anything other than '.' in config.yaml
  2. run "hermes chat"
  3. ask model to run pwd (or anything else with terminal tool, local backend)
  4. type ./ in the chat window to elicit file completions

Expected Behavior

terminal and chat TUI completions pick up path from terminal.cwd as the current working directory

Actual Behavior

terminal commands and completions work as if '.' (where "hermes chat" was started) is the current directory

Affected Component

CLI (interactive chat)

Messaging Platform (if gateway-related)

No response

Debug Report

Debug report uploaded:
  Report     https://paste.rs/KJqq8
  agent.log  https://paste.rs/EUd0D

Operating System

Arch

Python Version

3.14.4

Hermes Version

0.10.0

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

The issue can be addressed by ensuring that the terminal.cwd configuration is correctly applied to the terminal tool and file completions in the TUI.

Guidance

  • Verify that the terminal.cwd path in config.yaml is correctly formatted and points to an existing directory.
  • Check if the hermes chat command is properly parsing the config.yaml file and applying the terminal.cwd setting to the terminal tool.
  • Investigate if there are any environment variables or other configuration settings that might be overriding the terminal.cwd setting.
  • Test the hermes chat command with different terminal.cwd settings to see if the issue is specific to a particular directory or configuration.

Example

No code snippet is provided as the issue does not contain sufficient information to create a specific example.

Notes

The issue seems to be related to the configuration and parsing of the terminal.cwd setting, but without more information about the hermes command and its configuration parsing, it's difficult to provide a more specific solution.

Recommendation

Apply a workaround by setting the terminal.cwd to a relative path or a path that is relative to the current working directory, and verify if this resolves the issue. This is because the hermes chat command seems to be using the current working directory as the base for file completions and terminal commands, despite the terminal.cwd setting.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING