The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(kanban): lossy-decode BLOB cells in check_respawn_guard reads
KeyArgoe943a012379d
diff --git a/hermes_cli/kanban_db_dispatch.py b/hermes_cli/kanban_db_dispatch.pyindex 1bd402d613e..c8bf050e469 100644--- a/hermes_cli/kanban_db_dispatch.py+++ b/hermes_cli/kanban_db_dispatch.py@@ -1543,7 +1543,7 @@ def check_respawn_guard(return None# 2. Quota / auth blocker: retrying immediately will not help.- err = row["last_failure_error"]+ err = _kb._lossy_text(row["last_failure_error"])if err and _RESPAWN_BLOCKER_RE.search(err):return "blocker_auth"@@ -1587,7 +1587,7 @@ def check_respawn_guard("WHERE task_id = ? AND created_at >= ? ORDER BY created_at DESC",(task_id, pr_cutoff),).fetchall():- if not (c["body"] and _RESPAWN_GUARD_PR_URL_RE.search(c["body"])):+ if not (_kb._lossy_text(c["body"]) and _RESPAWN_GUARD_PR_URL_RE.search(_kb._lossy_text(c["body"]))):continueevents = conn.execute(# Strictly after: a same-second tie stays guarded (fail closed).diff --git a/tests/hermes_cli/test_kanban_list_undecodable_text.py b/tests/hermes_cli/test_kanban_list_undecodable_text.pyindex caeda16a14a..b3f6f7c629b 100644--- a/tests/hermes_cli/test_kanban_list_undecodable_text.py+++ b/tests/hermes_cli/test_kanban_list_undecodable_text.py@@ -13,12 +13,14 @@ from __future__ import annotationsimport dataclassesimport json+import sqlite3from pathlib import Pathimport pytestfrom hermes_cli import kanban_db as kbfrom hermes_cli import kanban_db_connect as kbc+from hermes_cli import kanban_db_dispatch as kbd@pytest.fixture@@ -72,3 +74,30 @@ def test_show_json_survives_blob_cells_in_sibling_tables(board):assert isinstance(comments[-1].body, str) and "\ufffd" in comments[-1].bodyevents = kb.list_events(conn, tid)json.dumps([dataclasses.asdict(c) for c in comments] + [dataclasses.asdict(e) for e in events])+++def test_respawn_guard_survives_blob_comment_body_and_failure_error(board):+ """A BLOB-typed ``task_comments.body`` or ``tasks.last_failure_error`` must not+ abort ``check_respawn_guard`` (issue #116473). Both raw reads previously handed+ ``bytes`` to a ``str`` regex, raising ``TypeError`` and killing the whole+ dispatch pass after the poisoned row."""+ with kbc.connect() as conn:+ tid = kb.create_task(conn, title="card", assignee="worker")+ kb.add_comment(conn, tid, author="worker", body="placeholder")+ with kb.write_txn(conn):+ conn.execute(+ "UPDATE task_comments SET body = ? WHERE task_id = ?",+ (sqlite3.Binary(b"no pr url here"), tid),+ )+ # BLOB comment body within the PR guard window: no PR URL, so no guard.+ assert kbd.check_respawn_guard(conn, tid) is None+ # The whole pass must not abort on the poisoned row.+ kbd.dispatch_once(conn, dry_run=True)++ with kb.write_txn(conn):+ conn.execute(+ "UPDATE tasks SET last_failure_error = ? WHERE id = ?",+ (sqlite3.Binary(b"429 quota exceeded"), tid),+ )+ # BLOB last_failure_error still matches the quota/auth blocker pattern.+ assert kbd.check_respawn_guard(conn, tid) == "blocker_auth"