hermes - 💡(How to fix) Fix FR: single-source terminal config→env bridge (eliminate 3-dict drift) [1 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#28892Fetched 2026-05-20 04:01:17
View on GitHub
Comments
0
Participants
1
Timeline
7
Reactions
0
Author
Participants
Timeline (top)
labeled ×7

Code Example

# hermes_cli/terminal_env_bridge.py (new file)
TERMINAL_ENV_BRIDGE: dict[str, str] = {
    "backend": "TERMINAL_ENV",
    "cwd": "TERMINAL_CWD",
    "timeout": "TERMINAL_TIMEOUT",
    "docker_image": "TERMINAL_DOCKER_IMAGE",
    "docker_extra_args": "TERMINAL_DOCKER_EXTRA_ARGS",
    "docker_forward_env": "TERMINAL_DOCKER_FORWARD_ENV",
    "docker_volumes": "TERMINAL_DOCKER_VOLUMES",
    "docker_env": "TERMINAL_DOCKER_ENV",
    "docker_mount_cwd_to_workspace": "TERMINAL_DOCKER_MOUNT_CWD_TO_WORKSPACE",
    "docker_run_as_host_user": "TERMINAL_DOCKER_RUN_AS_HOST_USER",
    # ... all remaining keys
}

---

# cli.py
from hermes_cli.terminal_env_bridge import TERMINAL_ENV_BRIDGE as env_mappings

# gateway/run.py
from hermes_cli.terminal_env_bridge import TERMINAL_ENV_BRIDGE as _terminal_env_map

# config.py — prefix keys with "terminal." for dotted-notation matching
from hermes_cli.terminal_env_bridge import TERMINAL_ENV_BRIDGE
_config_to_env_sync = {f"terminal.{k}": v for k, v in TERMINAL_ENV_BRIDGE.items()}
RAW_BUFFERClick to expand / collapse

Feature Request: Single-Source Terminal Config→Env Bridge

Problem

terminal.* config keys must be bridged to TERMINAL_* env vars via three independent dictionaries that must stay perfectly synchronized:

FileDictWhen used
cli.pyenv_mappingsCLI / TUI startup
gateway/run.py_terminal_env_mapGateway / messaging startup
hermes_cli/config.py_config_to_env_synchermes config set one-shot

This violates DRY and has caused the same bug at least 3 times — a new key added to the terminal defaults in config.py without updating all three bridge dicts, silently dropping the setting:

Missing keyDiscovered via
docker_mount_cwd_to_workspaceUser bug report
docker_run_as_host_userUser bug report
docker_extra_args#28863, fixed in #28888

test_terminal_config_env_sync.py catches drift post-hoc in CI, but doesn't prevent the bug at the source. Every new terminal.* key still requires a 4-file change (defaults + 3 dicts).

Proposal

Define a canonical mapping in one place and import it everywhere:

# hermes_cli/terminal_env_bridge.py (new file)
TERMINAL_ENV_BRIDGE: dict[str, str] = {
    "backend": "TERMINAL_ENV",
    "cwd": "TERMINAL_CWD",
    "timeout": "TERMINAL_TIMEOUT",
    "docker_image": "TERMINAL_DOCKER_IMAGE",
    "docker_extra_args": "TERMINAL_DOCKER_EXTRA_ARGS",
    "docker_forward_env": "TERMINAL_DOCKER_FORWARD_ENV",
    "docker_volumes": "TERMINAL_DOCKER_VOLUMES",
    "docker_env": "TERMINAL_DOCKER_ENV",
    "docker_mount_cwd_to_workspace": "TERMINAL_DOCKER_MOUNT_CWD_TO_WORKSPACE",
    "docker_run_as_host_user": "TERMINAL_DOCKER_RUN_AS_HOST_USER",
    # ... all remaining keys
}

Then cli.py, gateway/run.py, and config.py each import and (if needed) adapt:

# cli.py
from hermes_cli.terminal_env_bridge import TERMINAL_ENV_BRIDGE as env_mappings

# gateway/run.py
from hermes_cli.terminal_env_bridge import TERMINAL_ENV_BRIDGE as _terminal_env_map

# config.py — prefix keys with "terminal." for dotted-notation matching
from hermes_cli.terminal_env_bridge import TERMINAL_ENV_BRIDGE
_config_to_env_sync = {f"terminal.{k}": v for k, v in TERMINAL_ENV_BRIDGE.items()}

Edge cases like cwd placeholder skipping and sudo_password special handling stay at the call site — only the key→env-var mapping is centralized.

Benefits

MetricBeforeAfter
Files to edit for a new terminal key41
Drift recurrence probabilityHigh (proven 3x)Zero
Existing drift test still neededYes (belt-and-suspenders)Yes (defense-in-depth)
Behavior changeNone (pure refactor)

Scope

  • New file: hermes_cli/terminal_env_bridge.py (~30 lines)
  • Modified: cli.py, gateway/run.py, hermes_cli/config.py (replace inline dicts with imports)
  • Existing test test_terminal_config_env_sync.py continues to pass unchanged
  • Estimated diff: ~+40/-60 (net reduction)

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

hermes - 💡(How to fix) Fix FR: single-source terminal config→env bridge (eliminate 3-dict drift) [1 participants]