The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(gateway): prove expired Bot receipts are answered, not skipped
David Dudok de Wit2010db907b97
diff --git a/gateway/session_bot.py b/gateway/session_bot.pyindex c0be4038f11..e588e64f988 100644--- a/gateway/session_bot.py+++ b/gateway/session_bot.py@@ -557,7 +557,8 @@ async def recover_bot_deliveries(authority):await _maybe_retry(authority, home, path, record)except RuntimeStoreError as exc:# One receipt the store cannot answer must not stop the owner (and, multiplexed, every- # profile with it): log it, leave the file for the next start, recover the rest.+ # profile with it): log it and recover the rest. The next start reads it again (a+ # retry already pinned on it is then admitted once).logging.getLogger(__name__).error('Bot delivery %s not recovered: %s',record.get('delivery_id'), exc.reason)continuediff --git a/tests/gateway/test_bot_receipt_tombstone_expiry.py b/tests/gateway/test_bot_receipt_tombstone_expiry.pyindex 043ff2e5092..77e3aade25a 100644--- a/tests/gateway/test_bot_receipt_tombstone_expiry.py+++ b/tests/gateway/test_bot_receipt_tombstone_expiry.py@@ -54,23 +54,25 @@ def _receipt(tmp_path):@pytest.mark.parametrize("days_ago", [6, 8])-def test_a_settled_receipt_keeps_its_answer_after_its_chat_is_deleted(tmp_path, days_ago):+def test_a_settled_receipt_keeps_its_answer_after_its_chat_is_deleted(tmp_path, days_ago, caplog):from gateway.session_bot import recover_bot_deliveriesdb = _receipt_then_deleted(tmp_path, status="settled", days_ago=days_ago)try:asyncio.run(recover_bot_deliveries(SimpleNamespace(db=db, waiters={})))+ assert "not recovered" not in caplog.text # answered, not merely skipped by the guardrecord = _receipt(tmp_path)assert (record["status"], record["reply"]) == ("settled", "pong")finally:db.close()-def test_a_failed_receipt_keeps_its_error_after_its_chat_expired(tmp_path):+def test_a_failed_receipt_keeps_its_error_after_its_chat_expired(tmp_path, caplog):from gateway.session_bot import recover_bot_deliveriesdb = _receipt_then_deleted(tmp_path, status="failed", days_ago=8,error="HTTP 401 invalid api key", reason="auth")try:asyncio.run(recover_bot_deliveries(SimpleNamespace(db=db, waiters={})))+ assert "not recovered" not in caplog.text # answered, not merely skipped by the guardrecord = _receipt(tmp_path)assert (record["status"], record["error"], record["reason"]) == ("failed", "HTTP 401 invalid api key", "auth")finally: