fix: pace delivery recovery after startup outages#101118
Conversation
afeb7a8 to
bcb9922
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 7:46 PM ET / 23:46 UTC. Summary PR surface: Source +58, Tests +205. Total +263 across 5 files. Reproducibility: yes. Source inspection shows current main replays eligible outbound and session recovery entries in tight sequential loops, and the PR body includes real SQLite recovery output showing after-fix spacing; I did not run tests because this review is read-only. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep the shared startup replay pacing with the added outbound and session regression tests, and merge after maintainers accept the fixed 250ms delivery-timing tradeoff on an up-to-date head. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main replays eligible outbound and session recovery entries in tight sequential loops, and the PR body includes real SQLite recovery output showing after-fix spacing; I did not run tests because this review is read-only. Is this the best way to solve the issue? Yes. Applying shared pacing at the startup recovery replay point is narrower than changing retry backoff globally, and the follow-up correctly excludes pacing sleep from the active recovery budget for both affected queues. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 054e3675e19a. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +58, Tests +205. Total +263 across 5 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
|
@clawsweeper re-review Updated the PR to address the paced backlog tail finding. The follow-up keeps replay pacing, excludes pacing sleep from the active recovery budget, and adds outbound/session regression tests proving eligible backlog tails still drain under a tiny |
|
🦞🧹 I asked ClawSweeper to review this item again. |
e8c9d6e to
d1f4814
Compare
|
Maintainer review and pre-merge proof complete at The final patch uses one shared outbound replay pacer for startup and reconnect drains, plus the same primitive under the session-delivery owner. Replay starts are spaced by 250ms, the first eligible replay remains immediate, skipped/backoff/max-retry entries do not consume a pacing grant, and every wait is capped by the existing wall-clock recovery deadline. Proof:
Additional remote-proof disposition: a sanitized direct AWS Crabbox allocation was requested with public networking, Tailscale disabled, empty instance profile, and no credential hydration. The coordinator returned no lease after its full 30-minute window ( |
|
Merged via squash.
|
* fix: pace delivery recovery replays * fix: preserve paced delivery recovery budget * fix(delivery): preserve recovery deadline while pacing * fix(delivery): coordinate recovery replay pacing --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
* fix: pace delivery recovery replays * fix: preserve paced delivery recovery budget * fix(delivery): preserve recovery deadline while pacing * fix(delivery): coordinate recovery replay pacing --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
* fix: pace delivery recovery replays * fix: preserve paced delivery recovery budget * fix(delivery): preserve recovery deadline while pacing * fix(delivery): coordinate recovery replay pacing --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
Closes #101058
What Problem This Solves
Startup delivery recovery could replay a large eligible backlog in a tight sequential burst after an outage or restart. Reconnect-triggered drains could run at the same time and bypass any startup-only pacing, concentrating sends against channel and provider rate limits.
Why This Change Was Made
Outbound startup recovery and reconnect drains now share one replay pacer; session-delivery startup recovery uses the same pacing primitive with its own owner. The coordinator grants replay starts at least 250ms apart, lets the first replay start immediately, and serializes concurrent callers without holding delivery execution behind a global lock.
Pacing remains inside the existing recovery deadline. Each sleep is capped to the remaining budget, so a small budget defers the backlog tail instead of overrunning the 60-second startup ceiling. Backoff skips, max-retry moves, active-entry claims, and retry counters keep their existing semantics.
User Impact
Queued messages recovered after a restart or reconnect are replayed more gently instead of all eligible entries being sent back-to-back. This reduces avoidable rate-limit bursts while preserving the bounded startup path and reconnect behavior.
Evidence
Before: both startup recovery loops sorted eligible SQLite queue entries and immediately iterated them; reconnect drains were independently callable. There was no shared pacing owner between those entry points.
After: focused regressions cover:
Local focused proof on the reviewed patch lineage:
Real SQLite queue proof observed a 252ms interval between two eligible recovered deliveries with zero failures. Fresh autoreview completed clean after addressing three findings: retain the recovery deadline, cap pacing sleep to remaining budget, and share outbound pacing with reconnect drains.
Exact-head hosted CI and the additional remote-proof disposition are recorded in the maintainer verification comment before merge.
AI-assisted: implementation and review were AI-assisted; the evidence above was independently exercised against the queue and test surfaces.