Skip to content

fix(tui): wire fallback provider chain into desktop GUI / TUI / dashboard chat (salvage #18310)#42625

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-9bc73617
Jun 9, 2026
Merged

fix(tui): wire fallback provider chain into desktop GUI / TUI / dashboard chat (salvage #18310)#42625
teknium1 merged 2 commits into
mainfrom
hermes/hermes-9bc73617

Conversation

@teknium1

@teknium1 teknium1 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Desktop GUI, hermes --tui, and the embedded dashboard chat now respect the configured fallback_providers / fallback_model chain — previously they silently had an empty fallback chain and a turn would fail on the primary instead of failing over.

Salvages #18310 (@psionic73) onto current main, where _make_agent has since gained a model_override parameter.

Root cause

tui_gateway/server.py::_make_agent() built the chat AIAgent without passing fallback_model=, so agent._fallback_chain ended up [] for every TUI-backed session (desktop GUI, Ink TUI, dashboard /chat). The CLI (cli.py) and the messaging gateway (gateway/run.py) both wire this correctly; only the tui_gateway path was missed. A second-order bug: _background_agent_kwargs() propagated fallback via getattr(agent, "_fallback_model", None), which was always None because the foreground agent never had it set.

Fixes #28753.

Changes

  • tui_gateway/server.py: pass fallback_model=_load_fallback_model() into _make_agent; _load_fallback_model delegates to the shared hermes_cli.fallback_config.get_fallback_chain() (parity with CLI/gateway — fallback_providers first + legacy fallback_model merged in, deduped). Background/preview agents now forward the full _fallback_chain instead of the legacy single entry.
  • tests/test_tui_gateway_server.py: assert the merged canonical chain semantics.
  • scripts/release.py: add @psionic73 to AUTHOR_MAP (CI gate).

Validation

Before After
_make_agent agent _fallback_chain (config has chain) [] full chain
Background-agent fallback propagation None full chain
tests/test_tui_gateway_server.py 243 passed
E2E (real AIAgent via _make_agent, isolated HERMES_HOME) chain empty chain populated + background propagation verified

Original PR: #18310 — cherry-picked with @psionic73's authorship preserved.

Infographic

Fallback chain wired into Desktop GUI / TUI / Dashboard chat

psionic73 and others added 2 commits June 8, 2026 22:40
Follow-up to the salvaged fallback-chain fix:
- Replace the hand-rolled fallback loader with the shared
  hermes_cli.fallback_config.get_fallback_chain() helper so the TUI path
  matches HermesCLI and gateway/run.py exactly: fallback_providers stays
  first and keeps order, with distinct legacy fallback_model entries
  merged in after (deduped). Previously the TUI loader picked one key OR
  the other, diverging from CLI/gateway when both were set.
- Update the test to assert the merged canonical semantics.
- Add psionic73 to scripts/release.py AUTHOR_MAP (CI gate).
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-9bc73617 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10569 on HEAD, 10569 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5557 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@teknium1 teknium1 merged commit 520b59d into main Jun 9, 2026
23 checks passed
@teknium1 teknium1 deleted the hermes/hermes-9bc73617 branch June 9, 2026 05:53
@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/) labels Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] TUI sessions do not propagate fallback_model/fallback_providers to AIAgent

3 participants