fix: prevent followup queue from delivering same message multiple times (closes #30604)#46170
fix: prevent followup queue from delivering same message multiple times (closes #30604)#46170Br1an67 wants to merge 1 commit into
Conversation
Greptile SummaryThis PR introduces a TTL-based delivered-message dedupe cache ( Key changes:
The implementation is logically sound across all drain paths, and the Confidence Score: 4/5
Last reviewed commit: 5117b7b |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 32becb6e1a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| @@ -128,6 +129,7 @@ export function scheduleFollowupDrain( | |||
| ...routing, | |||
| }); | |||
| queue.items.splice(0, items.length); | |||
| markFollowupRunsDelivered(items, key); | |||
There was a problem hiding this comment.
Mark delivered IDs for all drain paths
This new delivered-dedupe mechanism is only updated in the collect-batch splice path, but other successful drain paths still remove items via drainNextQueueItem without recording them (for example individual collect drains when collectDrainResult === "drained", summary drains, and non-collect modes). In those flows, enqueueFollowupRun checks DELIVERED_QUEUE_MESSAGE_IDS but never finds the message, so after the 5-minute RECENT_QUEUE_MESSAGE_IDS window expires, the same provider message can still be re-enqueued and processed again.
Useful? React with 👍 / 👎.
3545050 to
5117b7b
Compare
…es (closes openclaw#30604) Add a TTL-based delivered-message dedupe cache to the followup queue. After items are drained via queue.items.splice, their message IDs are recorded so re-delivery of the same provider message is rejected for 20 minutes instead of being re-enqueued. - Add DELIVERED_QUEUE_MESSAGE_IDS cache in enqueue.ts - Check delivered cache during enqueueFollowupRun - Export markFollowupRunsDelivered for drain loop - Wire markFollowupRunsDelivered in drain.ts after splice Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Closing to manage active PR count. Will reopen when slot is available. |
Summary
queue.items.splice, the dedupe check inisRunAlreadyQueuedpasses because the delivered item is no longer in the array.markFollowupRunsDeliveredinto the drain loop.Change Type
Scope
Linked Issue/PR
Security Impact
Repro + Verification
Steps
Expected
Each message delivered exactly once.
Actual (before fix)
Same message delivered 2-3 times.
Evidence
pnpm buildpassesHuman Verification
Review Conversations
Compatibility / Migration
Failure Recovery
Risks and Mitigations
None — additive cache following established pattern.
This PR was AI-assisted (fully tested with pnpm build/check/test).