hermes-agent/tui_gateway
webtecnica 56a41715dc fix: persist provider on model switch and add billing_provider fallback
Salvage of #79604 (webtecnica) + #85721 (pierrenode), combined and
rebased onto current main with simplify-code findings folded in.

#79604: update_session_model() wrote the model name to sessions.model
but never persisted the provider into model_config. On resume, the
runtime recombined the persisted model with the config.yaml primary
provider (which may not serve that model), producing auth errors.
Fix: add optional provider parameter to update_session_model, merged
into model_config via the shared _merge_model_config_json helper (not
hand-rolled SQL). Wire both gateway /model call sites to pass
result.target_provider.

#85721: session_gateway_runtime() had no billing_provider fallback.
A CLI session that never ran /model has no gateway_runtime or
top-level provider in model_config — billing_provider (written on
every session's first accounted API call) is the only durable record.
Fix: add billing_provider as the last-resort fallback in
session_gateway_runtime(), filtering bare billing buckets (auto/custom)
that are not routable identities.

Simplify-code findings addressed:
- Use _merge_model_config_json instead of 40 lines of branched SQL
- Share _BARE_BILLING_PROVIDERS from hermes_state.py (was duplicated
  as a set in tui_gateway/server.py)
- Merge None-filtering from #85920 with the billing_provider fallback
  into one coherent return path

Co-authored-by: pierrenode <298902573+pierrenode@users.noreply.github.com>
2026-08-14 14:39:08 +05:30
..
__init__.py feat: new tui based on ink 2026-04-02 19:07:53 -05:00
_stdin_recovery.py fix: Windows guard, dedup recovery, profile-safe paths, clear SO_RCVTIMEO 2026-07-20 12:48:50 +05:30
compute_host.py tui_gateway: close dedicated profile SessionDB handles at teardown too 2026-08-07 19:44:41 +05:30
entry.py fix(review): harden portable plugin boundaries 2026-08-07 09:44:21 -07:00
event_publisher.py chore: address copilot comments 2026-04-24 12:51:04 -04:00
git_probe.py perf(gateway): stop spawning git for paths that cannot answer 2026-08-09 06:53:55 -05:00
host_supervisor.py fix(windows): widen utf-8 subprocess decode guard to sibling desktop-backend sites 2026-07-24 09:48:28 -07:00
loop_noise.py fix(tui_gateway): suppress WS peer-hangup teardown error flood (#50005) (#54126) 2026-06-28 02:35:01 -07:00
method_ctx.py refactor(tui): split @method handlers into methods_* modules (mechanical move, registry set-equality verified) 2026-07-29 11:46:31 -07:00
methods_complete.py feat(complete): offer agent profiles as @mention completions (#85799) 2026-08-13 20:43:41 -07:00
methods_config.py fix(personality): single-owner personality state + one-time reset migration 2026-08-09 10:33:58 -07:00
methods_images.py fix: route image.generate through the provider dispatcher (#85520) 2026-08-13 11:23:51 -07:00
methods_profiles.py feat(gateway): share_auth on profiles.create + MCP servers in describe/configure (#85963) 2026-08-14 02:08:16 -07:00
methods_prompt.py refactor(gateway/desktop): consent-first truncation precedence + dedup (simplify pass) 2026-08-13 13:35:55 +05:30
methods_session.py fix(gateway/desktop): durable row-id addressing for rewind truncation 2026-08-13 13:35:55 +05:30
methods_tools.py feat: forward repeat through cron.manage add (#85602) 2026-08-13 13:14:57 -07:00
project_tree.py feat(profiles): serve a cross-profile project tree and per-profile usage totals 2026-08-10 03:13:08 -05:00
render.py tui: inherit Python-side rendering via gateway bridge 2026-04-05 18:50:41 -05:00
server.py fix: persist provider on model switch and add billing_provider fallback 2026-08-14 14:39:08 +05:30
slash_fuzzy.py Port from superagent-ai/grok-cli: description-aware slash-menu fuzzy scoring 2026-08-08 04:29:16 -07:00
slash_worker.py polish(mem): readonly config read, debug-level trim logs, loud frame test 2026-08-02 22:44:38 +05:30
synthetic_turn.py feat(dashboard): isolate turns in compute host (#65895) 2026-07-16 15:24:03 -04:00
transport.py fix(tui-gateway): harden stdio transport against half-closed pipes + SIGTERM races (#17118) 2026-04-28 17:54:06 -05:00
turn_marker.py feat(desktop): crash-survivable in-flight turn journal 2026-07-24 23:31:55 -05:00
ws.py perf(cold-start): mitigate ~14s GIL stall during backend init (#60800) 2026-08-03 21:16:09 +05:30