Skip to content

The agent that grows with you

test: two invariants per fix for the reclaim and tool-diagnostic suites

Teknium82c22c815c11
diff --git a/tests/hermes_cli/test_kanban_owner_receipt_reclaim.py b/tests/hermes_cli/test_kanban_owner_receipt_reclaim.py
index 05f168dbfa0..5af9921823a 100644
--- a/tests/hermes_cli/test_kanban_owner_receipt_reclaim.py
+++ b/tests/hermes_cli/test_kanban_owner_receipt_reclaim.py
@@ -153,21 +153,28 @@ def board(tmp_path, monkeypatch):
scratch.close()
-# --- the incident shape is reclaimed by the platform's own paths ---------------------------
+# --- the incident shape is named by diagnostics and reclaimed by the platform's own paths --
-def test_dead_attempt_behind_an_unresolved_receipt_is_reclaimed(board):
- """Every reclaim path declined this card; the stale-claim and crash paths must now take it."""
+def test_dead_attempt_behind_an_unresolved_receipt_is_named_and_reclaimed(board):
+ """Every reclaim path declined this card and no diagnostic could see it; both must now act."""
board.dead_attempt("t_ghost")
board.dead_attempt("t_ghost2")
+ board.dead_attempt("t_live", worker_pid=os.getpid(), worker_fingerprint=kbd._process_fingerprint(os.getpid()))
assert owner_reclaim_paused(board.conn, "t_ghost") is True # the pause still applies
assert bound_interpreter_gone(board.conn, "t_ghost") is False # nothing bound to read
assert owner_reclaim_blocked(board.conn, "t_ghost") is False
+ hits = [d for d in board.diagnostics("t_ghost") if d.kind == "stale_running"]
+ assert [d.severity for d in hits] == ["critical"] # 15x the 1h grace
+ assert [a.kind for a in hits[0].actions] == ["reclaim", "cli_hint"]
+ assert not [d for d in board.diagnostics("t_live") if d.kind == "stale_running"]
+
assert kb.release_stale_claims(board.conn) == 2
row = board.state("t_ghost")
assert (row["status"], row["claim_lock"], row["worker_pid"], row["current_run_id"]) == ("ready", None, None, None)
run = board.conn.execute("SELECT status, outcome FROM task_runs WHERE task_id = 't_ghost'").fetchone()
assert tuple(run) == ("reclaimed", "reclaimed")
+ assert board.state("t_live")["status"] == "running"
@pytest.mark.parametrize("shape", [
@@ -187,14 +194,3 @@ def test_the_pause_still_holds_every_attempt_that_may_be_alive(board, shape):
assert kb.release_stale_claims(board.conn) == 0
assert kbd.detect_crashed_workers(board.conn) == []
assert board.state("t_ghost")["status"] == "running"
-
-
-# --- the jam itself becomes visible to `kanban diagnostics` --------------------------------
-
-def test_stale_running_diagnostic_names_the_jam_and_stays_silent_for_a_live_worker(board):
- board.dead_attempt("t_ghost")
- board.dead_attempt("t_live", worker_pid=os.getpid(), worker_fingerprint=kbd._process_fingerprint(os.getpid()))
- hits = [d for d in board.diagnostics("t_ghost") if d.kind == "stale_running"]
- assert [d.severity for d in hits] == ["critical"] # 15x the 1h grace
- assert [a.kind for a in hits[0].actions] == ["reclaim", "cli_hint"]
- assert not [d for d in board.diagnostics("t_live") if d.kind == "stale_running"]
diff --git a/tests/tools/test_not_deferrable_session_scope.py b/tests/tools/test_not_deferrable_session_scope.py
deleted file mode 100644
index d2f1616d66b..00000000000
--- a/tests/tools/test_not_deferrable_session_scope.py
+++ /dev/null
@@ -1,28 +0,0 @@
-"""A core tool stripped from this session's toolset must not be told to 'call it directly'.
-
-`_HERMES_CORE_TOOLS` is static, so `not_deferrable_error` matched any core tool by name —
-including `clarify` inside a subagent, where it is toolset-blocked and no direct call can
-ever succeed. The static list cannot distinguish "callable, wrong door" from "not here at all",
-so the model was sent into a retry loop on a confident false instruction.
-
-Regression test for that: the fix is only proven if it goes RED when reverted.
-"""
-
-from tools.tool_search_validation import not_deferrable_error
-
-
-class TestNotDeferrableSessionScope:
- def test_core_tool_absent_from_session_reports_unavailable(self):
- """The subagent case: clarify is core but blocked here."""
- msg = not_deferrable_error("clarify", session_tool_names={"read_file", "terminal"})
- assert "not available in this execution context" in msg
- assert "directly-listed" not in msg, (
- "must not tell the model to call a tool this session cannot reach"
- )
- assert "retry" in msg.lower(), "should tell the model not to retry"
-
- def test_core_tool_present_in_session_keeps_door_guidance(self):
- """Top-level case unchanged: clarify IS callable directly here."""
- msg = not_deferrable_error("clarify", session_tool_names={"clarify", "read_file"})
- assert "directly-listed" in msg
- assert "Call it directly" in msg