feat(scheduler): dead-letter quarantine for poisoned stream messages - #2403
larryluozhang wants to merge 1 commit into
Conversation
Add poison message filtering to prevent infinite redelivery.
🤖 Open Code ReviewTarget: PR #2403 🔍 OpenCodeReview found 3 issue(s) in this PR. 1.
|
✅ Automated Test Results: PASSEDAll tests passed (2/2 executed). memos_python_core/changed-python-source: 2/2. Duration: 7s [advisory, non-gating] AI-generated tests on branch test/auto-gen-dd6f3f0951d41218-20260922091932: 112/112 passed — these do NOT affect the PR verdict; review the branch manually. Branch: |
Problem
Messages whose handlers deterministically fail (e.g. an oversized batch that
the LLM provider always rejects with HTTP 400) are redelivered forever via
xautoclaim. In production we observed one 40k-token batch failing every cycle
for days — burning LLM quota, spamming logs, and churning memory.
Fix
On the claim path, check
times_deliveredviaxpending. Messages exceedingSCHEDULER_MAX_DELIVERIES(default 5) are:scheduler:messages:stream:deadletter(capped, with payload +delivery count + source stream for forensics),
Lookup failures fail open (message is processed rather than dropped by
mistake). No change for healthy messages.