Skip to content

fix(tui): preserve fallback provider chain#18310

Closed
psionic73 wants to merge 1 commit into
NousResearch:mainfrom
psionic73:fix/tui-fallback-provider-chain-pr-20260501-081827
Closed

fix(tui): preserve fallback provider chain#18310
psionic73 wants to merge 1 commit into
NousResearch:mainfrom
psionic73:fix/tui-fallback-provider-chain-pr-20260501-081827

Conversation

@psionic73

@psionic73 psionic73 commented May 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Preserve the configured TUI fallback provider chain when creating AIAgent instances.
  • Load fallback_providers / legacy fallback_model in the TUI gateway path and pass the resulting chain through _make_agent().
  • Preserve the full _fallback_chain when cloning background agents, including the explicitly empty-chain case.

Problem

TUI-created agents did not reliably receive the configured fallback provider chain. Classic CLI / gateway paths could fail over, while the TUI path could lose or reduce the chain during agent construction or background-agent cloning.

Fix

  • Add TUI-side fallback loading helpers.
  • Pass fallback_model=_load_fallback_model() into AIAgent construction in tui_gateway/server.py.
  • Prefer the full _fallback_chain when building background-agent kwargs, rather than reducing the configuration to a single fallback model.

Tests

  • tests/test_tui_gateway_server.py: 172 passed

Latest local verification after rebasing onto current origin/main:

172 passed in 2.15s

@psionic73

Copy link
Copy Markdown
Contributor Author

This is a small TUI parity fix: it preserves configured fallback provider chains when agents are constructed through the TUI gateway path. Local targeted test: tests/test_tui_gateway_server.py, 164 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/) labels May 1, 2026
@psionic73 psionic73 force-pushed the fix/tui-fallback-provider-chain-pr-20260501-081827 branch from d60ba28 to a84ed03 Compare May 4, 2026 06:34
@psionic73

Copy link
Copy Markdown
Contributor Author

Status update after refresh:

  • Rebased/synced with current origin/main; branch remains 1 commit ahead / 0 behind.
  • Fork branch is in sync with the local branch.
  • PR is currently reported as mergeable.
  • Additional local targeted verification passed:
    • pytest tests/test_tui_gateway_server.py -k fallback — 4 passed
    • pytest tests/cron/test_scheduler.py — 112 passed

No further code changes were made beyond keeping the branch current with upstream main.

@psionic73 psionic73 force-pushed the fix/tui-fallback-provider-chain-pr-20260501-081827 branch 2 times, most recently from 4820f11 to 1ed7103 Compare May 7, 2026 11:51
@psionic73

Copy link
Copy Markdown
Contributor Author

Refreshed again against current origin/main.

  • Branch is 1 commit ahead / 0 behind origin/main.
  • Fork branch is in sync with local HEAD.
  • GitHub reports the PR as mergeable after recompute.
  • Local verification:
    • pytest tests/test_tui_gateway_server.py -k fallback — 6 passed
    • pytest tests/test_tui_gateway_server.py — 175 passed
    • hermes config check — config version 23 OK
    • CLI smoke — POST_REBASE_SMOKE_OK

No code changes beyond rebasing the existing fix over current main.

@psionic73 psionic73 force-pushed the fix/tui-fallback-provider-chain-pr-20260501-081827 branch from 1ed7103 to cc89de5 Compare May 7, 2026 15:22
@psionic73

Copy link
Copy Markdown
Contributor Author

Refreshed again against current origin/main after upstream moved forward.

  • Rebased the existing single TUI fallback-chain fix onto current origin/main (04918345ea31b1106d2ee6d4f42822f4f57616ee).
  • Branch is now 1 commit ahead / 0 behind origin/main.
  • Fork branch is in sync with local rebased HEAD (cc89de5b4177855ab1ca62fdb752c621ec888c05).
  • GitHub reports the PR as mergeable after recompute.
  • Checks: GitHub reports no checks for this fork branch.

Local verification:

  • pytest tests/test_tui_gateway_server.py -k fallback -q -o 'addopts=' — 6 passed
  • pytest tests/test_tui_gateway_server.py -q -o 'addopts=' — 178 passed
  • hermes config check via repo venv — config version 23 OK

