Skip to content

fix(tui): honor launch model overrides#15755

Merged
OutThisLife merged 12 commits into
mainfrom
bb/tui-model-flag
Apr 25, 2026
Merged

fix(tui): honor launch model overrides#15755
OutThisLife merged 12 commits into
mainfrom
bb/tui-model-flag

Conversation

@OutThisLife

@OutThisLife OutThisLife commented Apr 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Pass --tui -m/--model and --provider into the TUI child process so startup uses the launch-selected model/provider.
  • Keep TUI startup provider resolution deterministic: explicit HERMES_TUI_PROVIDER wins, while ambient inference provider stays in config-first resolution.
  • Avoid startup network lookups by sharing static provider detection from hermes_cli.models, including short aliases like sonnet/opus.
  • Bind /provider as a real alias of /model in both CLI command metadata and TUI slash handling/completion.
  • Add reusable TUI overlay helpers (useOverlayKeys, OverlayHint, windowOffset/windowItems) so picker-style overlays share Esc/q close behavior, consistent hints, and list windowing.
  • Run npm run fix for ui-tui and fix a type-check failure in hermes-ink by 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.py
  • scripts/run_tests.sh tests/hermes_cli/test_models.py tests/test_tui_gateway_server.py
  • scripts/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::TestDetectProviderForModel
  • npm run fix && npm run type-check (in ui-tui)
  • npm test -- src/__tests__/createSlashHandler.test.ts (in ui-tui)
  • git diff --check

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/--provider into the TUI child process via HERMES_MODEL / HERMES_INFERENCE_MODEL and HERMES_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.

Comment thread tui_gateway/server.py
Comment thread tui_gateway/server.py
@OutThisLife OutThisLife requested a review from Copilot April 25, 2026 18:39
@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 labels Apr 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tui_gateway/server.py
Comment thread tests/test_tui_gateway_server.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tui_gateway/server.py Outdated
- 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tui_gateway/server.py
- 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tui_gateway/server.py
Comment thread hermes_cli/models.py
- 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
@OutThisLife OutThisLife requested a review from Copilot April 25, 2026 19:19
- rename overlay help text component to match its role
- share picker window math across model, session, and skills overlays

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • useOverlayKeys is disabled while installing is true, so Esc/q won’t work during installs, but the rendered help text in the actions view still advertises Enter/Esc back · q close. Either allow close/back during installs (remove disabled: 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.

Comment thread ui-tui/src/components/overlayControls.tsx
Comment thread ui-tui/src/components/overlayControls.tsx
Keep shared overlay close behavior consistent with pager and agents overlays by binding lowercase q only.
@OutThisLife OutThisLife merged commit 283c8fd into main Apr 25, 2026
10 of 12 checks passed
@OutThisLife OutThisLife deleted the bb/tui-model-flag branch April 25, 2026 19:30
teknium1 added a commit that referenced this pull request Apr 28, 2026
#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
cluricaun28 referenced this pull request in cluricaun28/Logos Apr 28, 2026
…) (#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
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
…flag

fix(tui): honor launch model overrides
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
…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
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…flag

fix(tui): honor launch model overrides
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…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
dannyJ848 pushed a commit to dannyJ848/hermes-agent that referenced this pull request May 17, 2026
…flag

fix(tui): honor launch model overrides
dannyJ848 pushed a commit to dannyJ848/hermes-agent that referenced this pull request May 17, 2026
…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
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…flag

fix(tui): honor launch model overrides
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…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
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…flag

fix(tui): honor launch model overrides
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard 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