hermes-agent/hermes_cli
kshitij cdd0a26031 fix: restore session model on resume instead of falling back to config default
Two bugs caused resumed sessions to use the config default model instead
of the model the session was actually using:

1. CLI /model switch didn't persist the new model to the session DB row.
   The gateway calls update_session_model() after a /model switch, but
   the CLI path only updated in-memory state and the agent's runtime —
   it never wrote the new model to the sessions.model column. So the DB
   row always kept the original model from session creation.

2. Resume didn't restore model/provider from the session DB row.
   _preload_resumed_session and _init_agent restored CWD and YOLO from
   session_meta, but never read session_meta['model'] back into
   self.model/self.provider. So even if the DB had the right model,
   resume would use whatever was in config.yaml.

Fix:
- _handle_model_switch / _apply_model_switch_result: call
  update_session_model() after a session-scoped /model switch (skipped
  for --once and --global), mirroring the gateway's behavior.
- New _restore_session_model() method: restores model/provider from
  session_meta on resume, with provider/base_url/api_mode from
  model_config.gateway_runtime. Also swaps the running agent in-place
  for mid-chat /resume.
- Call _restore_session_model() from all three resume paths:
  _preload_resumed_session, _init_agent, and _handle_resume_command.
- Track _explicit_model_override flag so -m/--model on the CLI overrides
  resume (user intent wins). Cleared on /new.
