Repository navigation
fix(worker): fold a backlog of group texts into a few turns - #66
Merged
Merged
Conversation
A burst's age was measured from when its first text arrived, so once the queue was a few seconds deep every text was past the 15 s bound, folding switched off, and each text cost a full completion. A busy group out-ran the worker and answers came 20 minutes late. Measure from when the worker began filing the burst and cap it at 40 messages. Co-authored-by: Cursor <cursoragent@cursor.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 266af9fa5d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…arrival Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.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.
Why
Goopers messages sent at 10:35 PM were processed at ~10:57 PM. Sendblue was not slow: webhooks are received and queued in milliseconds (
date_sentto receipt ≈ 0 s). The worker was the bottleneck: arrivals were 10–18/min, each processed text cost a ~9 s completion (even ones ending instay_quiet), ~6–7/min drained.Root cause
Group texts that arrive in a burst are folded into the next queued text's turn, bounded by
MAX_BURST_MS(15 s). For the first text of a burst the age fell back to the event's arrival time, so as soon as the queue was a few seconds deep every text looked too old to fold. Folding switched off exactly when it was needed, every text got its own turn, and the backlog fed itself.Fix
burstState()replacesburstStartedAt(): age is measured from when the worker began filing the burst, plus a 40-message cap so a deep backlog is answered in a few turns.docs/SMS_AND_EVENTS.mdupdated.Made with Cursor