You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(bluebubbles): always run catchup on startup; advance cursor to page boundary on truncation
Addresses two more Codex P1 findings on PR #66760:
- Run catchup even when cursor age is under MIN_INTERVAL
Catchup is the *only* mechanism that recovers messages dropped during
the gateway-down window, and it runs once per gateway startup. The
30s MIN_INTERVAL_MS gate was protecting against ~nothing (a few
extra BB queries on rolling restarts) at the cost of permanent
message loss when restarts happened within that window. A real
failure: t0 startup, cursor=t0; t0+10s gateway down, webhook
ECONNREFUSED at t0+15s; t0+20s restart skips catchup entirely. Gate
removed; bounded by perRunLimit/maxAge + dedupe-protected so the
cost of always running is capped.
- Keep cursor behind unfetched pages when limit is hit
Previously a long outage with >perRunLimit messages would fetch the
oldest perRunLimit (sort:ASC), process them, and then advance the
cursor to nowMs — permanently skipping the unfetched newer tail. Now
we track the latest fetched timestamp regardless of fate, and on
truncation (fetchedCount === perRunLimit) the cursor advances only
to that page boundary so the next gateway startup picks up the rest.
Updated the existing perRunLimit warn to reflect the new
recoverable-on-next-startup semantics.
Tests: replaced obsolete "skips rapid restart" with "runs catchup even
on rapid restarts"; added "advances cursor only to last fetched ts when
result is truncated". BB suite 410/410.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments