fix(tui): /model writes HERMES_TUI_PROVIDER unconditionally (#16857)#16897
Merged
Conversation
`/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
…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
…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
…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
…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
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/newafter/model <custom-provider>:<model>now honours the user's explicit provider choice instead of silently reverting to a native provider that coincidentally has the model in its static catalog (e.g.deepseek-v4-pro→ nativedeepseek→ 401).Root cause
In
_apply_model_switch(tui_gateway/server.py:850-853),/modelsetHERMES_INFERENCE_PROVIDERunconditionally but mirrored toHERMES_TUI_PROVIDERonly if it was already set. Sessions launched without--providernever haveHERMES_TUI_PROVIDERset, so on/new,_resolve_startup_runtime()skipped the explicit-provider early return (which keys offHERMES_TUI_PROVIDER) and fell through todetect_static_provider_for_model(), which matched the model name against native catalogs.Why fix at the
/modelwriteback site, not_resolve_startup_runtime@Bartok9's original PR #16873 early-returned
HERMES_INFERENCE_PROVIDERin_resolve_startup_runtime. That works for this bug but partially reverts #15755 (commit 57b43fd), which deliberately removed that early return becauseHERMES_INFERENCE_PROVIDERcan be ambient (shell-inherited, .env, persisted from prior processes) and ambient values shouldn't short-circuit resolution.Brooklyn's invariant from #15755:
HERMES_TUI_PROVIDER= explicit-this-process (user chose it via--provideror/model)HERMES_INFERENCE_PROVIDER= ambient (may be stale)The real bug was that
/modelwasn't writing to the canonical "explicit" carrier. Fixing at the writeback site preserves both invariants simultaneously.Changes
tui_gateway/server.py:/modelnow setsHERMES_TUI_PROVIDER = target_providerunconditionally alongsideHERMES_INFERENCE_PROVIDER.tests/test_tui_gateway_server.py: regression testtest_config_set_model_syncs_tui_provider_unconditionallycovers the TUI: /new after /model switch to custom provider model fails with 'no API key' when model name exists in native provider catalog #16857 scenario (no pre-setHERMES_TUI_PROVIDER, custom provider selection).Validation
syncs_tui_provider,syncs_inference_provider,startup_runtime)/model custom:xuanji→/newdeepseek→ 401custom:xuanjiHERMES_INFERENCE_PROVIDERaloneCredit
Bug report, diagnosis, and initial fix: @Bartok9 in #16857 and #16873. This salvage PR reapplies the fix at the writeback site to avoid reverting #15755.
Closes #16857
Supersedes #16873