The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(kanban): ignore auth words in crashed worker output
Jony3899401aa686
diff --git a/hermes_cli/kanban_db_dispatch.py b/hermes_cli/kanban_db_dispatch.pyindex 328e89c9d33..2fccacdff7b 100644--- a/hermes_cli/kanban_db_dispatch.py+++ b/hermes_cli/kanban_db_dispatch.py@@ -1548,9 +1548,13 @@ def check_respawn_guard(# (spaced by the cooldown) until quota returns or a real run supersedes it.return None- # 2. Quota / auth blocker: retrying immediately will not help.+ # 2. Quota / auth blocker: retrying immediately will not help. A plain+ # crash is different: its persisted error includes the worker's last+ # captured output, which is context rather than a diagnosis and may contain+ # benign commands such as ``claude auth status`` (#117097).err = _kb._lossy_text(row["last_failure_error"])- if err and _RESPAWN_BLOCKER_RE.search(err):+ latest_outcome = latest_run["outcome"] if latest_run is not None else None+ if err and latest_outcome != "crashed" and _RESPAWN_BLOCKER_RE.search(err):return "blocker_auth"# Review-lane spawns stop here: a recent completed run and a fresh PR URLdiff --git a/tests/hermes_cli/test_kanban_db.py b/tests/hermes_cli/test_kanban_db.pyindex f8edd2e39f3..4854e3d82e2 100644--- a/tests/hermes_cli/test_kanban_db.py+++ b/tests/hermes_cli/test_kanban_db.py@@ -519,6 +519,53 @@ def test_respawn_guard_blocker_auth_curated_not_open_stem(assert kbd.check_respawn_guard(conn, tid) == expected+def test_respawn_guard_ignores_auth_words_in_crashed_worker_output(kanban_home):+ """A plain crash's captured stdout is context, not a diagnosis.++ ``_classify_dead_worker`` appends the worker's last output to the persisted+ failure text. A benign command such as ``claude auth status`` must not turn+ an unrelated crash into a permanent auth guard on the next dispatch.+ """+ with kbc.connect() as conn:+ crashed_id = kb.create_task(conn, title="crashed", assignee="a")+ kb.claim_task(conn, crashed_id)+ crashed_run_id = kb.get_task(conn, crashed_id).current_run_id+ conn.execute(+ "UPDATE task_runs SET outcome='crashed', status='failed', ended_at=? "+ "WHERE id=?",+ (5_000_000, crashed_run_id),+ )+ conn.execute(+ "UPDATE tasks SET status='ready', current_run_id=NULL, "+ "claim_lock=NULL, claim_expires=NULL, worker_pid=NULL, "+ "last_failure_error=? WHERE id=?",+ (+ "pid 1 killed by signal 9. Worker's last output: "+ "'env -u ANTHROPIC_API_KEY claude auth status --text'",+ crashed_id,+ ),+ )++ spawn_failed_id = kb.create_task(conn, title="spawn failed", assignee="a")+ kb.claim_task(conn, spawn_failed_id)+ spawn_run_id = kb.get_task(conn, spawn_failed_id).current_run_id+ conn.execute(+ "UPDATE task_runs SET outcome='spawn_failed', status='failed', ended_at=? "+ "WHERE id=?",+ (5_000_000, spawn_run_id),+ )+ conn.execute(+ "UPDATE tasks SET status='ready', current_run_id=NULL, "+ "claim_lock=NULL, claim_expires=NULL, worker_pid=NULL, "+ "last_failure_error=? WHERE id=?",+ ("provider authentication failed", spawn_failed_id),+ )+ conn.commit()++ assert kbd.check_respawn_guard(conn, crashed_id) is None+ assert kbd.check_respawn_guard(conn, spawn_failed_id) == "blocker_auth"++def test_infrastructure_spawn_refusal_never_charges_the_card(kanban_home, monkeypatch, all_assignees_spawnable,):