2026-08-14 02:15:22 +05:30
..
dashboard_auth fix(plugins): isolate ownership by profile 2026-08-12 19:13:32 -07:00
data feat(plugins): community plugin index + hermes plugins search (#64181) 2026-08-12 18:52:08 -07:00
observability Merge updated client resource metrics into active-install metrics 2026-08-04 15:10:41 -07:00
proxy
…
subcommands feat(plugins): plugin packs — declarative, shareable plugin sets (#64166) 2026-08-12 19:56:44 -07:00
web_routers feat(computer-use): provision cua-driver at install time and on toolset enable 2026-08-13 02:44:48 -07:00
__init__.py chore: release v0.20.1 (2026.8.13) 2026-08-13 11:52:47 -07:00
_early_recovery.py
…
_parser.py feat: --resume latest keyword and --in DIR launch flag 2026-08-08 04:03:41 -07:00
_scan_venv_blockers.py fix(update): don't truncate cmdlines in the venv-blocker scan — it broke the gateway exemption 2026-08-08 18:58:06 -07:00
_startup_fast.py refactor: single chokepoint for the pre-import version fast path 2026-08-02 21:13:12 +05:30
_subprocess_compat.py fix(hooks): kill the whole process tree when a shell hook times out 2026-08-12 19:44:04 -07:00
active_sessions.py
…
agent_import.py refactor(cli): review follow-ups for the config.yaml import guard 2026-08-02 14:55:32 +05:30
agent_plugins.py feat(plugins): map portable Agent Plugins streamable-http entries into the native MCP runtime 2026-08-08 23:56:46 -07:00
approval_mode.py
…
approval_transport.py fix(plugins): harden approval transport boundaries 2026-08-12 16:26:55 -07:00
approvals_suggest.py feat(cli): add `hermes approvals test` — dry-run approval verdict CLI 2026-08-07 08:57:39 -07:00
approvals_test.py feat(cli): add `hermes approvals test` — dry-run approval verdict CLI 2026-08-07 08:57:39 -07:00
auth.py fix(auth): tolerate legacy Codex suppression data 2026-08-12 23:47:38 -07:00
auth_commands.py
…
azure_detect.py
…
backup.py feat: auto-install gateway service during setup and import 2026-08-12 16:59:37 -07:00
bang_shell.py feat(cli): ! shell mode — run a command without spending a model turn 2026-07-31 21:21:20 -07:00
banner.py perf(cli): sub-400ms warm startup — probe-mode check_fns, lazy MCP SDK, banner snapshot, parallel worktree add 2026-08-10 10:40:19 -07:00
blueprint_cmd.py refactor(cron): polish registration partial-failure surfaces 2026-08-07 17:45:06 +05:30
browser_connect.py
…
build_info.py
…
bundles.py
…
callbacks.py fix(approval): classify CLI/TUI approval timeouts separately from explicit denials 2026-08-02 20:21:59 -07:00
checkpoints.py refactor: fold simplify findings — 6th copy in update_cmd, drop dead wrapper + speculative kwarg, behavior-contract tests 2026-08-08 15:10:35 +05:30
claw.py
…
cli_agent_setup_mixin.py fix: restore session model on resume instead of falling back to config default 2026-08-14 02:15:22 +05:30
cli_billing_mixin.py
…
cli_commands_mixin.py fix: restore session model on resume instead of falling back to config default 2026-08-14 02:15:22 +05:30
cli_output.py
…
clipboard.py
…
codex_models.py
…
codex_runtime_plugin_migration.py
…
codex_runtime_switch.py
…
colors.py
…
commands.py Revert "Inspired by Perplexity Computer: Model Council mode for Mixture of Agents" 2026-08-12 21:50:35 -07:00
completion.py
…
config.py fix: follow-up polish for salvaged PR #85512 2026-08-14 00:59:38 +05:30
config_defaults.py fix(models): one canonical override schema, fill-gap _default semantics 2026-08-14 02:03:54 +05:30
config_migrations.py fix(personality): single-owner personality state + one-time reset migration 2026-08-09 10:33:58 -07:00
console_engine.py fix: Windows agent-loop papercuts — path splitting, hashing, autocomplete, screenshots, OS detection (#84419) 2026-08-12 01:45:18 -07:00
container_boot.py fix(install): support non-pid-1 container entrypoints 2026-08-01 10:52:34 -07:00
context_switch_guard.py
…
copilot_auth.py test: harden cold-start regression tests + debug-log the env-var skip 2026-08-03 21:16:09 +05:30
credential_lifecycle.py
…
cron.py fix(cron): make pause authoritative against half-paused records 2026-08-08 13:48:00 +05:30
curator.py
…
curses_ui.py cleanup: remove references to simple-term-menu 2026-08-10 15:13:29 -04:00
dashboard_procs.py fix: use psutil.pid_exists for orphan-reap liveness probe (Windows footgun lint) 2026-08-10 17:02:56 -07:00
dashboard_register.py
…
debug.py fix(debug): say where a client-side log lives instead of "(file not found)" (#78687) 2026-08-04 11:53:32 -06:00
default_soul.py
…
dep_ensure.py fix(cli): teach doctor --live and dep_ensure the npx agent-browser cascade 2026-08-13 02:38:28 -07:00
diagnostics_upload.py
…
dingtalk_auth.py
…
doctor.py fix(browser): pin npx agent-browser resolution and share a sentinel constant 2026-08-13 02:38:28 -07:00
doctor_live.py fix(cli): apply Termux carve-out to doctor --live's npx browser probe 2026-08-13 02:38:28 -07:00
dump.py feat(gateway): session activity watchdog, stall notify, compress timeout (#72424) 2026-08-02 16:16:36 -07:00
env_loader.py fix(plugins): isolate ownership by profile 2026-08-12 19:13:32 -07:00
fallback_cmd.py
…
fallback_config.py fix(auth): resolve fallback api keys through secret_scope, not raw env 2026-07-31 22:35:26 -07:00
focus_view.py
…
gateway.py feat: auto-install gateway service during setup and import 2026-08-12 16:59:37 -07:00
gateway_enroll.py
…
gateway_windows.py
…
goals.py fix: complete kanban review lifecycle 2026-08-10 12:43:46 -07:00
gui_uninstall.py feat(desktop): register a Linux launcher entry for `hermes desktop` 2026-08-05 11:47:05 -04:00
heartbeat.py feat: /heartbeat — recurring session re-entry prompt fired when idle 2026-08-05 22:32:55 -07:00
hooks.py feat(langfuse): widen tracing to errors, sessions, subagents, and MoA fan-out 2026-08-13 23:10:16 +05:30
init_command.py
…
input_sanitize.py
…
inventory.py
…
journey.py
…
kanban.py feat(kanban): explicit notify/wake delivery modes with faithful wake session routing 2026-08-13 10:47:40 -07:00
kanban_db.py feat(kanban): GC stale done-task notify subscriptions 2026-08-13 12:21:04 -07:00
kanban_decompose.py
…
kanban_diagnostics.py fix: complete kanban review lifecycle 2026-08-10 12:43:46 -07:00
kanban_specify.py
…
kanban_swarm.py fix(kanban): make write_txn nesting explicit opt-in 2026-08-10 12:43:46 -07:00
lifecycle.py
…
linux_desktop_entry.py feat(desktop): register a Linux launcher entry for `hermes desktop` 2026-08-05 11:47:05 -04:00
logs.py
…
main.py fix(cli): align _build_web_ui's npm closure with hermes update's (ui-tui + web + --include-workspace-root) 2026-08-13 02:38:28 -07:00
managed_scope.py
…
managed_uv.py fix(update): survive a hermes_constants cached from before the update 2026-08-01 23:06:47 -05:00
mcp_catalog.py fix(catalog): validate http+api_key manifests declare the header's env key 2026-08-03 22:55:36 +05:30
mcp_config.py
…
mcp_picker.py
…
mcp_security.py
…
mcp_startup.py fix(review): harden portable plugin boundaries 2026-08-07 09:44:21 -07:00
mem_trim.py fix(mem): 5s force floor so delegate-batch closes don't stack trims 2026-08-02 22:44:38 +05:30
memory_oauth.py
…
memory_setup.py feat(hindsight): memory provider improvements — recall_sync, retain_source, setup templates, memory indicators, error hints 2026-08-13 23:15:25 +05:30
middleware.py
…
migrate.py
…
moa_cmd.py Revert "Inspired by Perplexity Computer: Model Council mode for Mixture of Agents" 2026-08-12 21:50:35 -07:00
moa_config.py Revert "Inspired by Perplexity Computer: Model Council mode for Mixture of Agents" 2026-08-12 21:50:35 -07:00
model_catalog.py perf(model-picker): serve stale model caches instantly, refresh in background 2026-08-01 14:52:18 -07:00
model_cost_guard.py
…
model_normalize.py fix(models): a model id missing its vendor prefix says so instead of 404ing (#78856) 2026-08-04 19:35:57 +00:00
model_search.py
…
model_setup_flows.py fix(model-picker): serve cached custom-provider catalog on no-probe opens (supersedes #81665, #81556) (#81973) 2026-08-08 16:07:03 -04:00
model_switch.py fix(model-switch): route switch_model user-provider key reads through the secret scope 2026-08-08 19:17:05 -07:00
models.py feat(models): add google/gemini-3.7-flash to nous + openrouter catalogs, drop gemini-3.6-flash 2026-08-13 11:28:16 -07:00
nous_account.py fix: show explicit member spend cap message instead of 'no credits' 2026-08-07 19:47:40 +05:30
nous_auth_keepalive.py
…
nous_billing.py
…
nous_subscription.py fix(cli): restore managed-node-path and PATHEXT-aware fallback rungs 2026-08-13 02:38:28 -07:00
npm_engine.py Merge branch 'main' into ethie/bundled-node-path-windows-layout 2026-08-01 21:27:26 -05:00
onepassword_secrets_cli.py
…
oneshot.py fix(cli): scrub lone surrogates before oneshot stdout write 2026-08-08 12:31:19 -07:00
pairing.py
…
partial_compress.py
…
personality.py fix(personality): single-owner personality state + one-time reset migration 2026-08-09 10:33:58 -07:00
pets.py
…
platform_actions.py feat(plugins): capability-gated ctx.platform_actions facade (#64176) 2026-08-12 20:10:51 -07:00
platforms.py
…
plugin_capabilities.py feat(plugins): capability-gated ctx.platform_actions facade (#64176) 2026-08-12 20:10:51 -07:00
plugin_dev.py feat(plugins): manifest v2 — schema version, api_version, inter-plugin deps, pip-dependency declaration seam, config schema (#64165) 2026-08-12 18:39:22 -07:00
plugin_index.py feat(plugins): community plugin index + hermes plugins search (#64181) 2026-08-12 18:52:08 -07:00
plugin_packs.py feat(plugins): plugin packs — declarative, shareable plugin sets (#64166) 2026-08-12 19:56:44 -07:00
plugins.py fix(plugins): discover entrypoint capabilities 2026-08-13 13:38:58 -07:00
plugins_cmd.py fix(plugins): report entrypoint capabilities in CLI 2026-08-13 13:38:58 -07:00
portal_cli.py
…
profile_describer.py
…
profile_distribution.py refactor(utils): move mode+owner preservation into atomic_write_text 2026-08-06 05:00:17 +05:30
profiles.py feat(gateway): allow selective multiplex profile serving 2026-08-10 22:48:24 -07:00
projects_cmd.py
…
projects_db.py
…
prompt_size.py fix(prompt_size): search volatile tier for skills block after the stable->volatile move 2026-08-03 23:23:39 +05:30
prompt_stash.py feat(cli): complete the Ctrl+S prompt stash — keybinding, state machine, tests 2026-07-31 21:21:16 -07:00
provider_catalog.py
…
providers.py feat: rename Codex OAuth provider label to "ChatGPT or Codex Subscription" 2026-08-13 03:06:08 -07:00
proxy_cli.py
…
psutil_android.py
…
pt_input_extras.py
…
pty_bridge.py
…
pty_session.py
…
relaunch.py
…
resource_limits.py fix(gateway): persist RLIMIT_NOFILE floor into the generated launchd plist 2026-08-10 17:02:56 -07:00
route_identity.py
…
runtime_provider.py fix: adapt Actual provider salvage to current main 2026-08-05 14:08:32 -07:00
secret_prompt.py
…
secrets_cli.py
…
security_advisories.py
…
security_audit.py fix(security): cache OSV malware preflight verdicts and stop double component discovery (#75485) 2026-08-01 10:47:20 -07:00
security_audit_startup.py
…
send_cmd.py fix(cli): apply BOM-safe .env decoding to hermes send's private loader 2026-08-08 12:32:23 -07:00
service_manager.py
…
session_export.py
…
session_export_html.py
…
session_export_md.py
…
session_filters.py
…
session_listing.py fix(gateway): scope session lists before limiting 2026-07-31 22:36:55 -07:00
session_lost_and_found.py fix(sessions): probe sqlite3 CLI for .recover capability, not just PATH presence 2026-08-12 19:43:47 -07:00
session_recap.py
…
session_recovery.py fix(sessions): recover budget exhaustion + lost_and_found last-resort lane 2026-08-12 19:43:47 -07:00
sessions_cmd.py fix(sessions): recover budget exhaustion + lost_and_found last-resort lane 2026-08-12 19:43:47 -07:00
setup.py feat: auto-install gateway service during setup and import 2026-08-12 16:59:37 -07:00
setup_hidden_env.py
…
setup_whatsapp_cloud.py
…
sizefmt.py refactor: fold simplify findings — 6th copy in update_cmd, drop dead wrapper + speculative kwarg, behavior-contract tests 2026-08-08 15:10:35 +05:30
skills_config.py
…
skills_hub.py refactor: share category detection and prune vendored SKILL.md hits 2026-08-02 13:31:16 +05:30
skin_cmd.py refactor: trim verbose comments + drop redundant default_flow_style kwarg 2026-08-05 11:59:33 +05:30
skin_engine.py
…
slack_cli.py
…
slash_exec.py
…
sqlite_runtime.py
…
sqlite_safe_read.py fix(cli): untrack sqlite connections only after close succeeds 2026-07-31 23:18:12 -07:00
sqlite_util.py
…
status.py feat(cli): global emergency stop — `hermes pause` / `hermes resume` 2026-08-07 08:58:14 -07:00
stdio.py
…
suggestions_cmd.py refactor(cron): polish registration partial-failure surfaces 2026-08-07 17:45:06 +05:30
telegram_managed_bot.py
…
timefmt.py chore: round-2 review nits (re-review #9) 2026-08-02 16:16:36 -07:00
timeouts.py
…
tips.py fix(gateway): defer in-band restart until active turns finish (#77184) 2026-08-03 09:57:58 +05:30
tools_config.py fix(browser): harden npx agent-browser resolution 2026-08-13 02:38:28 -07:00
toolset_validation.py
…
uninstall.py refactor(utils): move mode+owner preservation into atomic_write_text 2026-08-06 05:00:17 +05:30
update_cmd.py fix(update): repair failed Node deps on an already-current checkout (#85539) 2026-08-13 18:42:42 +00:00
update_lock.py fix(update): make the ancestor-PID lock handoff cross-platform via psutil 2026-07-31 22:28:46 -07:00
urllib_security.py
…
vercel_auth.py
…
verify_cmd.py Integrate verify subsystem with the existing verification stack 2026-08-07 10:11:05 -07:00
voice.py fix(tts): split long speech by provider and platform limits 2026-08-08 22:54:20 +05:30
web_deps.py
…
web_git.py feat(desktop): resolve a session's pull request 2026-08-09 06:21:04 -05:00
web_models.py feat(desktop): resolve a session's pull request 2026-08-09 06:21:04 -05:00
web_server.py feat: rename Codex OAuth provider label to "ChatGPT or Codex Subscription" 2026-08-13 03:06:08 -07:00
webhook.py
…
win_pty_bridge.py
…
windows_ssh_runtime.py fix(desktop): keep Windows SSH runtime at machine root 2026-08-01 14:30:16 -07:00
write_approval_commands.py
…
xai_retirement.py refactor(utils): move mode+owner preservation into atomic_write_text 2026-08-06 05:00:17 +05:30