hermes-agent/tests/tui_gateway
Shannon Sands f94425e586
feat: /model reset — clear a session's model pin without losing history (NS-563)
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).
2026-08-06 09:11:21 -07:00
..
__init__.py
…
test_auto_continue.py
…
test_billing_rpc.py
…
test_change_watcher.py
…
test_codex_app_server_live_events.py
…
test_cold_start_gil_stall.py
…
test_compaction_status.py
…
test_compress_lock_skip.py
…
test_compute_host.py
…
test_compute_host_phase1.py
…
test_custom_provider_session_persistence.py
…
test_delegation_session_lifecycle.py
…
test_entry_import_off_main_thread.py
…
test_entry_picker_prewarm.py test(tui): pin picker-cache prewarm wiring in entry.main() 2026-08-04 12:28:05 +05:30
test_entry_sys_path.py
…
test_failed_turn_retention.py
…
test_fast_session_scope.py
…
test_finalize_session_persist.py
…
test_gateway_owned_session_reap.py
…
test_goal_command.py
…
test_image_routing_stale_model.py
…
test_inline_rpc_gil_starvation.py
…
test_interim_assistant_callback.py
…
test_iso_certify_seam.py
…
test_kanban_notify_poller.py
…
test_make_agent_provider.py
…
test_mcp_late_refresh_thread_owner.py
…
test_mcp_reload_rev.py
…
test_moa_reference_emit.py
…
test_model_reset.py feat: /model reset — clear a session's model pin without losing history (NS-563) 2026-08-06 09:11:21 -07:00
test_model_switch_marker_role.py
…
test_pet_generate_rpc.py
…
test_project_tree.py
…
test_projects_rpc.py
…
test_protocol.py
…
test_reasoning_config_per_model.py
…
test_reasoning_session_scope.py
…
test_render.py
…
test_review_summary_callback.py
…
test_session_cwd_follow.py
…
test_session_id_injection.py
…
test_session_images_dir.py
…
test_session_platform_resolution.py
…
test_session_reclaim_notify.py
…
test_slash_worker_ansi.py
…
test_slash_worker_mcp_discovery.py
…
test_slash_worker_profile_home.py
…
test_slash_worker_sys_path.py
…
test_subagent_child_mirror.py
…
test_subprocess_encoding.py
…
test_undo_command.py
…
test_wait_for_mcp_discovery.py
…