Skip to content

The agent that grows with you

fix: keep retained process lineage lookup read-only

Tekniumbf9cf5c217ff
diff --git a/tests/tools/test_completed_process_results.py b/tests/tools/test_completed_process_results.py
index 820eeb5086f..df7afc20cf4 100644
--- a/tests/tools/test_completed_process_results.py
+++ b/tests/tools/test_completed_process_results.py
@@ -13,6 +13,24 @@ import threading
REPO_ROOT = Path(__file__).resolve().parents[2]
+def test_retained_result_lookup_does_not_initialize_session_store(tmp_path, monkeypatch):
+ import hermes_state
+ from gateway.session_context import scoped_current_session_id
+ from tools import process_registry_results as receipts
+
+ db_path = tmp_path / "state.db"
+ monkeypatch.setattr(hermes_state, "DEFAULT_DB_PATH", db_path)
+ monkeypatch.setattr(receipts, "get_hermes_home", lambda: tmp_path)
+ directory = tmp_path / "logs" / "process-results"
+ directory.mkdir(parents=True)
+ (directory / "proc_owned.json").write_text(json.dumps({
+ "id": "proc_owned", "parent_session_id": "departed-owner",
+ }), encoding="utf-8")
+ with scoped_current_session_id("unrelated-reader"):
+ assert receipts.load_completed_results() == {}
+ assert not db_path.exists(), "Reading retained results initialized canonical storage"
+
+
def test_headless_terminal_result_survives_cli_exit(tmp_path):
"""Real CLI, tool dispatch, shell child and fresh reader; only the LLM is local."""
home = tmp_path / "profile"
diff --git a/tools/process_registry_results.py b/tools/process_registry_results.py
index 0c5724eda11..b42723892e1 100644
--- a/tools/process_registry_results.py
+++ b/tools/process_registry_results.py
@@ -72,7 +72,7 @@ def _owns_result(owner: str, parent: str | None) -> bool:
return True
from hermes_state import SessionDB
- db = SessionDB()
+ db = SessionDB(read_only=True)
try:
return db.get_compression_tip(parent) == owner
finally: