Repository navigation
Conversation
Since openclaw#184098 the keyed Claude CLI row holds only the final native message and narration comes from the native rows. Webchat media enrichment still rewrote that row's display with the delivered caption, which joins every narration block of the run, so replies with MEDIA showed their narration twice in chat history. A row that mirrors one native message now consumes a delivered caption that ends with its own text, and keeps only that text around its media. Refs openclaw#123792
|
🦞👀 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 changesThis PR prevents media enrichment from copying earlier Claude CLI narration into the final answer’s display row. Example: A Claude CLI turn says “NARRATION_image_1: checking notes.” before returning “FINAL_image_1: here is the result.” with an image.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a verified native-Claude media display bug that remains on current main, with convincing runtime proof and no actionable findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway combines prepared delivery captions and managed media with canonical assistant transcript rows, then exposes their display projection through chat history to clients. flowchart LR
A[Native Claude messages] --> B[Canonical final row]
C[Prepared caption and media] --> D[Gateway display rewrite]
B --> D
D --> E[Transcript display projection]
E --> F[Chat history and Control UI]
Technical reviewBest possible solution: Use the existing display-rewrite owner to consume the aggregate caption for native final rows while preserving authored text, media placement and original transcript content. Do we have a high-confidence way to reproduce the issue? Supplied built-product evidence reproduces the image-only duplication on frozen main and removes it on the reviewed candidate; source inspection confirms current main retains the responsible comparison. Is this the best way to solve the issue? The patch is the smallest complete repair for the scoped new-turn bug: it extends existing caption consumption using the established native-row identity and preserves the original media-placement mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1054918a3a8c. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +9, Tests 0. Total +9 across 2 files. Added test files: 0. 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. 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 HistoryReview history (1 earlier review cycle)
Reviewed October 30, 2026, 9:45 AM ET / 13:45 UTC (Revision 2). |
Independent shipped-entry-point reproduction and repair proofScoped bug: new completed native-Claude image replies repeat earlier narration during the existing webchat display rewrite. This is not a new narration feature or a historical-transcript cleanup. Production changes only display-caption consumption; original model-facing content, prompts, SDK, config and runtime execution contracts are untouched. Frozen main Actual chat.send → real native ToolSearch → real mcp__openclaw__read of task-owned notes → final reply, with/without MEDIA image. Provider receipts confirm actual tool results. Real chat.history and Chromium reload of shipped sidebar session URLs expose every native row. No transcript seeding, injected chat events, mocked Gateway/WebSocket or private rewrite invocation as runtime proof.
All eight native turns completed successfully. Both snapshots retain four assistant rows per turn (including native tool/discovery rows), original narration, final answer and attachment ordering; candidate removes only the copied narration from the final row's display. The image fixture is a decoded1×1 white PNG, displayed as the ordinary attachment tile; no claim of complex image fidelity. Inspected native Chromium before/after screenshots Focused SQLite transcript owner suite: final regression17/17 pass; same consolidated cases on frozen main3 intended failures/14 pass, exposing retained duplicate caption. Formatting passes. Whole PR production+15/-6; tests+3/-3 net0. Reused signed-caption/media-order/replay matrix instead of67 new fixture lines; original-content immutability and lifecycle/authorization controls remain. No new test files or SDK exports. Two-way door: revert restores former display rewriting without migration. Blast radius native-identity webchat media final-row display only. Historical already-written duplicates and unrelated live-stream issues remain outside this focused bug fix; this PR does not claim to close the broader #123792. Credit @holgergruenhagen. Earlier setup attempts lacked canonical native-history discovery or the approved CONNECT credential route and are not presented as product verdicts. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 41e20da. Thanks @holgergruenhagen. CLI narration no longer repeats in image replies in chat history. |
…penclaw#188333) fix(cli): don't repeat CLI narration in the image reply of chat history Related: openclaw#123792 (this fixes new turns; duplicates already stored in old history are not changed). When a CLI-backend turn (for example Claude Code) narrated, used a tool and then replied with an image, media enrichment copied the aggregate caption into the final image message. The earlier narration therefore showed twice in chat history and the Control UI. The final image message now keeps only its own text. Display only: the original model content, prompts and config are unchanged. Evidence: built Gateway and Control UI, real Claude Code through a trusted-CA HTTPS CONNECT fixture with a synthetic managed profile, real tool execution and a Chromium reload. In the narration, read and image-reply case, main showed the narration twice and this change showed it once, twice per ref, with one image on both. A text-only turn showed one narration on both refs. chat.history and the UI agreed. Details and screenshots: openclaw#188333 (comment). Thanks @holgergruenhagen. Co-authored-by: Ayaan Zaidi <[email protected]>
Delivered caption blocks carry no MEDIA lines on the real path, so only the appended usage footer stops the openclaw#188333 suffix match. Keep the footer-aware match and footer retention in a small caption helper, drop the delivered-side MEDIA re-normalization, fold the regression into the openclaw#188333 enrichment test, and remove the test-lines allocation.
…d images (#195959) Root cause: `src/gateway/server-methods/chat-transcript-persistence.ts:180` compares each delivered text block with the authored caption after only `sanitizeAssistantDisplayText`. When `messages.responseUsage` is on, delivery appends the usage footer to that block, so neither the exact match nor the #188333 native-mirror suffix match fires. The final image row keeps the narration-prefixed aggregate as its display text. Closes #195857 ## What Problem This Solves In the Control UI, a claude-cli reply that narrates, runs tools and then sends images with `MEDIA:` lines repeated the narration at the top of the image reply. This happened when the usage footer (`messages.responseUsage`) was on. #188333 fixed the same duplication without the footer. ## What changes - A claude-cli image reply with the usage footer on now shows the narration once, in its own native rows. The reply bubble shows the caption, the footer and the images. - The caption match ignores this payload's exact `responseUsageLine` at the end of the delivered block. When it consumed the footer, it adds the footer back under the rebuilt caption. - Replies without a footer, replies without images and non-claude-cli runtimes are unchanged (proof below). ## Adoption note Thanks @Marvinthebored for the report and the fix. Your four commits are kept as they were. On top of them, one commit reduces the change to what the real case needs: - Delivered blocks carry no `MEDIA:` lines on this path, so the extra `MEDIA:` normalization of delivered blocks is gone. Only the footer stopped the match. - The fenced-`MEDIA:` and authored-footer cases are gone; they have no observed occurrence. - The regression is now one usage row in the existing #188333 enrichment test. The 40-line table test and `config/test-lines-allocations/195857-native-media-captions.txt` are removed. - The helper stays in `chat-assistant-caption.ts`, because `chat-transcript-persistence.ts` is at its 700-line cap. Production +67 -11 against the merge base (the head before was +74 -13). Tests +17 -7. ## Evidence The built Gateway and Control UI ran in a secretless Docker container, with real Chromium driving the chat composer. A stand-in `claude` emits Claude Code 2.1.330 stream-json: narration, Bash, narration, Bash, then a caption with 1 or 4 `MEDIA:` images. `messages.responseUsage=full`. Main ran twice and this PR ran twice. Each run covered three controls: no footer, no images, and the embedded runtime. Results are in the proof comment, which is linked below. Regression: the new usage row fails with the base `chat-transcript-persistence.ts` (1 failed, 17 passed) and passes on this head. Proof comment (table and screenshots): #195959 (comment) Co-authored-by: phone-build <phone-build@localhost> Co-authored-by: Ayaan Zaidi <[email protected]>
…d images (openclaw#195959) Root cause: `src/gateway/server-methods/chat-transcript-persistence.ts:180` compares each delivered text block with the authored caption after only `sanitizeAssistantDisplayText`. When `messages.responseUsage` is on, delivery appends the usage footer to that block, so neither the exact match nor the openclaw#188333 native-mirror suffix match fires. The final image row keeps the narration-prefixed aggregate as its display text. Closes openclaw#195857 ## What Problem This Solves In the Control UI, a claude-cli reply that narrates, runs tools and then sends images with `MEDIA:` lines repeated the narration at the top of the image reply. This happened when the usage footer (`messages.responseUsage`) was on. openclaw#188333 fixed the same duplication without the footer. ## What changes - A claude-cli image reply with the usage footer on now shows the narration once, in its own native rows. The reply bubble shows the caption, the footer and the images. - The caption match ignores this payload's exact `responseUsageLine` at the end of the delivered block. When it consumed the footer, it adds the footer back under the rebuilt caption. - Replies without a footer, replies without images and non-claude-cli runtimes are unchanged (proof below). ## Adoption note Thanks @Marvinthebored for the report and the fix. Your four commits are kept as they were. On top of them, one commit reduces the change to what the real case needs: - Delivered blocks carry no `MEDIA:` lines on this path, so the extra `MEDIA:` normalization of delivered blocks is gone. Only the footer stopped the match. - The fenced-`MEDIA:` and authored-footer cases are gone; they have no observed occurrence. - The regression is now one usage row in the existing openclaw#188333 enrichment test. The 40-line table test and `config/test-lines-allocations/195857-native-media-captions.txt` are removed. - The helper stays in `chat-assistant-caption.ts`, because `chat-transcript-persistence.ts` is at its 700-line cap. Production +67 -11 against the merge base (the head before was +74 -13). Tests +17 -7. ## Evidence The built Gateway and Control UI ran in a secretless Docker container, with real Chromium driving the chat composer. A stand-in `claude` emits Claude Code 2.1.330 stream-json: narration, Bash, narration, Bash, then a caption with 1 or 4 `MEDIA:` images. `messages.responseUsage=full`. Main ran twice and this PR ran twice. Each run covered three controls: no footer, no images, and the embedded runtime. Results are in the proof comment, which is linked below. Regression: the new usage row fails with the base `chat-transcript-persistence.ts` (1 failed, 17 passed) and passes on this head. Proof comment (table and screenshots): openclaw#195959 (comment) Co-authored-by: phone-build <phone-build@localhost> Co-authored-by: Ayaan Zaidi <[email protected]>
…d images (#195959) Root cause: `src/gateway/server-methods/chat-transcript-persistence.ts:180` compares each delivered text block with the authored caption after only `sanitizeAssistantDisplayText`. When `messages.responseUsage` is on, delivery appends the usage footer to that block, so neither the exact match nor the #188333 native-mirror suffix match fires. The final image row keeps the narration-prefixed aggregate as its display text. Closes #195857 ## What Problem This Solves In the Control UI, a claude-cli reply that narrates, runs tools and then sends images with `MEDIA:` lines repeated the narration at the top of the image reply. This happened when the usage footer (`messages.responseUsage`) was on. #188333 fixed the same duplication without the footer. ## What changes - A claude-cli image reply with the usage footer on now shows the narration once, in its own native rows. The reply bubble shows the caption, the footer and the images. - The caption match ignores this payload's exact `responseUsageLine` at the end of the delivered block. When it consumed the footer, it adds the footer back under the rebuilt caption. - Replies without a footer, replies without images and non-claude-cli runtimes are unchanged (proof below). ## Adoption note Thanks @Marvinthebored for the report and the fix. Your four commits are kept as they were. On top of them, one commit reduces the change to what the real case needs: - Delivered blocks carry no `MEDIA:` lines on this path, so the extra `MEDIA:` normalization of delivered blocks is gone. Only the footer stopped the match. - The fenced-`MEDIA:` and authored-footer cases are gone; they have no observed occurrence. - The regression is now one usage row in the existing #188333 enrichment test. The 40-line table test and `config/test-lines-allocations/195857-native-media-captions.txt` are removed. - The helper stays in `chat-assistant-caption.ts`, because `chat-transcript-persistence.ts` is at its 700-line cap. Production +67 -11 against the merge base (the head before was +74 -13). Tests +17 -7. ## Evidence The built Gateway and Control UI ran in a secretless Docker container, with real Chromium driving the chat composer. A stand-in `claude` emits Claude Code 2.1.330 stream-json: narration, Bash, narration, Bash, then a caption with 1 or 4 `MEDIA:` images. `messages.responseUsage=full`. Main ran twice and this PR ran twice. Each run covered three controls: no footer, no images, and the embedded runtime. Results are in the proof comment, which is linked below. Regression: the new usage row fails with the base `chat-transcript-persistence.ts` (1 failed, 17 passed) and passes on this head. Proof comment (table and screenshots): #195959 (comment) Co-authored-by: phone-build <phone-build@localhost> Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 935d07d)
…d images (#195959) Root cause: `src/gateway/server-methods/chat-transcript-persistence.ts:180` compares each delivered text block with the authored caption after only `sanitizeAssistantDisplayText`. When `messages.responseUsage` is on, delivery appends the usage footer to that block, so neither the exact match nor the #188333 native-mirror suffix match fires. The final image row keeps the narration-prefixed aggregate as its display text. Closes #195857 ## What Problem This Solves In the Control UI, a claude-cli reply that narrates, runs tools and then sends images with `MEDIA:` lines repeated the narration at the top of the image reply. This happened when the usage footer (`messages.responseUsage`) was on. #188333 fixed the same duplication without the footer. ## What changes - A claude-cli image reply with the usage footer on now shows the narration once, in its own native rows. The reply bubble shows the caption, the footer and the images. - The caption match ignores this payload's exact `responseUsageLine` at the end of the delivered block. When it consumed the footer, it adds the footer back under the rebuilt caption. - Replies without a footer, replies without images and non-claude-cli runtimes are unchanged (proof below). ## Adoption note Thanks @Marvinthebored for the report and the fix. Your four commits are kept as they were. On top of them, one commit reduces the change to what the real case needs: - Delivered blocks carry no `MEDIA:` lines on this path, so the extra `MEDIA:` normalization of delivered blocks is gone. Only the footer stopped the match. - The fenced-`MEDIA:` and authored-footer cases are gone; they have no observed occurrence. - The regression is now one usage row in the existing #188333 enrichment test. The 40-line table test and `config/test-lines-allocations/195857-native-media-captions.txt` are removed. - The helper stays in `chat-assistant-caption.ts`, because `chat-transcript-persistence.ts` is at its 700-line cap. Production +67 -11 against the merge base (the head before was +74 -13). Tests +17 -7. ## Evidence The built Gateway and Control UI ran in a secretless Docker container, with real Chromium driving the chat composer. A stand-in `claude` emits Claude Code 2.1.330 stream-json: narration, Bash, narration, Bash, then a caption with 1 or 4 `MEDIA:` images. `messages.responseUsage=full`. Main ran twice and this PR ran twice. Each run covered three controls: no footer, no images, and the embedded runtime. Results are in the proof comment, which is linked below. Regression: the new usage row fails with the base `chat-transcript-persistence.ts` (1 failed, 17 passed) and passes on this head. Proof comment (table and screenshots): #195959 (comment) Co-authored-by: phone-build <phone-build@localhost> Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 935d07d) Companion audit: No later follow-up found. Match only against the unformatted caption while retaining stable dispatch/persistence ownership. Release adaptation: Carry usage metadata through existing dispatch and enrichment; leave delivered text and replay IDs untouched. Co-authored-by: RomneyDa <[email protected]>


What Problem This Solves
Completed native Claude CLI replies with MEDIA images repeat earlier narration in reloaded webchat. The keyed final row contains only the final native message, but media enrichment adds the run's combined narration/final caption back to that row.
This focused new-turn display bug follows #184098. Related broader issue #123792 also tracks historical duplicates; this PR does not claim to repair or close those separate cases.
Solution
Consume the already-delivered aggregate caption when a native-identity row's own authored text is its line-delimited suffix. Preserve original message/model content and existing authored media placement. No prompt/model-facing text, SDK, config or feature additions. Credit @holgergruenhagen.
Evidence
Independent built Gateway + built Control UI, real native Claude Code and Chromium, inspected before/after screenshots.
Main twice shows narration twice in both actual chat.history and reloaded UI for image replies; candidate twice shows it once with one decoded image. Text-only narration/tool/final controls remain once on both. Eight successful actual native turns used real ToolSearch/read through a trusted-CA HTTPS CONNECT fixture and synthetic task-only managed profile; no real provider credentials or outside inference, and no fabricated Gateway/history messages.
Final SQLite owner regression17/17 passes; frozen main3 intended failures/14 passes. Formatting passes. Reused existing signed-caption/media/replay matrix: tests+3/-3 net0; production+15/-6. Original-content immutability assertions remain.
Merge risk
Two-way door: revert restores former display captions, no migration. Blast radius native-identity webchat media final-row display only; original model content, channels' delivered text and historical storage remain unchanged.