Repository navigation
fix(ui): render Markdown attachments in the sidebar - #145555
Conversation
Render Markdown documents with the shared sanitized reader while preserving literal text previews and downloads. Repair the missing locator in the cloud-picker screenshot test found by validation. Co-authored-by: steipete <[email protected]>
|
🦞👀 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. Reviewed September 11, 2026, 11:57 PM ET / September 12, 2026, 03:57 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR renders Markdown attachments as formatted sidebar documents, initializes their asynchronous code controls, adds coverage and documentation, and repairs a screenshot-test locator. Merge readiness✅ Ready for maintainer review The previous lifecycle finding is resolved, and no remaining blocking defect was found. Current main still renders these attachments literally, so this PR remains useful. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI sidebar opens chat attachments from resolved media sources. Its bounded text reader now sends Markdown through the shared sanitized renderer while preserving literal previews for other text files and the original download. flowchart LR
A[Open chat attachment] --> B[Resolve media source]
B --> C[Bounded text reader]
C --> D{Markdown file or MIME type?}
D -->|Yes| E[Sanitized document and controls]
D -->|No| F[Literal text preview]
B --> G[Original download]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +32, Tests +115, Docs +1. Total +148 across 7 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep attachment loading in its existing bounded reader and reuse the shared sanitized Markdown renderer with one lifecycle owner for the loaded document. Do we have a high-confidence way to reproduce the issue? Not applicable as an established-behavior regression: existing source and tests intentionally display attachment text literally. The missing formatted preview is directly evident on main; no runtime tests were executed during this read-only review. Is this the best way to solve the issue? Yes. Extending the existing attachment component with the shared renderer avoids a competing parser, and the revised child-owned lifecycle addresses the asynchronous loading problem. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ec575b2ead3c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Give the attachment article ownership of the shared Markdown lifecycle and omit the parent directive for attachment content. Cover delayed fetch completion in Chromium, including overflow, disclosure linkage, expand and wrap controls. Co-authored-by: steipete <[email protected]>
|
Fixed the asynchronous Markdown lifecycle finding in 8fcc37c. The fetched attachment article now runs the shared The new Chromium regression failed before on the missing overflow state, then passed after a deferred response without a parent rerender. It verifies overflow observation, Exact commands: node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-browser.config.ts ui/src/pages/chat/components/chat-text-attachment.browser.test.ts
node scripts/run-vitest.mjs ui/src/pages/chat/components/chat-text-attachment.test.ts ui/src/pages/chat/components/chat-sidebar.test.ts ui/src/components/markdown-code-blocks.test.ts
node scripts/check-changed.mjs -- ui/src/pages/chat/components/chat-text-attachment.ts ui/src/pages/chat/components/chat-sidebar-content.ts ui/src/pages/chat/components/chat-text-attachment.browser.test.tsThe earlier hosted run had one unrelated real-Gateway approval-scenario timeout; its exact job log is under investigation while new-head CI runs. Public screenshot upload remains blocked as documented in the PR; inspected before/after captures were delivered in the requesting conversation. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* fix(ui): render Markdown attachments in the sidebar Render Markdown documents with the shared sanitized reader while preserving literal text previews and downloads. Repair the missing locator in the cloud-picker screenshot test found by validation. Co-authored-by: steipete <[email protected]> * fix(ui): initialize asynchronously loaded Markdown controls Give the attachment article ownership of the shared Markdown lifecycle and omit the parent directive for attachment content. Cover delayed fetch completion in Chromium, including overflow, disclosure linkage, expand and wrap controls. Co-authored-by: steipete <[email protected]> --------- Co-authored-by: steipete <[email protected]>
What Problem This Solves
Fixes an issue where users opening Markdown attachments in the chat side panel saw raw Markdown instead of a readable document.
Why This Change Was Made
The text-attachment preview now recognizes
.md,.markdown, and Markdown MIME types and uses the existing sanitized document renderer and sidebar styles. The asynchronously rendered attachment owns the shared Markdown lifecycle, so code overflow, expand, and wrap controls initialize as soon as the file loads. Ordinary text, HTML, logs, and structured-data attachments stay literal. The existing size limit, bounded fetch, download link, and cancellation behavior are unchanged; remote images remain disabled.Validation also found an existing undefined
retainedMachinelocator in the cloud-picker screenshot test. This PR binds the already-asserted machine locator and reuses it for the screenshot, restoring typecheck and capture-enabled proof without weakening assertions.User Impact
Markdown attachment headings, emphasis, lists, tables, and fenced code are readable without leaving chat. Users can still download the original file. Requested by Peter Steinberger.
Evidence
node scripts/run-vitest.mjs ui/src/pages/chat/components/chat-text-attachment.test.ts ui/src/pages/chat/components/chat-sidebar.test.ts— 84 passed initially; the expanded attachment/sidebar/code-block sibling run now passes 123 tests.OPENCLAW_CAPTURE_UI_PROOF=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/new-session-page.cloud-dispatch.e2e.test.ts -t "dispatches a cloud target before sending"— passed.aria-controls, expand and wrap verified without a parent rerender..txtcontrol. No mocked network or browser errors. Both before and after measured a 480px panel with no horizontal overflow.7cd907a60dc98eab94c493724d9c3bfcba90f73f; after used this candidate. Served entry assets changed fromindex-ROeVX9K-.jstoindex-CUp6qKz1.jsin the final candidate. The final screenshot is byte-identical to the inspected rendering-only screenshot. Both production UI builds passed.400 Bad Content-Length; the approved artifact-store fallback rejected its signed upload with an empty forwarded content-length. No proof images are committed to the product repository, and no failed/expired artifact URL is presented as working evidence.