The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(console): accept the --force override the held-store refusal advertises
teknium1f88ba2ea807f
diff --git a/hermes_cli/console_engine.py b/hermes_cli/console_engine.pyindex 58ca3248e57..866876d70fb 100644--- a/hermes_cli/console_engine.py+++ b/hermes_cli/console_engine.py@@ -706,10 +706,13 @@ def _sessions_rename(_engine: HermesConsoleEngine, args: list[str]) -> None:@_captureddef _sessions_optimize(_engine: HermesConsoleEngine, args: list[str]) -> None:- _expect_no_args(args, "sessions optimize")+ # --force is parsed HERE: the refusal below points at it, and a hint the surface cannot+ # accept would make this command refuse forever whenever a gateway is running.+ ns = _parse("sessions optimize", args, (("--force",), dict(action="store_true")))with _session_db(read_only=False) as db:from hermes_state_holders import held_store_refusal- refusal = held_store_refusal(db.db_path, command="optimize", force_hint="`hermes sessions optimize --force`")+ refusal = None if ns.force else held_store_refusal(+ db.db_path, command="optimize", force_hint="`sessions optimize --force`")if refusal:raise ConsoleCommandError(refusal)print(f"Optimized {db.vacuum()} FTS index(es).")@@ -824,7 +827,7 @@ _BUILTIN_COMMANDS = ("Export sessions to JSONL.", _sessions_export, "Export session data?"),(("sessions", "rename"), "sessions rename <session> <title>", "Rename a session.",_sessions_rename, "Rename this session?"),- (("sessions", "optimize"), "sessions optimize", "Optimize the session store.",+ (("sessions", "optimize"), "sessions optimize [--force]", "Optimize the session store.",_sessions_optimize, "Optimize the session database?"),(("sessions", "repair"), "sessions repair [--check-only] [--no-backup]","Repair a malformed session database schema.", _sessions_repair,diff --git a/tests/hermes_cli/test_console_engine.py b/tests/hermes_cli/test_console_engine.pyindex a50546f8f50..f33210b8ea8 100644--- a/tests/hermes_cli/test_console_engine.py+++ b/tests/hermes_cli/test_console_engine.py@@ -241,6 +241,15 @@ MUTATING_CONFIRMATION_SMOKE_COMMANDS = [+def test_sessions_optimize_accepts_the_force_override_it_advertises(_isolate_hermes_home):+ """The held-store refusal this command prints points at `sessions optimize --force`; if the+ console rejected the flag, the command could only ever refuse whenever a gateway is running."""+ result = HermesConsoleEngine().execute("sessions optimize --force", confirmed=True)++ assert result.status == "ok", result.output+ assert "Usage:" not in result.output++def test_sessions_list_and_stats_use_isolated_session_store(_isolate_hermes_home):from hermes_state import SessionDB