fix(discord): dedupe inbound message deliveries#51950
Conversation
Greptile SummaryThis PR adds a narrow inbound deduplication guard for Discord message deliveries, keyed by Key changes:
Confidence Score: 5/5
Last reviewed commit: "fix(discord): dedupe..." |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0383420823
ℹ️ 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".
0383420 to
6253f95
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df276e6ddc
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fee7b58416
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1886d60c3
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd61a62753
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2c0fa2d93f
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ea070a3a0
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a9c6b6b7d5
ℹ️ 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".
a9c6b6b to
d7129cb
Compare
* fix(discord): dedupe inbound message deliveries * test(discord): disable debounce in tool-result dispatch spec
* fix(discord): dedupe inbound message deliveries * test(discord): disable debounce in tool-result dispatch spec
* fix(discord): dedupe inbound message deliveries * test(discord): disable debounce in tool-result dispatch spec
* fix(discord): dedupe inbound message deliveries * test(discord): disable debounce in tool-result dispatch spec
* fix(discord): dedupe inbound message deliveries * test(discord): disable debounce in tool-result dispatch spec
The dedupe fix in openclaw#51950 introduced recentInboundMessages.check() in the Discord message handler. This called prune() on every single message, which did a full linear scan of up to 5000 cache entries on each invocation. On active Discord servers, this blocked the event loop for tens of milliseconds per message, stacking up to the 33-122s delays reported in openclaw#4453. Also fixed map-size.ts which had corrupted duplicate code. Changes: - dedupe.ts: only call prune() when cache.size exceeds maxSize - map-size.ts: rewrite pruneMapToMaxSize to delete in a single pass instead of calling map.keys().next() in a while loop Fixes openclaw#4453
* fix(discord): dedupe inbound message deliveries * test(discord): disable debounce in tool-result dispatch spec (cherry picked from commit 432e894)
* fix(discord): dedupe inbound message deliveries * test(discord): disable debounce in tool-result dispatch spec (cherry picked from commit 432e894)
* fix(discord): dedupe inbound message deliveries * test(discord): disable debounce in tool-result dispatch spec (cherry picked from commit 432e894)
* fix(discord): dedupe inbound message deliveries * test(discord): disable debounce in tool-result dispatch spec
* fix(discord): dedupe inbound message deliveries * test(discord): disable debounce in tool-result dispatch spec (cherry picked from commit 432e894)
Summary
Describe the problem and fix in 2–5 bullets:
accountId:channelId:messageId, and now release the dedupe claim when preflight fails or when the queued inbound worker errors; added focused queue regressions for duplicate suppression and both retry-after-failure paths.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Discord inbound message handling now suppresses duplicate deliveries earlier in the pipeline, but retries the same delivery after transient preflight or queued-worker failures instead of dropping it for the dedupe TTL.
Security Impact (required)
Yes/No): NoYes/No): NoYes/No): NoYes/No): NoYes/No): NoYes, explain risk + mitigation:Repro + Verification
Environment
Steps
Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
pnpm exec vitest run extensions/discord/src/monitor/message-handler.queue.test.tsReview Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No): YesYes/No): NoYes/No): NoFailure Recovery (if this breaks)
extensions/discord/src/monitor/message-handler.ts,extensions/discord/src/monitor/inbound-worker.ts,extensions/discord/src/monitor/message-handler.queue.test.tsRisks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.