fix(discord): limit implicit reply references to first chunk#99171
fix(discord): limit implicit reply references to first chunk#99171LiLan0125 wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 2, 2026, 1:03 PM ET / 17:03 UTC. Summary PR surface: Source +67, Tests +44. Total +111 across 6 files. Reproducibility: yes. Current-main source repeats replyTo through Discord text/media chunks and the linked issue includes shipped-version instrumentation showing repeated message_reference values; I did not run a live Discord repro in this read-only review. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land one source-aware Discord fix after redacted live Discord proof confirms implicit first/batched chunks quote only the first physical message while explicit/all and the existing audioAsVoice threading behavior remain intact. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source repeats replyTo through Discord text/media chunks and the linked issue includes shipped-version instrumentation showing repeated message_reference values; I did not run a live Discord repro in this read-only review. Is this the best way to solve the issue? Yes for the code path. The PR keeps the fix in the Discord plugin owner boundary and uses source plus mode to preserve explicit/all behavior; the remaining blockers are live proof and selecting one same-root-cause PR to land. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3f289fdb4042. Label changesLabel justifications:
Evidence reviewedPR surface: Source +67, Tests +44. Total +111 across 6 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Superseded by #100784, landed as The landed fix uses one source-aware Thanks @LiLan0125 for the implementation and tests on this bug. |
Summary
message_referencereuse for implicitreplyToMode: "first"and"batched"replies to the first physical Discord message chunk.replyToMode: "all", explicit/direct replies, andaudioAsVoicefollow-up sends that reuse a captured reply id.audioAsVoicepayload forwarding path.Change Type
Scope
Verification
node scripts/run-vitest.mjs extensions/discord/src/send.sends-basic-channel-messages.test.ts src/infra/outbound/message-plan.test.ts extensions/discord/src/outbound-adapter.test.ts->[test] passed 2 Vitest shards in 52.29spnpm tsgo:extensions:test-> passed with exit code 0git diff --check-> passedsendMessageDiscordimplementation from this branch.Real behavior proof
Behavior addressed: Chunked Discord replies with implicit
replyToMode: "first"now attach the native Discord reply reference only to the first physical message, while reusable explicit/all-mode replies still keep the reference on later chunks.Environment tested: Linux workspace on Node v22.22.0, branch
fix/99068-discord-reply-first-chunks.Steps run after the patch: Called the actual
sendMessageDiscordfunction fromextensions/discord/src/send.jswithnode --import tsx; captured the request bodies sent through a localRequestClientimplementation.Evidence after fix:
Output:
{ "implicitFirstText": [ { "send": 1, "route": "/channels/789/messages", "contentLength": 2000, "fileCount": 0, "hasMessageReference": true, "messageReferenceId": "orig-123" }, { "send": 2, "route": "/channels/789/messages", "contentLength": 1, "fileCount": 0, "hasMessageReference": false, "messageReferenceId": null } ], "implicitFirstMedia": [ { "send": 1, "route": "/channels/789/messages", "contentLength": 2000, "fileCount": 1, "hasMessageReference": true, "messageReferenceId": "orig-123" }, { "send": 2, "route": "/channels/789/messages", "contentLength": 500, "fileCount": 0, "hasMessageReference": false, "messageReferenceId": null } ], "implicitAllText": [ { "send": 1, "route": "/channels/789/messages", "contentLength": 2000, "fileCount": 0, "hasMessageReference": true, "messageReferenceId": "orig-123" }, { "send": 2, "route": "/channels/789/messages", "contentLength": 1, "fileCount": 0, "hasMessageReference": true, "messageReferenceId": "orig-123" } ], "explicitFirstText": [ { "send": 1, "route": "/channels/789/messages", "contentLength": 2000, "fileCount": 0, "hasMessageReference": true, "messageReferenceId": "orig-123" }, { "send": 2, "route": "/channels/789/messages", "contentLength": 1, "fileCount": 0, "hasMessageReference": true, "messageReferenceId": "orig-123" } ] }Observed result: Implicit first-mode text and media sends only include
message_referenceon send 1, while all-mode and explicit first-mode sends includemessage_referenceon both chunks.Not tested: Live Discord API delivery with real credentials and real voice-message media conversion were not exercised locally.
Root Cause
replyTopassed into chunked sends as reusable, so an implicitreplyToMode: "first"logical reply could become multiple native Discord replies after text/media splitting.audioAsVoicepayload path intentionally captures one reply id for its internal voice/text/media sends, so that captured id must be treated as explicit when passed to chunked follow-up sends.Regression Test Plan
send.sends-basic-channel-messages.test.tscovers implicit first-mode text chunks, implicit first-mode media caption chunks, all-mode chunks, explicit first-mode chunks, and direct chunked replies.outbound-adapter.test.tscoversaudioAsVoiceforwarding so captured reply ids are marked explicit before reaching chunked message sends.message-plan.test.tsremains in the targeted run to cover upstream implicit reply consumption behavior.User-visible / Behavior Changes
replyToMode: "first"or"batched"no longer create reply-thread references on every split chunk.replyToMode: "all"keep the previous reusable reference behavior.Impact Assessment
audioAsVoicepayloads were traced and covered by targeted tests.replyTo, direct sends without policy metadata, explicit reply ids, all-mode replies, and media caption follow-ups were considered.Security Impact
Closes #99068