fix(cache): clamp old snowflakes + poller channel backoff#13
Merged
Conversation
… backoff
getMessages returned [] when `after` was older than the cache window,
breaking clients using after=0 ("give me everything"). Now clamps to
the window start so all cached messages are returned.
Adds ChannelHealth tracker to the poller with exponential backoff
(pollInterval × 2^(failures-1), cap 16×) so channels that consistently
fail (403/404) stop wasting rate-limit budget. Self-healing on success.
Closes #12
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug where
getMessagesreturned[]whenafterwas older than the cache window (e.g.,after=0), breaking all clients using the standard "give me everything" cursor pattern. Also adds exponential backoff to the poller so channels that consistently fail stop wasting rate-limit budget.Changes
afterto window start instead of returning empty; uses- 1nto avoid off-by-one at the boundaryChannelHealthtracker with exponential backoff (pollInterval × 2^(failures-1), cap 16×). Self-healing: success resets backoff.recordSuccessonly reports recovery when channel was in active backoff (not expired).initialPollandstartPollingLoopafter=0, channel health unit + integration), 2 existing tests updated for corrected behaviorLinked Issues
Closes #12
Test Plan
./scripts/ci/validate.sh— lint (tsc + shellcheck) + 63 tests passingafter=0return all cached messages