Skip to content

The agent that grows with you

fix(kanban): curate the respawn guard's auth pattern instead of an open auth\w* stem

chelsealong6a52c9e41d10
diff --git a/hermes_cli/kanban_db_dispatch.py b/hermes_cli/kanban_db_dispatch.py
index b1580608e45..34045d896d1 100644
--- a/hermes_cli/kanban_db_dispatch.py
+++ b/hermes_cli/kanban_db_dispatch.py
@@ -56,8 +56,13 @@ TERMINAL_WORKER_REAP_GRACE_SECONDS = 120
# Patterns in last_failure_error that indicate a quota / auth blocker.
# These errors won't resolve by retrying immediately — auto-block instead.
+# The auth family is a curated list, not an open `auth\w*` stem: that stem
+# also matched ordinary English words like "author"/"authored"/"authoring"/
+# "authoritative" in worker progress prose, parking a healthy card forever
+# (#117009).
_RESPAWN_BLOCKER_RE = re.compile(
- r"\b(quota|rate[\s_\-]?limit|429|403|auth\w*|"
+ r"\b(quota|rate[\s_\-]?limit|429|403|"
+ r"auth|authenticat(?:e|ed|ion)|authoriz(?:e|ed|ation)|authz|"
r"unauthorized|forbidden|billing|subscription|"
r"access[\s_]denied|permission[\s_]denied|"
r"invalid[\s_]api[\s_]key)\b",
diff --git a/tests/hermes_cli/test_kanban_db.py b/tests/hermes_cli/test_kanban_db.py
index f344984dbea..f6268c317bc 100644
--- a/tests/hermes_cli/test_kanban_db.py
+++ b/tests/hermes_cli/test_kanban_db.py
@@ -472,6 +472,46 @@ def test_respawn_guard_defers_rate_limited_within_cooldown(
assert kbd.check_respawn_guard(conn, tid) is None
+ "error_text, expected",
+ [
+ # Worker progress prose talking about *writing*, not an auth failure
+ # (#117009): must NOT trip the guard.
+ ("Workstream C items C-3 and C-4: author t (90.59s)", None),
+ ("docs authored by the previous cycle", None),
+ ("still authoring the migration plan", None),
+ ("relying on an authoritative source", None),
+ ("two authors reviewed the diff", None),
+ # Genuine auth failures must still trip the guard.
+ ("401 auth failed", "blocker_auth"),
+ ("token authenticated but scope missing", "blocker_auth"),
+ ("authentication error from provider", "blocker_auth"),
+ ("authorize the app first", "blocker_auth"),
+ ("authorized client rejected", "blocker_auth"),
+ ("authorization header missing", "blocker_auth"),
+ ("authz denied", "blocker_auth"),
+ ("unauthorized: bad credentials", "blocker_auth"),
+ ],
+)
+def test_respawn_guard_blocker_auth_curated_not_open_stem(
+ kanban_home, monkeypatch, error_text, expected,
+):
+ """``_RESPAWN_BLOCKER_RE`` used to use an open ``auth\\w*`` stem that matched
+ ordinary English words like "author"/"authored"/"authoring"/"authoritative"
+ in worker progress prose, parking a healthy ``ready`` card forever (#117009).
+ The auth family must be a curated set of real auth-failure tokens."""
+ monkeypatch.setenv("HERMES_KANBAN_RATE_LIMIT_COOLDOWN_SECONDS", "0")
+
+ with kbc.connect() as conn:
+ tid = kb.create_task(conn, title="prose", assignee="a")
+ conn.execute(
+ "UPDATE tasks SET last_failure_error=? WHERE id=?",
+ (error_text, tid),
+ )
+ conn.commit()
+ assert kbd.check_respawn_guard(conn, tid) == expected
+
+
def test_infrastructure_spawn_refusal_never_charges_the_card(
kanban_home, monkeypatch, all_assignees_spawnable,
):