Make notice redelivery iterative instead of self-recursive #142

Merged
weichen merged 1 commits from feature/notice-delivery-recursion-fix into main 2026-10-11 08:12:14 +00:00
Owner

Real-PG CI gate caught a stack overflow (job 2352): deliverNotices re-invoked itself from a defer after requeuing a failed batch - persistent failures recursed without bound. Iterative rewrite + bounded regression test; full suite green on SQLite and real PostgreSQL 18.6 + Redis. Refs: Dev PR #333.

Real-PG CI gate caught a stack overflow (job 2352): deliverNotices re-invoked itself from a defer after requeuing a failed batch - persistent failures recursed without bound. Iterative rewrite + bounded regression test; full suite green on SQLite and real PostgreSQL 18.6 + Redis. Refs: Dev PR #333.
weichen added 1 commit 2026-10-11 08:12:14 +00:00
Make notice redelivery iterative instead of self-recursive
ci / vet-and-test (pull_request) Successful in 42s
1ef1fdeac9
Why: deliverNotices re-invoked itself synchronously from a defer after a failed startNoticeRun requeued the batch - a persistently failing delivery (busy conversation, missing row, slow DB) recursed without bound and overflowed the stack (real-PG CI job 2352, internal/runmgr).

Evidence: regression test TestNoticeDeliveryFailureIsBounded (missing conversation row) hangs on the old code and passes with the fix; full backend suite green on SQLite and against real PostgreSQL 18.6 + Redis; clean-HEAD reproduction isolated an unrelated count=2 admin-login artifact.

Impact: failed batches now return after requeue (retried on the next enqueue or restart); notices arriving during delivery are picked up by a bounded loop tail instead of defer recursion; no behavior change on the success path.

Refs: Dev PR #333; plan R8 real-database gate.
weichen merged commit c8d66ca3cd into main 2026-10-11 08:12:14 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Backend#142