fix(discord): gate replyTo on first chunk for implicit-first replies#99083
fix(discord): gate replyTo on first chunk for implicit-first replies#99083ZOOWH wants to merge 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 3, 2026, 12:00 AM ET / 04:00 UTC. Summary PR surface: Source +38, Tests +26. Total +64 across 5 files. Reproducibility: yes. Current main is source-reproducible: sendDiscordText and sendDiscordMedia still pass the same replyTo into every internal chunk, and buildDiscordMessageRequest turns each present replyTo into message_reference; the linked issue also includes shipped-version logs. 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:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land one canonical source-aware Discord-plugin fix for #99068 that gates only implicit single-use native reply references across internal chunks, then close the sibling candidate PRs after merge. Do we have a high-confidence way to reproduce the issue? Yes. Current main is source-reproducible: sendDiscordText and sendDiscordMedia still pass the same replyTo into every internal chunk, and buildDiscordMessageRequest turns each present replyTo into message_reference; the linked issue also includes shipped-version logs. Is this the best way to solve the issue? Yes. The Discord send layer is the narrow maintainable boundary because shared outbound planning already consumes logical implicit replies, while the remaining fanout happens when Discord splits one send into physical chunks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c37961fdab6e. Label changesLabel justifications:
Evidence reviewedPR surface: Source +38, Tests +26. Total +64 across 5 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
|
|
@clawsweeper re-review — wired suppressTrailingReply through outbound send context, media trailing respects mode, 5 test scenarios |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
@clawsweeper re-review — derived from replyToMode (not helper option), all CI checks passed locally |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review — real Discord proof attached: 5 chunks, only first carries reply reference |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review — now consumes replyToMode in the chunking path via isSingleUseReplyToMode, preserves explicit/all, gates only implicit-first |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review — squashed to single commit, send-layer gating + 4 regression tests + real Discord proof |
|
🦞🧹 I asked ClawSweeper to review this item again. |
73ca6ac to
14d1b71
Compare
86b3bf7 to
cd0e536
Compare
|
@clawsweeper re-review — source-aware gating (replyToIdSource + replyToMode), 4 regression tests, type constraints fixed |
|
🦞🧹 I asked ClawSweeper to review this item again. |
cd0e536 to
a882da2
Compare
|
@clawsweeper re-review — rebased onto latest main, source-aware gating |
|
🦞🧹 I asked ClawSweeper to review this item again. |
With replyToMode "first", only the first physical chunk should carry the native Discord reply reference — the createReplyToFanout already consumes the single-use id at the inter-payload level, but sendDiscordText unconditionally passed replyTo to every chunk body. Fix: consume replyToMode via isSingleUseReplyToMode in the direct Discord send/chunking path so trailing chunks are plain messages for implicit-first replies. Preserve replyTo on all chunks for explicit tags and replyToMode "all". In sendDiscordMedia, gate trailing text chunks on the same policy instead of always passing undefined. Wire replyToIdSource and replyToMode from the outbound adapter through outbound-payload to DiscordSendOpts so the send layer has the policy metadata it needs. Add four send-layer regression tests covering implicit-first text/media gating plus explicit/all text/media preservation.
a882da2 to
4ed58b7
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Superseded by #100784, landed as The landed fix uses one source-aware Thanks @ZOOWH for identifying and working on the reply fanout bug. |
What Problem This Solves
With
channels.discord.replyToMode: "first", chunked replies send the native Discord reply reference on ALL physical chunks — N notifications for one reply. ThecreateReplyToFanoutcorrectly gates at the inter-payload level, but the adapter wasn't passingreplyToIdSource/replyToModethrough.Closes #99068
Root Cause / Fix
createReplyToFanoutalready handles single-use replies — it returns the reply id once andundefinedfor subsequent calls. But the Discord outbound adapter,sendText, andsendMediadidn't forwardreplyToIdSourceandreplyToModefrom the delivery context through tosendMessageDiscordoptions.Fix: pass
replyToIdSourceandreplyToModethrough the adapter → deliver options → send options chain. Also fixsendDiscordMediatrailing chunks to passundefinedinstead of inheritingreplyTo.Evidence
Real Discord proof — chunks reply only on first message
Screenshot: Discord client shows reply indicator only on "chunk_0".

Tests
Change Type
Scope
Security Impact