The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(verify): share only a full passing hermes verify across sessions
686f6c617bc350cfbb6e
diff --git a/agent/verification_evidence.py b/agent/verification_evidence.pyindex 49c7154a3e5..3cbdef7ebfc 100644--- a/agent/verification_evidence.py+++ b/agent/verification_evidence.py@@ -511,10 +511,9 @@ def _insert_evidence(evidence: VerificationEvidence) -> dict[str, Any]:" changed_paths_json = '[]'",(e.session_id, e.root, event_id),)- # ``hermes verify`` proves the workspace, not a session. Share the- # pointer with every session that already has a row for this root so- # a CLI run under ``default`` can clear an editing session's stale flag.- if e.kind == "verify":+ # A full passing ``hermes verify`` proves the workspace. Partial or+ # failed runs must not wipe another session's edit record (#103650).+ if e.kind == "verify" and e.status == "passed" and e.scope == "full":conn.execute("UPDATE verification_state"" SET last_event_id = ?, last_edit_at = NULL, changed_paths_json = '[]'"@@ -567,17 +566,18 @@ def mark_workspace_edited(def _newest_workspace_verify(conn: sqlite3.Connection, *, root: str, since: str | None) -> Optional[sqlite3.Row]:- """Latest ``hermes verify`` event for ``root``, optionally not older than ``since``."""+ """Latest full passing ``hermes verify`` for ``root``, optionally not older than ``since``."""if since:return conn.execute("SELECT * FROM verification_events"- " WHERE root = ? AND kind = 'verify' AND created_at >= ?"+ " WHERE root = ? AND kind = 'verify' AND status = 'passed' AND scope = 'full'"+ " AND created_at >= ?"" ORDER BY id DESC LIMIT 1",(root, since),).fetchone()return conn.execute("SELECT * FROM verification_events"- " WHERE root = ? AND kind = 'verify'"+ " WHERE root = ? AND kind = 'verify' AND status = 'passed' AND scope = 'full'"" ORDER BY id DESC LIMIT 1",(root,),).fetchone()diff --git a/tests/agent/test_verification_evidence.py b/tests/agent/test_verification_evidence.pyindex bceaaa2d4ff..3401e913f46 100644--- a/tests/agent/test_verification_evidence.py+++ b/tests/agent/test_verification_evidence.py@@ -363,6 +363,35 @@ def test_workspace_verify_clears_stale_on_other_session(tmp_path, monkeypatch):assert status["evidence"]["canonical_command"] == "hermes verify"+def test_targeted_partial_verify_does_not_clear_other_session(tmp_path, monkeypatch):+ monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))+ _python_project(tmp_path)+ record_verify_run(root=tmp_path, session_id="s-edit", ok=True)+ mark_workspace_edited(session_id="s-edit", cwd=tmp_path, paths=[str(tmp_path / "a.py")])+ assert verification_status(session_id="s-edit", cwd=tmp_path)["status"] == "stale"++ record_verify_run(root=tmp_path, session_id=None, ok=True, scope="targeted")++ status = verification_status(session_id="s-edit", cwd=tmp_path)+ assert status["status"] == "stale"+++def test_failed_verify_does_not_erase_other_session_edit_record(tmp_path, monkeypatch):+ home = tmp_path / ".hermes"+ monkeypatch.setenv("HERMES_HOME", str(home))+ _python_project(tmp_path)+ mark_workspace_edited(session_id="s-edit", cwd=tmp_path, paths=[str(tmp_path / "a.py")])++ record_verify_run(root=tmp_path, session_id=None, ok=False)++ row = sqlite3.connect(home / "verification_evidence.db").execute(+ "SELECT last_edit_at, changed_paths_json FROM verification_state WHERE session_id='s-edit'"+ ).fetchone()+ assert row is not None+ assert row[0] is not None+ assert verification_status(session_id="s-edit", cwd=tmp_path)["status"] != "passed"++def test_older_workspace_verify_does_not_clear_later_edit(tmp_path, monkeypatch):monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))_python_project(tmp_path)