Repository navigation
fix: show confirmed attachment sends in chat history - #205932
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: passed. What this changesReplace attachment preview errors with a sent notice when the source-conversation delivery has a confirmed platform message ID. Example: The message tool delivers report.pdf with message ID sent-1, but history cannot prepare its preview.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: current main still mislabels confirmed sends when preview preparation fails, and the focused repair has no actionable correctness findings. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe outbound source-reply mirror consumes successful message-tool delivery results and prepared display blocks, then records the source session's assistant history for Control UI. flowchart LR
A[Message tool] --> B[Channel delivery]
B --> C[Delivery fact]
C --> D[Source reply mirror]
E[Preview preparation] --> D
D --> F[Session transcript]
F --> G[Control UI history]
Technical reviewBest possible solution: Keep the receipt-aware correction in the existing source-reply mirror and land it once required CI succeeds. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the erroneous preview-error path, supported by the contributor's base/head Gateway reproduction and inspected screenshots; this review did not execute target code. Is this the best way to solve the issue? The patch is a small, complete correction at the owner that knows both delivery confirmation and preview outcome, preserving media-access checks and receipt-free behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ef006253e47c. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +15, Tests +39. Total +54 across 2 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel 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 HistoryReview history (1 earlier review cycle)
Reviewed November 26, 2026, 7:23 AM ET / 12:23 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…wner - Return the notice blocks directly instead of copying into a mutable array. - Drive the regression through the real preview owner with a local PDF instead of mocking it.
|
Proof on exact head Setup: each side built from Canonical transcript entry ( Nothing under Why the preview fails (unchanged here, by design): the preview owner runs Note: the stock qa-channel send action is text-only, so the bus stand-in received the caption without the file bytes; the platform receipt is what the mirror branches on. Unit: Screenshots: main (Not sent), fix (sent notice), controls (image preview, no receipt). |
|
Thanks @RaphLorr for finding and fixing this. Landed: when a channel confirms a send with a platform message id but Control UI can't build the history preview, chat history now shows that the attachment was sent instead of a red "Not sent" card. Unconfirmed sends and working previews are unchanged, and the transcript content the model replays is byte-identical. We added one small follow-up commit on top of yours and kept your commit and credit. |
Root cause: `src/infra/outbound/source-reply-mirror.ts:521` builds the history preview for a message-tool send with the same owner used for replies that have not been delivered yet. When that preview cannot be prepared, its `attachment_error` block (code `delivery-failed`, "Not sent · Delivery failed. Try sending this file again.") was stored as-is, even though the channel had already confirmed the send with a platform message id. Thanks @RaphLorr for the report, the reproduction and the fix. ## What Problem This Solves When the `message` tool sends a local document to the current channel and the channel confirms it with a platform message id, Control UI could still show a red "Not sent" card for that file. People then resend a document the recipient already has. Why the preview fails: the preview owner only ingests a local non-image file when the reply payload is explicitly trusted (`src/gateway/managed-image-attachments.ts:964`, since openclaw#130402). A model-chosen local PDF is not, so the item throws, and the catch-all failure code at `src/gateway/managed-image-attachments.ts:920` labels that refusal `delivery-failed`. That trust rule is deliberate and stays unchanged here; the wrong part is only showing it as a delivery failure after a confirmed delivery. ## Fix The source-reply mirror already holds the delivery fact. When the send has a concrete platform message id and the preview contains `attachment_error` blocks, the display sidecar replaces them with one line: "Attachment sent to the channel. Preview unavailable in chat history." - Sends without a platform receipt keep their current display. - Previews that succeed (images, trusted files) are unchanged. - The media reader, local-file trust and access checks are unchanged. - Only `openclawDisplayContent` (the Control UI display sidecar) changes. The canonical transcript message that replay and model context read is byte-identical to main (evidence below). ## Evidence Real Gateway + Control UI proof on this head (main twice, fix twice, real Chromium, after reload), with controls for an image preview and a send without a platform receipt, and the serialization-boundary check that the canonical transcript entry is byte-identical to main: openclaw#205932 (comment) @RaphLorr's original evidence reproduced the report twice on WeChat with OpenClaw 2026.11.10 (provider returned a platform message id; Control UI showed a failed card). - `src/infra/outbound/source-reply-mirror.test.ts` drives the real preview owner with a local PDF: the receipt case fails on main source and passes here (25/25); importer suites 89/89. - Production +13 lines, tests +38 net, against the merge base. ## Merge danger Two-way door. The change only alters what the display sidecar stores for newly mirrored confirmed sends; a revert restores the old card for new rows. Rows written while this is live keep the notice text. Blast radius: Control UI history for message-tool sends with a platform receipt whose preview fails. Co-authored-by: Ayaan Zaidi <[email protected]>
Root cause: `src/infra/outbound/source-reply-mirror.ts:521` builds the history preview for a message-tool send with the same owner used for replies that have not been delivered yet. When that preview cannot be prepared, its `attachment_error` block (code `delivery-failed`, "Not sent · Delivery failed. Try sending this file again.") was stored as-is, even though the channel had already confirmed the send with a platform message id. Thanks @RaphLorr for the report, the reproduction and the fix. ## What Problem This Solves When the `message` tool sends a local document to the current channel and the channel confirms it with a platform message id, Control UI could still show a red "Not sent" card for that file. People then resend a document the recipient already has. Why the preview fails: the preview owner only ingests a local non-image file when the reply payload is explicitly trusted (`src/gateway/managed-image-attachments.ts:964`, since openclaw#130402). A model-chosen local PDF is not, so the item throws, and the catch-all failure code at `src/gateway/managed-image-attachments.ts:920` labels that refusal `delivery-failed`. That trust rule is deliberate and stays unchanged here; the wrong part is only showing it as a delivery failure after a confirmed delivery. ## Fix The source-reply mirror already holds the delivery fact. When the send has a concrete platform message id and the preview contains `attachment_error` blocks, the display sidecar replaces them with one line: "Attachment sent to the channel. Preview unavailable in chat history." - Sends without a platform receipt keep their current display. - Previews that succeed (images, trusted files) are unchanged. - The media reader, local-file trust and access checks are unchanged. - Only `openclawDisplayContent` (the Control UI display sidecar) changes. The canonical transcript message that replay and model context read is byte-identical to main (evidence below). ## Evidence Real Gateway + Control UI proof on this head (main twice, fix twice, real Chromium, after reload), with controls for an image preview and a send without a platform receipt, and the serialization-boundary check that the canonical transcript entry is byte-identical to main: openclaw#205932 (comment) @RaphLorr's original evidence reproduced the report twice on WeChat with OpenClaw 2026.11.10 (provider returned a platform message id; Control UI showed a failed card). - `src/infra/outbound/source-reply-mirror.test.ts` drives the real preview owner with a local PDF: the receipt case fails on main source and passes here (25/25); importer suites 89/89. - Production +13 lines, tests +38 net, against the merge base. ## Merge danger Two-way door. The change only alters what the display sidecar stores for newly mirrored confirmed sends; a revert restores the old card for new rows. Rows written while this is live keep the notice text. Blast radius: Control UI history for message-tool sends with a platform receipt whose preview fails. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 60ebf18)




Root cause:
src/infra/outbound/source-reply-mirror.ts:521builds the history preview for a message-tool send with the same owner used for replies that have not been delivered yet. When that preview cannot be prepared, itsattachment_errorblock (codedelivery-failed, "Not sent · Delivery failed. Try sending this file again.") was stored as-is, even though the channel had already confirmed the send with a platform message id.Thanks @RaphLorr for the report, the reproduction and the fix.
What Problem This Solves
When the
messagetool sends a local document to the current channel and the channel confirms it with a platform message id, Control UI could still show a red "Not sent" card for that file. People then resend a document the recipient already has.Why the preview fails: the preview owner only ingests a local non-image file when the reply payload is explicitly trusted (
src/gateway/managed-image-attachments.ts:964, since #130402). A model-chosen local PDF is not, so the item throws, and the catch-all failure code atsrc/gateway/managed-image-attachments.ts:920labels that refusaldelivery-failed. That trust rule is deliberate and stays unchanged here; the wrong part is only showing it as a delivery failure after a confirmed delivery.Fix
The source-reply mirror already holds the delivery fact. When the send has a concrete platform message id and the preview contains
attachment_errorblocks, the display sidecar replaces them with one line: "Attachment sent to the channel. Preview unavailable in chat history."openclawDisplayContent(the Control UI display sidecar) changes. The canonical transcript message that replay and model context read is byte-identical to main (evidence below).Evidence
Real Gateway + Control UI proof on this head (main twice, fix twice, real Chromium, after reload), with controls for an image preview and a send without a platform receipt, and the serialization-boundary check that the canonical transcript entry is byte-identical to main: #205932 (comment)
@RaphLorr's original evidence reproduced the report twice on WeChat with OpenClaw 2026.11.10 (provider returned a platform message id; Control UI showed a failed card).
src/infra/outbound/source-reply-mirror.test.tsdrives the real preview owner with a local PDF: the receipt case fails on main source and passes here (25/25); importer suites 89/89.Merge danger
Two-way door. The change only alters what the display sidecar stores for newly mirrored confirmed sends; a revert restores the old card for new rows. Rows written while this is live keep the notice text. Blast radius: Control UI history for message-tool sends with a platform receipt whose preview fails.