Repository navigation
fix(discord): message edit, delete and pin fail after one lost response - #169806
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 maintainer review before merge. What this changesDiscord message edits, deletes, pins, and unpins use the existing retry runner, including cancellation and already-applied delete recovery. Example: Deleting message 222 in channel 111 succeeds at Discord, but the response connection drops.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current Discord retry bypass with a focused patch and no actionable correctness findings; the observed CI fixture failure also occurs on unrelated work. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherDiscord action dispatch passes account-scoped mutations to production send helpers, which use the retry runner and REST client to return confirmed results or errors. flowchart LR
A[Discord message action] --> B[Mutation helper]
B --> C[Account scoped retry runner]
C --> D[REST client]
D --> E[Current authority checks]
E --> F[Discord HTTP endpoint]
F --> D
D --> C
Technical reviewBest possible solution: Land the existing focused repair through the normal workflow with inherited CI failures handled under repository policy. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the direct-call failure path, and the contributor supplies production-client HTTP traces; this read-only review executed no target code. Is this the best way to solve the issue? Reusing the existing per-request owner is the narrow repair, with cancellation preserved and delete success normalization restricted to an earlier ambiguous attempt. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6d479f5c893a. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +40, Tests +110, Docs +1. Total +151 across 6 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
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 HistoryReviewed October 12, 2026, 8:49 AM ET / 12:49 UTC (Revision 3). |
|
Maintainer override: the only red job is checks-node-compact-small-3, failing eager-import-closure.test.ts:173 on a duplicate src/config/sessions/transcript-entry-anchor.ts entry. The same test and assertion fail on an unrelated PR (https://github.com/openclaw/openclaw/actions/runs/38246940545/job/114803546576). This PR changes only Discord message mutation retries, their tests and the retry docs. ClawSweeper is ready on this exact head with no findings. |
|
Landed in 37aefbf. Thanks @ericcurtin, Discord edits, deletes and pins now survive transient failures. |
…se (openclaw#169806) Discord message edit, delete, pin and unpin bypassed the Discord retry owner, so one transient error (for example a 502) or a lost response failed the action. They now go through the existing retry owner. A delete whose first attempt succeeded but whose response was lost succeeds when the retry gets 10008 Unknown Message; a 10008 on the first attempt still fails. Persistent failures stop after the configured attempts, and cancellation stops the backoff. Proof: production helpers and the real RequestClient against a loopback fault server. On main all four mutations failed after one request on a 502; with the PR they succeeded after a retry, and the lost-response delete and pin/unpin cases recovered. Real Discord QA Lab on the PR: send, edit with readback, and delete. Live pin/unpin was not run because the QA bot lacks Manage Messages; the loopback proof covers those requests. Fixes openclaw#127536. Thanks @ericcurtin. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #127536
What Problem This Solves
Fixes: Discord message edit, delete, pin and unpin fail after one transient error or lost response, while reactions retry.
User Impact
User impact: these actions recover from transient Discord errors. A delete that was applied but lost its response reports success, not Unknown Message. A caller that aborts during backoff stops retrying right away.
Why This Change Was Made
They now use the same per-request retry runner as reactions. Delete treats code 10008 as done only after an earlier attempt failed with a lost response.
createDiscordClientpasses the caller'ssignalto that runner, so abort interrupts backoff.Evidence
Trace through the production helpers (
editMessageDiscord,pinMessageDiscord,unpinMessageDiscord,deleteMessageDiscord) and the realRequestClientagainst a loopback HTTP server that plays Discord (no tokens, no external hosts):pnpm test extensions/discord/src/send.sends-basic-channel-messages.test.ts --maxWorkers=1: 58 passed, 69s. The new retry and abort tests fail without the fix.pnpm test:extension discord: 251 files, 2683 passed.pnpm tsgo:extensions,pnpm tsgo:extensions:test, oxlint and oxfmt are clean.test/scripts/eager-import-closure.test.ts, which also fails on puremain(12a91e0919,08005517c4) and on unrelated PRs. This PR does not touch it.Independent validation on
3d51c5f96c7e229b7c36a0c9e894feebed21cd96RequestClientagainst a loopback HTTP fault server: all four actions recover from a 502 in two requests. Baseline59aa506fe82e8c88ac2265330af00f25267521ccrejects each after one request.fetch failed. First-attempt 10008 remains an error. Abort during a two-second backoff stops head after one request (62 ms). Persistent 502 uses exactly the configured three attempts.PUT/DELETEto/v10/channels/111/pins/222. Both use exactly three attempts for persistent 502, and abort during backoff after one request (75 ms / 193 ms). Baseline sends only one request and reports failure for 502 and lost responses.Missing Permissions; live pin/unpin could not be completed. No permissions were changed and no credential rotation was attempted. Pin/unpin transport recovery is covered by the production-client fault matrix above.pnpm test extensions/discord/src/send.sends-basic-channel-messages.test.ts --maxWorkers=1— 58 passed (31.33 s runner wall time). Changed-file oxfmt and oxlint passed. Contributor code ran only in isolated Docker.eager-import-closure.test.tscase fails at line 173 with duplicatesrc/config/sessions/transcript-entry-anchor.ts. This PR's failing job has the same assertion. Aggregate CI remains red; no jobs were rerun.Thanks to @ericcurtin for the fix and @steipete for the report. No overlap with Pash/Sarah changes.
Merge risk: two-way door; reverting restores the former retry behavior without migrating configuration or stored state. Blast radius is Discord message edit/delete/pin/unpin recovery and callers cancelling Discord retry backoff. Non-idempotent message sends retain the existing retry-safety owner.