No functional scope changes were made beyond rebasing the existing fix over current main.

@psionic73 psionic73 force-pushed the fix/tui-fallback-provider-chain-pr-20260501-081827 branch from cc89de5 to 8b878e7 Compare May 12, 2026 14:56
@psionic73

Copy link
Copy Markdown
Contributor Author

Refreshed against current origin/main again.

  • Force-with-lease updated the existing fork branch from cc89de5b4177855ab1ca62fdb752c621ec888c05 to 8b878e787264040f40557465b3ac38d4c6d5f6ed.
  • Branch is now 1 commit ahead / 0 behind origin/main.
  • Patch content remains the same TUI fallback-chain fix; local and prior fork patch IDs matched before refresh.
  • GitHub currently reports the PR as mergeable.
  • GitHub reports no checks for this fork branch.

Local verification:

  • scripts/run_tests.sh tests/test_tui_gateway_server.py::test_load_fallback_model_prefers_fallback_providers tests/test_tui_gateway_server.py::test_make_agent_passes_configured_fallback_chain tests/test_tui_gateway_server.py::test_background_agent_kwargs_preserves_full_fallback_chain tests/test_tui_gateway_server.py::test_background_agent_kwargs_preserves_empty_fallback_chain -q — 4 passed

@psionic73

Copy link
Copy Markdown
Contributor Author

Final pre-merge review from Hermes Agent:

  • Scope reviewed: tui_gateway/server.py, tests/test_tui_gateway_server.py.
  • The change is narrow and preserves configured TUI fallback provider chains during agent construction/background-agent cloning, including explicit empty-chain handling.
  • Targeted fallback-chain regression tests cover the affected behavior.
  • Local verification on current PR head: 4 targeted TUI fallback tests passed.
  • GitHub reports the PR as mergeable and no checks are reported for this fork branch.

Verdict: no blockers found; ready for maintainer merge.

@psionic73 psionic73 force-pushed the fix/tui-fallback-provider-chain-pr-20260501-081827 branch from 8b878e7 to d7ecb28 Compare May 14, 2026 10:17
@psionic73

Copy link
Copy Markdown
Contributor Author

Refreshed against current origin/main after upstream moved forward again.

  • Rebased the existing TUI fallback-chain fix onto current origin/main (ddb8d8fa842283ef651a6e4514f8f561f736c72e).
  • New PR head: d7ecb282a665b304568e3e86208d3b0c542d43a7.
  • Branch state after refresh: 1 commit ahead / 0 behind origin/main.
  • Fork/local parity verified after force-with-lease push: 0 ahead / 0 behind.
  • GitHub reports mergeable: MERGEABLE.
  • GitHub reports no checks.
  • Local verification: python -m pytest tests/test_tui_gateway_server.py -q → 178 passed.

No functional scope change intended beyond rebasing the existing fallback-provider-chain fix onto current upstream.

@psionic73 psionic73 force-pushed the fix/tui-fallback-provider-chain-pr-20260501-081827 branch from d7ecb28 to 825c3eb Compare May 15, 2026 14:23
@psionic73

Copy link
Copy Markdown
Contributor Author

Refreshed against current main.

Current head: 825c3eb495d2b49cb1d8bef96b61b81cd8d26e71
Base: d5416284f11ccbc735c8357f0ab35ce5f683ccc3
GitHub reports: MERGEABLE

Local verification:

  • tests/test_tui_gateway_server.py

Result: 181 passed.

No CI checks are reported by GitHub for this PR at the moment.

@psionic73 psionic73 force-pushed the fix/tui-fallback-provider-chain-pr-20260501-081827 branch from 825c3eb to e8cce7f Compare May 19, 2026 00:03
@psionic73

Copy link
Copy Markdown
Contributor Author

Refreshed against current origin/main after upstream moved forward.

  • Rebased the existing TUI fallback-provider-chain fix onto current origin/main (378bca1d2ff8ffee9158016295d8b44e2cc81d59).
  • New PR head: e8cce7f3941e120daa5a3bb4a4c9841e5b987f0c.
  • Branch is now 1 commit ahead / 0 behind origin/main.
  • Fork/local parity verified after force-with-lease push: 0 ahead / 0 behind.
  • GitHub reports mergeable: MERGEABLE (mergeStateStatus: UNSTABLE).
  • GitHub reports no checks for this fork branch.

