Repository navigation
fix(discord): remove late previews after transient delete failures - #130392
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 5:40 PM ET / 21:40 UTC. ClawSweeper reviewWhat this changesThe PR routes failed Discord progress-preview deletes through one Discord-owned cleanup queue so final cleanup can retry transient failures. Merge readinessKeep this maintainer-owned PR open. Current main still separates normal-clear failure custody from the controller’s retarget-only drain; this branch unifies that custody and has no blocking correctness findings, pending exact-head CI. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherDiscord progress streaming creates temporary preview messages through Discord REST while inbound message processing later delivers a final reply. The preview controller performs turn cleanup, and the draft stream owns deletion and retry custody for those previews. flowchart LR
A[Discord inbound message] --> B[Progress preview stream]
B --> C[Discord REST create or delete]
C --> D[Failed deletion queue]
D --> E[Final reply cleanup]
E --> F[Preview removed or diagnostic retained]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -6, Tests +107. Total +101 across 6 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the single Discord-owned deletion-custody flow after exact-head CI confirms the focused lifecycle and extension gates. Do we have a high-confidence way to reproduce the issue? Yes, at source level: the focused RequestClient lifecycle test holds the preview POST, injects transient DELETE failures, and checks eventual removal; this read-only review did not execute it. Is this the best way to solve the issue? Yes: placing current-preview and detached-preview delete failures under the same Discord stream owner removes the duplicate retention boundary rather than adding a retry layer or controller-side workaround. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a482a50cda88. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review The rewritten head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…penclaw#130392) * fix(discord): clean up late progress previews after queued turns * fix(discord): unify preview cleanup ownership
Closes #130391
Related: #102341, #130006
What Problem This Solves
Fixes an issue where Discord progress previews remain visible after a transient deletion failure during final cleanup. This is particularly visible when a preview POST acknowledgement arrives late while another native message is already being processed: the later final reply arrives, but the old working message remains.
Why This Change Was Made
Discord had two failed-deletion owners. Normal
clear()retained failures inside the generic draft lifecycle, while retracted, retargeted, and stale previews used a Discord-owned queue. The controller's final cleanup drained only the latter queue, so a failure during its last normal clear had no subsequent owner to retry it.Use the existing shared stream-controls API and route normal clear through Discord's existing current-message deletion owner. One private queue now retains the exact channel/message pair for every failed preview deletion, and the existing final cleanup drains it. Rename the private retarget-only cleanup name to describe its actual responsibility. This removes the duplicate retention path without adding timers, a retry layer, transport fallbacks, configuration, authorization, persistence, or SDK changes.
Production LOC: +23/-29 (net -6). Tests: +125/-18 (net +107); test-support changes are a neutral private-method rename.
User Impact
A late working preview disappears when its first deletion fails transiently and the existing final cleanup succeeds. Later final replies remain intact. Error finals still retain their diagnostic progress preview; block preservation, generation fencing, and thread-retarget channel ownership are unchanged.
Evidence
0c19911ac223162bedb72073ec6185979886988f. An ordinary merge incorporates the separately landed upstream CI repair fix(tests): restore sticky model fixture typecheck #130441. All six Discord file blobs and the complete PR diff remain identical to the reviewed repair; 112 focused tests, strict scoped types, typed lint, and a fresh full Codex review passed again after integration. Exact-head CI passed: 30 successful jobs, 21 scope-skipped jobs, no failures.bf2639362d83a5d7ad37641eaa8fadf9b44755earetained the old preview after DELETE 503 even though the later final was delivered. That normal-clear path was unchanged from frozen maina868258156a6708dd798deb3d43d3a4277a4d511. The matching REST-boundary regression failed in two teardown cases before the production edit.0c19911ac223162bedb72073ec6185979886988f. Native Discord Gateway WebSocket ingress, a mock provider, and a stateful REST fault fixture reproduced the original ordering: held preview POST, second native inbound message, late POST acknowledgement, DELETE 503, DELETE 204, and later final delivery. Fresh visible state contained only the final reply. The separate native provider-error case retained both progress preview and error final without deletion. These reruns used fresh temporary state, not an operator database or a migration.mailparser,mailauth,imapflow) and their consequent type errors. No dependency manifests or assertions were weakened. The refreshed candidate's hosted typecheck, lint, extension, and required gates all passed in the exact-head CI run above.mainby feat(models): add configurable model selection scopes #127813. The independent test-only repair fix(tests): restore sticky model fixture typecheck #130441 was landed first, then merged normally into this branch without changing the Discord patch. ClawSweeper's separate partial live-verification flag was an expected-terminal-text mismatch: its captured logs show all six REST tests passing twice. The refreshed focused tests and native scenarios above provide direct behavior evidence; its remaining rank-up request is satisfied by the successful exact-head CI linked above.Mock-Gateway verdict (real native ingress; not a live Discord SaaS session):
{ "passed": true, "transport": "Discord Gateway WebSocket + stateful REST fixture", "provider": "mock-openai", "latePreview": { "nativeInboundMessages": 2, "deleteStatuses": [503, 204], "oldPreviewVisibleAfterCleanup": false, "laterFinalRetained": true }, "providerError": { "progressPreviewRetained": true, "errorFinalRetained": true, "deletes": 0 } }