fix(tui): honor launch model overrides#15755
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes hermes --tui -m/--model (and --provider) launch overrides by exporting them into the TUI process environment and teaching the TUI gateway to honor those startup overrides (including provider auto-detection for model-only launches).
Changes:
- Export
--model/--providerinto the TUI child process viaHERMES_MODEL/HERMES_INFERENCE_MODELandHERMES_TUI_PROVIDER/HERMES_INFERENCE_PROVIDER. - Add gateway-side startup resolution that selects the correct model/provider when constructing
AIAgent, including provider detection when only a model override is provided. - Add/extend tests covering env-based model resolution and startup runtime behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
tui_gateway/server.py |
Adds startup model/provider resolution and uses it when creating AIAgent. |
hermes_cli/main.py |
Passes CLI --model/--provider through to the TUI child process via env vars; updates CLI help text. |
tests/test_tui_gateway_server.py |
Adds tests for _resolve_model() and _resolve_startup_runtime() behavior with env overrides and provider detection. |
tests/hermes_cli/test_tui_resume_flow.py |
Extends TUI resume/launch tests to ensure model/provider are passed through and exported. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- run the requested ui-tui lint+format pass and include resulting formatting updates - guard text-measure cache eviction key in hermes-ink so ui-tui type-check stays green
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 24 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- expand short model aliases like sonnet/opus via static catalogs during startup runtime resolution - keep startup alias resolution network-free and add regression tests in models and tui gateway suites
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 25 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- add reusable overlay key and help-text helpers for picker-style overlays - make model, session, skills, and pager hints consistently support Esc/q close behavior
- keep HERMES_INFERENCE_MODEL aligned with HERMES_MODEL after in-TUI model switches - clarify static provider detection remapping docs
- rename overlay help text component to match its role - share picker window math across model, session, and skills overlays
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 30 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
ui-tui/src/components/skillsHub.tsx:73
useOverlayKeysis disabled whileinstallingis true, so Esc/q won’t work during installs, but the rendered help text in the actions view still advertisesEnter/Esc back · q close. Either allow close/back during installs (removedisabled: installing) or conditionally update the help text while installing so the UI doesn’t suggest unavailable shortcuts.
.catch((e: unknown) => setErr(rpcErrorMessage(e)))
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Keep shared overlay close behavior consistent with pager and agents overlays by binding lowercase q only.
#16897) `/new` after `/model <custom-provider>:<model>` silently reverted to a native provider whose static catalog happened to contain the same model name (e.g. `deepseek-v4-pro` → native `deepseek` → 401). Root cause at the `/model` writeback site: `HERMES_INFERENCE_PROVIDER` was set unconditionally but `HERMES_TUI_PROVIDER` was only mirrored when it was already set. On sessions launched without `--provider`, `HERMES_TUI_PROVIDER` stayed unset, so `_resolve_startup_runtime()` on `/new` skipped the explicit-provider early return and fell through to `detect_static_provider_for_model()`. Fix: set `HERMES_TUI_PROVIDER` unconditionally alongside `HERMES_INFERENCE_PROVIDER` when `/model` lands. Keeps #15755's invariant intact — `HERMES_TUI_PROVIDER` remains the canonical "explicit this process" carrier, `HERMES_INFERENCE_PROVIDER` remains ambient and does not short-circuit startup resolution. Bug report and diagnosis: @Bartok9 in #16857 / #16873. Fixes #16857
…) (#16897) `/new` after `/model <custom-provider>:<model>` silently reverted to a native provider whose static catalog happened to contain the same model name (e.g. `deepseek-v4-pro` → native `deepseek` → 401). Root cause at the `/model` writeback site: `HERMES_INFERENCE_PROVIDER` was set unconditionally but `HERMES_TUI_PROVIDER` was only mirrored when it was already set. On sessions launched without `--provider`, `HERMES_TUI_PROVIDER` stayed unset, so `_resolve_startup_runtime()` on `/new` skipped the explicit-provider early return and fell through to `detect_static_provider_for_model()`. Fix: set `HERMES_TUI_PROVIDER` unconditionally alongside `HERMES_INFERENCE_PROVIDER` when `/model` lands. Keeps #15755's invariant intact — `HERMES_TUI_PROVIDER` remains the canonical "explicit this process" carrier, `HERMES_INFERENCE_PROVIDER` remains ambient and does not short-circuit startup resolution. Bug report and diagnosis: @Bartok9 in #16857 / #16873. Fixes #16857
…flag fix(tui): honor launch model overrides
…search#16857) (NousResearch#16897) `/new` after `/model <custom-provider>:<model>` silently reverted to a native provider whose static catalog happened to contain the same model name (e.g. `deepseek-v4-pro` → native `deepseek` → 401). Root cause at the `/model` writeback site: `HERMES_INFERENCE_PROVIDER` was set unconditionally but `HERMES_TUI_PROVIDER` was only mirrored when it was already set. On sessions launched without `--provider`, `HERMES_TUI_PROVIDER` stayed unset, so `_resolve_startup_runtime()` on `/new` skipped the explicit-provider early return and fell through to `detect_static_provider_for_model()`. Fix: set `HERMES_TUI_PROVIDER` unconditionally alongside `HERMES_INFERENCE_PROVIDER` when `/model` lands. Keeps NousResearch#15755's invariant intact — `HERMES_TUI_PROVIDER` remains the canonical "explicit this process" carrier, `HERMES_INFERENCE_PROVIDER` remains ambient and does not short-circuit startup resolution. Bug report and diagnosis: @Bartok9 in NousResearch#16857 / NousResearch#16873. Fixes NousResearch#16857
…flag fix(tui): honor launch model overrides
…search#16857) (NousResearch#16897) `/new` after `/model <custom-provider>:<model>` silently reverted to a native provider whose static catalog happened to contain the same model name (e.g. `deepseek-v4-pro` → native `deepseek` → 401). Root cause at the `/model` writeback site: `HERMES_INFERENCE_PROVIDER` was set unconditionally but `HERMES_TUI_PROVIDER` was only mirrored when it was already set. On sessions launched without `--provider`, `HERMES_TUI_PROVIDER` stayed unset, so `_resolve_startup_runtime()` on `/new` skipped the explicit-provider early return and fell through to `detect_static_provider_for_model()`. Fix: set `HERMES_TUI_PROVIDER` unconditionally alongside `HERMES_INFERENCE_PROVIDER` when `/model` lands. Keeps NousResearch#15755's invariant intact — `HERMES_TUI_PROVIDER` remains the canonical "explicit this process" carrier, `HERMES_INFERENCE_PROVIDER` remains ambient and does not short-circuit startup resolution. Bug report and diagnosis: @Bartok9 in NousResearch#16857 / NousResearch#16873. Fixes NousResearch#16857
…flag fix(tui): honor launch model overrides
…search#16857) (NousResearch#16897) `/new` after `/model <custom-provider>:<model>` silently reverted to a native provider whose static catalog happened to contain the same model name (e.g. `deepseek-v4-pro` → native `deepseek` → 401). Root cause at the `/model` writeback site: `HERMES_INFERENCE_PROVIDER` was set unconditionally but `HERMES_TUI_PROVIDER` was only mirrored when it was already set. On sessions launched without `--provider`, `HERMES_TUI_PROVIDER` stayed unset, so `_resolve_startup_runtime()` on `/new` skipped the explicit-provider early return and fell through to `detect_static_provider_for_model()`. Fix: set `HERMES_TUI_PROVIDER` unconditionally alongside `HERMES_INFERENCE_PROVIDER` when `/model` lands. Keeps NousResearch#15755's invariant intact — `HERMES_TUI_PROVIDER` remains the canonical "explicit this process" carrier, `HERMES_INFERENCE_PROVIDER` remains ambient and does not short-circuit startup resolution. Bug report and diagnosis: @Bartok9 in NousResearch#16857 / NousResearch#16873. Fixes NousResearch#16857
…flag fix(tui): honor launch model overrides
…search#16857) (NousResearch#16897) `/new` after `/model <custom-provider>:<model>` silently reverted to a native provider whose static catalog happened to contain the same model name (e.g. `deepseek-v4-pro` → native `deepseek` → 401). Root cause at the `/model` writeback site: `HERMES_INFERENCE_PROVIDER` was set unconditionally but `HERMES_TUI_PROVIDER` was only mirrored when it was already set. On sessions launched without `--provider`, `HERMES_TUI_PROVIDER` stayed unset, so `_resolve_startup_runtime()` on `/new` skipped the explicit-provider early return and fell through to `detect_static_provider_for_model()`. Fix: set `HERMES_TUI_PROVIDER` unconditionally alongside `HERMES_INFERENCE_PROVIDER` when `/model` lands. Keeps NousResearch#15755's invariant intact — `HERMES_TUI_PROVIDER` remains the canonical "explicit this process" carrier, `HERMES_INFERENCE_PROVIDER` remains ambient and does not short-circuit startup resolution. Bug report and diagnosis: @Bartok9 in NousResearch#16857 / NousResearch#16873. Fixes NousResearch#16857
…flag fix(tui): honor launch model overrides
…search#16857) (NousResearch#16897) `/new` after `/model <custom-provider>:<model>` silently reverted to a native provider whose static catalog happened to contain the same model name (e.g. `deepseek-v4-pro` → native `deepseek` → 401). Root cause at the `/model` writeback site: `HERMES_INFERENCE_PROVIDER` was set unconditionally but `HERMES_TUI_PROVIDER` was only mirrored when it was already set. On sessions launched without `--provider`, `HERMES_TUI_PROVIDER` stayed unset, so `_resolve_startup_runtime()` on `/new` skipped the explicit-provider early return and fell through to `detect_static_provider_for_model()`. Fix: set `HERMES_TUI_PROVIDER` unconditionally alongside `HERMES_INFERENCE_PROVIDER` when `/model` lands. Keeps NousResearch#15755's invariant intact — `HERMES_TUI_PROVIDER` remains the canonical "explicit this process" carrier, `HERMES_INFERENCE_PROVIDER` remains ambient and does not short-circuit startup resolution. Bug report and diagnosis: @Bartok9 in NousResearch#16857 / NousResearch#16873. Fixes NousResearch#16857
Summary
--tui -m/--modeland--providerinto the TUI child process so startup uses the launch-selected model/provider.HERMES_TUI_PROVIDERwins, while ambient inference provider stays in config-first resolution.hermes_cli.models, including short aliases likesonnet/opus./provideras a real alias of/modelin both CLI command metadata and TUI slash handling/completion.useOverlayKeys,OverlayHint,windowOffset/windowItems) so picker-style overlays share Esc/q close behavior, consistent hints, and list windowing.npm run fixforui-tuiand fix atype-checkfailure inhermes-inkby guarding cache-key eviction when the map iterator is empty.Test plan
scripts/run_tests.sh tests/hermes_cli/test_tui_resume_flow.py tests/test_tui_gateway_server.py tests/hermes_cli/test_models.pyscripts/run_tests.sh tests/hermes_cli/test_models.py tests/test_tui_gateway_server.pyscripts/run_tests.sh tests/test_tui_gateway_server.py::test_config_set_model_syncs_tui_provider_env tests/test_tui_gateway_server.py::test_config_set_model_syncs_inference_provider_env tests/hermes_cli/test_models.py::TestDetectProviderForModelnpm run fix && npm run type-check(inui-tui)npm test -- src/__tests__/createSlashHandler.test.ts(inui-tui)git diff --check