Local verification:

  • scripts/run_tests.sh tests/test_tui_gateway_server.py -q -o 'addopts=' → 181 passed
  • git diff --check HEAD^..HEAD → OK

No intentional functional scope change beyond refreshing the existing fallback-provider-chain fix onto current upstream.

@psionic73 psionic73 force-pushed the fix/tui-fallback-provider-chain-pr-20260501-081827 branch from e8cce7f to 4814d9c Compare May 19, 2026 00:20
@psionic73

Copy link
Copy Markdown
Contributor Author

Refreshed again against latest origin/main after upstream advanced to include #23854.

  • Rebased onto current origin/main (2ef501e1f5a9530435b7db5e334f00747b1e7b8f).
  • New PR head: 4814d9cd371a6fcdf4385105b1459fc25f5a3d80.
  • Fork/local parity verified after force-with-lease push: 0 ahead / 0 behind.

Local verification:

  • python -m pytest tests/test_tui_gateway_server.py -q -o 'addopts=' → 181 passed

No intentional functional scope change beyond refreshing the existing TUI fallback-provider-chain fix onto current upstream.

@psionic73 psionic73 force-pushed the fix/tui-fallback-provider-chain-pr-20260501-081827 branch 2 times, most recently from f999731 to c62c4f0 Compare May 19, 2026 13:48
@psionic73 psionic73 force-pushed the fix/tui-fallback-provider-chain-pr-20260501-081827 branch 2 times, most recently from 085b220 to 4b73a4c Compare May 20, 2026 09:52
@psionic73 psionic73 force-pushed the fix/tui-fallback-provider-chain-pr-20260501-081827 branch from 4b73a4c to 67b51ac Compare May 25, 2026 13:31
@psionic73

Copy link
Copy Markdown
Contributor Author

Maintainer handoff / refresh status:

  • Refreshed on current main.
  • Base: 8f19485f538565630a35d992b06324f308f80630
  • Head: 67b51acbb59e49deeb2b8510c2b664a8d6c9e027
  • GitHub reports: MERGEABLE
  • GitHub checks are complete: 21 total, 18 success, 3 skipped, 0 pending, 0 failed.
  • Local targeted verification after refresh:
    • tests/test_tui_gateway_server.py: 186 passed
    • targeted fallback/upstream-drift checks: 6 passed

No further action needed from my side unless main moves again before merge.

@psionic73 psionic73 force-pushed the fix/tui-fallback-provider-chain-pr-20260501-081827 branch from 67b51ac to 9e92529 Compare May 26, 2026 22:24
@psionic73 psionic73 force-pushed the fix/tui-fallback-provider-chain-pr-20260501-081827 branch from 9e92529 to 4f0b534 Compare May 26, 2026 22:32
@psionic73

Copy link
Copy Markdown
Contributor Author

Refreshed this PR onto current upstream main.

Verification:

  • Base: f05a47309ec8842387e88eab856df55c6910b57b
  • Head: 4f0b53441d60e8177fd2f3f36c52a0f15c7a36d1
  • Local branch is 1 commit ahead / 0 behind origin/main
  • Fork/local parity after push: 0 0
  • GitHub mergeability: MERGEABLE
  • GitHub checks: 18 passed, 3 skipped, 0 pending, 0 failed
  • Local targeted tests: PYTHONPATH=$WT .venv/bin/python -m pytest -o addopts='' tests/test_tui_gateway_server.py -q → 186 passed

Note: an initial CI run hit an unrelated transient Chrome/browser-supervisor timeout in tests/tools/test_browser_supervisor.py; the branch was no-op amended to retrigger CI, and the fresh run is green. No functional scope change beyond the rebase/refresh.

@teknium1

teknium1 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Merged via #42625. Your commit was cherry-picked onto current main with your authorship preserved in git log (4b073d0). A small follow-up on top swaps the loader for the shared get_fallback_chain() helper so the TUI path matches CLI/gateway parity exactly. Thanks for the fix!

@teknium1 teknium1 closed this 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.

3 participants