A session-scoped /model switch pins the session to that model. The pin is
durable: the gateway persists it via SessionStore.set_model_override and
re-applies it on restart (_rehydrate_session_model_override); the TUI
persists session["model_override"] to the session DB row and restores it
on resume. Changing the global default (dashboard 'main model', config.yaml,
or /model --global) therefore never moves pinned sessions, and before this
change the only escape was /new — throwing away the conversation (NS-563:
'bot stuck on deepseek even after switching model and restarting').
/model reset clears the session pin and returns to the configured default
while keeping history:
- hermes_cli/model_switch.py: single-owner parser recognizes reset|default|
clear targets (MODEL_SWITCH_RESET_TOKENS), rejects flag combinations
(MODEL_SWITCH_ERR_RESET_WITH_FLAGS), and exposes is_model_reset_request()
so every surface shares one definition.
- gateway/slash_commands.py: _handle_model_reset clears the in-memory
override, the persisted DB override, and a queued one-turn restore;
evicts the cached agent so the next turn resolves fresh; reports the
now-active default. Listed in /model usage help.
- tui_gateway/server.py: _reset_session_model_override clears the pin +
one-turn restore, re-adopts the config default through the normal
switch path (never creating a fresh pin, never persisting), and
persists the cleared row so session.resume can't resurrect the pin.
- cli.py: _handle_model_reset_command re-derives the config.yaml default
(fresh read, not the startup snapshot) and switches back session-scoped;
clears a pending one-turn restore.
- locales/en.yaml: usage_reset/reset_done/reset_none strings.
Tests: parser-level reset detection, gateway handler behavior (clear +
persist + evict + no-op), TUI reset semantics (pin cleared, adopt-sync
rerun, no fresh pin, resume-safe persist), CLI reset (switch-back,
restore-queue cleared, no-op on default, never persists config).