Skip to content

The agent that grows with you

fix(state): held-store gate scans the store path cmd_sessions opened, not a retired resolver

teknium10c71dff115e9
diff --git a/hermes_cli/sessions_cmd.py b/hermes_cli/sessions_cmd.py
index 95516c51fa8..b136b96c8fa 100644
--- a/hermes_cli/sessions_cmd.py
+++ b/hermes_cli/sessions_cmd.py
@@ -1040,8 +1040,8 @@ def cmd_sessions(args, sessions_parser=None):
return
if action in _HELD_STORE_ACTIONS and not getattr(args, "dry_run", False) and not getattr(args, "force", False):
from hermes_state_holders import held_store_refusal
- # Same resolver the SessionDB above opened, so the scan never depends on the db object.
- refusal = held_store_refusal(_default_db_path(), command=action)
+ # Same path the SessionDB above opened, so the scan never depends on the db object.
+ refusal = held_store_refusal(path, command=action)
if refusal:
print(refusal)
return 1
diff --git a/tests/hermes_cli/test_resolve_last_session.py b/tests/hermes_cli/test_resolve_last_session.py
index 846b2b5b6c6..ee3e9477652 100644
--- a/tests/hermes_cli/test_resolve_last_session.py
+++ b/tests/hermes_cli/test_resolve_last_session.py
@@ -144,9 +144,7 @@ def test_resolve_last_session_cli_continues_a_oneshot(monkeypatch, tmp_path):
import hermes_state
from pathlib import Path
- state_db = Path(tmp_path / "state.db")
- real_db = hermes_state.SessionDB
- db = real_db(db_path=state_db)
+ db = hermes_state.SessionDB(db_path=Path(tmp_path / "state.db"))
try:
db.create_session("interactive", source="cli")
db.create_session("oneshot_run", source="oneshot")
@@ -159,6 +157,8 @@ def test_resolve_last_session_cli_continues_a_oneshot(monkeypatch, tmp_path):
db.close()
monkeypatch.setattr("hermes_cli.main._resolve_workspace_key", lambda: None)
- monkeypatch.setattr("hermes_state.SessionDB", lambda **kw: real_db(db_path=state_db, **kw))
+ # The lookup opens the active home's store by explicit path (a served-profile process has no
+ # single default home), so the home is the seam — same as the workspace test above.
+ monkeypatch.setattr("hermes_cli.main.get_hermes_home", lambda: tmp_path)
assert _resolve_last_session("cli") == "oneshot_run"
assert _resolve_last_session("tui") == "tui_chat"
diff --git a/tests/hermes_cli/test_sessions_held_store_gate.py b/tests/hermes_cli/test_sessions_held_store_gate.py
index 76762cd8d69..e8eeb42728e 100644
--- a/tests/hermes_cli/test_sessions_held_store_gate.py
+++ b/tests/hermes_cli/test_sessions_held_store_gate.py
@@ -29,11 +29,12 @@ _HOLDER = (
@pytest.fixture
def state_db(monkeypatch, tmp_path):
- import hermes_state
from hermes_state import SessionDB
db_path = tmp_path / "state.db"
- monkeypatch.setattr(hermes_state, "_default_db_path", lambda: db_path)
+ # cmd_sessions opens the ACTIVE home's store by explicit path (a served-profile process has
+ # no single default store), so the home is the seam, not hermes_state's default resolver.
+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))
seed = SessionDB(db_path=db_path)
seed.create_session("seed", "cli")
seed.append_message("seed", "user", "hello")