Repository navigation
fix(discord): preserve native replies in bound threads - #129801
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesRoutes native replies in bound Discord threads through the bot sender and removes unsupported webhook reply fields. Example: Send 2,001 characters in thread-1 with an explicit reply to parent-message and reply mode off.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep open: this PR fixes a current Discord reply-routing defect, and the latest commit resolves the previous finding without introducing another code defect. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Discord outbound adapter receives delivery context, selects the bot or bound-thread webhook transport, and returns platform receipts to the shared delivery lifecycle. flowchart TD
A[Shared delivery lifecycle] --> B[Discord outbound adapter]
B --> C[Effective native reply]
C --> D[Bot message sender]
B --> E[Reply-free webhook persona]
D --> F[Discord HTTP endpoint]
E --> F
F --> G[Delivery receipts]
Technical reviewBest possible solution: Keep native replies with the existing bot sender and ordinary persona messages with the webhook sender, retaining the current authorization and receipt owners. Do we have a high-confidence way to reproduce the issue? Current main routes reply-bearing bound-thread text through Execute Webhook, whose documented request contract lacks native message references; no target code was executed during this review. Is this the best way to solve the issue? The patch is the smallest complete repair: select the existing native sender for effective replies and remove unsupported webhook reference handling without adding another delivery owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 651f9701c17e. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: Existing authorization checks remain intact, but the changed sending principal needs final-effect permission evidence. EvidenceSecurity concerns:
What I checked:
Likely related people:
PR surfaceSource -16, Tests +73, Docs 0. Total +57 across 7 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (6 earlier review cycles)
Reviewed October 24, 2026, 3:45 AM ET / 07:45 UTC (Revision 7). |
f48384b to
26c432b
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* fix(discord): preserve native replies in bound threads * test(discord): distinguish persona sends from native replies
What Problem This Solves
Fixes explicit and configured native replies losing their reply relationship in Discord sessions bound to a thread with a webhook persona.
User Impact
Native replies use the bot identity and require its permission to send in the thread. Ordinary non-reply messages retain their webhook persona. Missing bot permission remains a visible failure.
Why This Change Was Made
extensions/discord/src/outbound-adapter.ts:87selected the bound webhook even when a native reply was requested. Execute Webhook does not support native message references, so addingmessage_referencethere could not create the requested reply.The adapter now uses the existing bot sender whenever an effective reply reference is present. Unsupported webhook reply arguments, request fields and misleading reply receipts are removed. The existing bot sender continues to own chunk scope, authorization, progress receipts and uncertain-delivery behavior.
Evidence
A production-adapter reproduction with a real thread binding and loopback Discord HTTP endpoint fails on current main: an explicit reply sends two webhook requests rather than native messages. The same reproduction checks explicit replies with mode off, implicit first-chunk replies, per-chunk receipt references, a visible native 403 without webhook fallback, and ordinary webhook-persona delivery.
The loopback reproduction passes all four checks with the fix: explicit/default-off native replies, implicit/first native replies, visible native permission failure with no fallback, and ordinary webhook-persona delivery. It uses the real binding manager, outbound adapter, REST sender and receipts. The regression groups also exercise the plugin message adapter and retire the unsupported webhook expectation.
Targeted syntax lint, oxfmt and diff whitespace checks pass. Production +2/-18 (net -16), tests +81/-8 (net +73), documentation +1/-1. All 37 local tests pass across the message-adapter, outbound-adapter and webhook chunk-limit files, including both new native-reply regressions. The shared worker build took 579 seconds; Vitest reported 927.51 seconds including startup. Independent Codex review found no actionable P0–P2 issue. Final-head CI 40075018843 is green, including all 13 durable line-limit scenarios in
checks-node-compact-small-2(job 120816718041).No live Discord or Gateway was exercised under the scoped instruction to use local focused proof and PR CI.
The first exact-head run, 40073068349, found six sibling durable-delivery fixtures still requiring a webhook while unconditionally requesting replies. Their setup now uses reply-free messages for webhook line/fence/mention checks and explicitly requires the bot endpoint for the existing bound-thread native-reply case. The focused local rerun completed worker compilation but stalled before assertions under both Bun and Node, so it was stopped through the managed runner after CI supplied the passing result. The test-only follow-up passed independent P0–P2 review with no findings; no production behavior changed.
Captured production-adapter HTTP boundary trace
The following is captured from the same production binding → outbound adapter → REST sender path on final head
d2102b76ac96d7d104604ecf52c98f336f0cc59c. All IDs and content are synthetic; the endpoint is local. The fixture responds with HTTP 200 for permitted sends and HTTP 403/code 50013 for the denial. This proves the production caller propagates that denial without a webhook retry; it does not claim to exercise Discord's live permission service.ClawSweeper's final-head review reports no remaining code finding and requests inspectable boundary evidence; the trace above supplies the recorded requests and responses. Live Discord remains untested under phase-one scope. No new permission gate or fallback is added.