Skip to content

fix(tui): apply terminal backend config before launch - #42656

Merged
teknium1 merged 1 commit into
NousResearch:mainfrom
helix4u:fix/tui-terminal-backend-config
Jun 9, 2026
Merged

fix(tui): apply terminal backend config before launch#42656
teknium1 merged 1 commit into
NousResearch:mainfrom
helix4u:fix/tui-terminal-backend-config

Conversation

@helix4u

@helix4u helix4u commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes a terminal backend config bridge gap in native TUI/dashboard chat launch paths.

The terminal tool reads backend settings from env vars such as TERMINAL_ENV, but terminal.backend lives in config.yaml. Classic CLI startup imports cli.py, which bridges that config into env before tools run. The native TUI and dashboard embedded chat paths spawn child processes before/bypassing that bridge, so a config like terminal.backend: docker could appear in debug/config output while the actual terminal tool still created a local environment.

This adds a small shared bridge in hermes_cli.config, reuses it when hermes config set terminal.* syncs .env, and applies it to the native TUI/dashboard child env before launch.

Related Issue

N/A - support-thread fix. Checked related upstream PRs #25412, #13651, #28888, and closed #14079; none cover this TUI/dashboard child-launch backend propagation gap.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Added apply_terminal_config_to_env() and terminal_config_env_var_for_key() in hermes_cli/config.py so terminal config-to-env behavior has a shared path.
  • Updated hermes_cli/main.py TUI launch to hydrate terminal env vars from config before spawning the TUI process.
  • Updated hermes_cli/web_server.py dashboard embedded chat launch to hydrate terminal env vars from config before spawning the PTY process.
  • Added regression coverage for native TUI and dashboard embedded chat launch envs with terminal.backend: docker.

How to Test

  1. Set terminal.backend: docker in config.yaml and leave TERMINAL_ENV unset/stale in the parent process.
  2. Launch native TUI or dashboard embedded chat.
  3. Confirm the child env contains TERMINAL_ENV=docker before terminal tools initialize, so terminal calls use the configured Docker-compatible backend instead of falling back to local.

Local validation run:

  • python -m py_compile hermes_cli/config.py hermes_cli/main.py hermes_cli/web_server.py
  • git diff --check -- hermes_cli/config.py hermes_cli/main.py hermes_cli/web_server.py tests/hermes_cli/test_tui_resume_flow.py tests/hermes_cli/test_web_server.py
  • scripts/run_tests.sh -j 4 tests/hermes_cli/test_tui_resume_flow.py tests/hermes_cli/test_web_server.py -> 304 passed

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Linux/WSL targeted tests

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

N/A

Screenshots / Logs

N/A

Infographic

nous-system7

@helix4u
helix4u marked this pull request as ready for review June 9, 2026 07:10
@teknium1
teknium1 merged commit f8adefd into NousResearch:main Jun 9, 2026
23 checks passed
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tui Terminal UI (ui-tui/ + tui_gateway/) comp/cli CLI entry point, hermes_cli/, setup wizard tool/terminal Terminal execution and process management backend/docker Docker container execution labels Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend/docker Docker container execution comp/cli CLI entry point, hermes_cli/, setup wizard comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists tool/terminal Terminal execution and process management type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants