Merge pull request #13622 from NousResearch/bb/tui-model-switch-sticks

fix(model-switch): /model --provider X sticks instead of silently falling back
This commit is contained in:
brooklyn!
2026-04-21 16:34:19 -05:00
committed by GitHub
4 changed files with 158 additions and 0 deletions

View File

@@ -538,6 +538,12 @@ def _apply_model_switch(sid: str, session: dict, raw_input: str) -> dict:
_emit("session.info", sid, _session_info(agent))
os.environ["HERMES_MODEL"] = result.new_model
# Keep the process-level provider env var in sync with the user's explicit
# choice so any ambient re-resolution (credential pool refresh, compressor
# rebuild, aux clients) resolves to the new provider instead of the
# original one persisted in config or env.
if result.target_provider:
os.environ["HERMES_INFERENCE_PROVIDER"] = result.target_provider
if persist_global:
_persist_model_switch(result)
return {"value": result.new_model, "warning": result.warning_message or ""}