The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cron): an unreadable deferred Bot Chat receipt no longer blocks its siblings
teknium17c46ee698eea
diff --git a/cron/bot_chat_delivery.py b/cron/bot_chat_delivery.pyindex 5d38f96f24d..15f692c666e 100644--- a/cron/bot_chat_delivery.py+++ b/cron/bot_chat_delivery.py@@ -36,8 +36,9 @@ def _records(root: Path) -> list[tuple[Path, dict]]:for path in root.glob("*.json"):try:record = json.loads(path.read_text(encoding="utf-8"))- except (json.JSONDecodeError, UnicodeDecodeError) as exc:- # Keep damaged receipts as evidence; never replay them or block peers.+ except (OSError, json.JSONDecodeError, UnicodeDecodeError) as exc:+ # Keep damaged or unreadable receipts as evidence; never replay them or block peers+ # (same rule as tools/bot_live_delivery.py::_scan_read — one bad file must not wedge the dir).logger.error("Unreadable deferred Bot Chat receipt %s: %s", path, exc)continuerecords.append((path, record))diff --git a/tests/cron/test_bot_chat_pending.py b/tests/cron/test_bot_chat_pending.pyindex 8aa2096d6ef..a1801135fb4 100644--- a/tests/cron/test_bot_chat_pending.py+++ b/tests/cron/test_bot_chat_pending.py@@ -104,3 +104,22 @@ def test_pending_queue_uses_admission_order_and_keeps_claims(tmp_path, monkeypatqueue.drain()queue.drain()assert seen == ["older", "newer"]++[email protected](not hasattr(__import__("os"), "geteuid") or __import__("os").geteuid() == 0,+ reason="needs POSIX file permissions for an unreadable receipt")+def test_unreadable_deferred_receipt_does_not_block_siblings(tmp_path, monkeypatch, caplog):+ """One permission-denied receipt beside healthy queued work must degrade to a logged skip,+ not abort the drain (same class as the live-owner mailbox wedge, #109820)."""+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))+ queue.defer("a" * 64, {"id": "job"}, "healthy", "", tmp_path)+ bad = queue._root() / f"{'e' * 64}.json"+ bad.write_text('{"status": "queued"}', encoding="utf-8")+ bad.chmod(0)+ seen = []+ monkeypatch.setattr(delivery, "_deliver_to_bot_chat", lambda j, c, p, **kw: seen.append(c))+ with caplog.at_level("ERROR", logger=queue.logger.name):+ queue.drain()+ assert seen == ["healthy"]+ assert any("Unreadable deferred Bot Chat receipt" in r.message and "Permission denied" in r.message+ for r in caplog.records)