Repository navigation
feat: show CSV attachments as a table in the chat file viewer - #206148
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 changesCSV attachments gain table previews, an exact raw-text view, and support for explicitly headerless files. Example: Open names.csv containing Alice,42 and Bob,17 with text/csv; header=absent.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR adds a useful CSV reader through the existing attachment viewer, with no actionable correctness or security defect found. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherComposer attachments pass through upload serialization and Gateway media persistence; the existing Control UI attachment reader fetches bounded text and presents a table or the original text. flowchart LR
A[Composer attachment] --> B[Upload serialization]
B --> C[Gateway media owner]
C --> D[Transcript media metadata]
D --> E[Bounded attachment reader]
E --> F[CSV table or raw text]
Technical reviewBest possible solution: Keep CSV presentation within the existing bounded attachment viewer while preserving exact raw text and headerless metadata. Do we have a high-confidence way to reproduce the issue? Current-main source displays CSV through the literal-text branch, consistent with the supplied before screenshot; no reproduction was executed during this read-only review. Is this the best way to solve the issue? The change uses the existing fetch, presentation, and persistence owners, with bounded dependency-free parsing and raw fallback for unsupported input. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3495c164737f. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +173, Tests +119, Docs +6. Total +298 across 10 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. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 (3 earlier review cycles)Reviewed November 26, 2026, 5:16 PM ET / 22:16 UTC (Revision 4). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Show CSV chat attachments as tables and offer the original text in the attachment viewer. Preserve explicit headerless metadata, whitespace, and empty records. Use raw text for malformed or oversized tables.
* fix: preserve completed Claude tool calls in chat history * fix: preserve completed Claude tool calls in chat history OpenClaw-Publication: d3a267f1-3ba5-4fc9-a4dd-3968148f8eb1 (cherry picked from commit a27b4e6) Follow-ups: 49492d7 fix: align Control UI tooling and docs with task card removal (#207747) [not selected for this narrow backport]; cebbb78 fix: keep tagged silent replies out of chat (#207738) [not selected for this narrow backport]; d4e1305 fix: hide desktop Details when there is nothing to show (#205093) [not selected for this narrow backport]; 11b2cf0 fix: keep the selected Review file compact when the tree is open (#203825) [not selected for this narrow backport]; 4be636b feat(ui): offer Add to Home agent when Home sidebar is open (#207773) [not selected for this narrow backport]; f766de4 fix: surface favorites and recommended models in picker search (#201450) [not selected for this narrow backport]; 61a7661 improve(ui): remove suggested-task cards from Control UI (#199167) [not selected for this narrow backport]; 48cc039 fix: keep long process names compact above mobile output (#203767) [not selected for this narrow backport]; 9316f05 fix: show the first message when session naming fails (#205607) [not selected for this narrow backport]; aa4a68f fix(ui): show chat completions as activity rows (#201891) [not selected for this narrow backport]; ec209d0 fix(ui): link selection sessions to their source session (#206509) [not selected for this narrow backport]; 3f475cc fix(ui): keep pre-final assistant text visible after a completed turn (#140835) [not selected for this narrow backport]; 05ec989 fix: keep chat photo previews sharp within their byte limits (#206461) [not selected for this narrow backport]; b3bdfb5 feat(ui): preview CSV chat attachments as tables (#206148) [not selected for this narrow backport]; 6b3ccab fix: show Waiting and Resumed for Claude CLI subagent handoffs (#206158) [not selected for this narrow backport]; 762aa00 fix: keep dictation recording when switching tabs or applications [not selected for this narrow backport]; d3f9fca fix: keep similar subagent names distinct in compact rows (#203777) [not selected for this narrow backport]; 864efbb improve: keep composer error cards on one line (#204337) [not selected for this narrow backport]; d7ed2dd fix: stop replaying Claude progress updates in active chats (#203970) [not selected for this narrow backport]; 269f884 fix: show Claude CLI document uploads only once in chat (#203866) [not selected for this narrow backport]; 4708bac fix(ui): show Linear artwork in chat tool activity (#204414) [not selected for this narrow backport] Co-authored-by: RomneyDa <[email protected]>
Closes #206147
What Problem This Solves
When someone opens a CSV attachment in a Control UI chat, the side panel shows it as raw comma-separated text. Quoted fields, embedded commas and long rows run together, so any file with more than a few columns is hard to read without downloading it and opening it elsewhere.
User Impact
CSV attachments (
text/csvor a.csvfile name) open as a table: the first row is the header, each record is a row, and wide files scroll sideways. A "View raw text" button switches to the original text view, the same toggle Markdown attachments have. Copy and download work as before. Pasted text and other file types are unchanged.Why This Change Was Made
The file viewer already renders Markdown and HTML attachments in place, so CSV joins that same component. Parsing follows RFC 4180 (quoted fields may hold commas, doubled quotes and line breaks; CRLF and a leading BOM are handled) in about 40 lines, so no new dependency is needed. The table reuses the existing sidebar Markdown table styles; two CSS rules keep header labels on one line and keep line breaks inside a cell. Files stay under the existing 256 KB text preview limit.
Evidence
I uploaded a made-up CSV through the chat composer in an isolated Gateway (stand-in model) and opened it in the side panel, once with the
mainUI build and once with this branch.Before:
After:
In the same run on this branch, "View raw text" showed the original text and "Preview" brought the table back, and at a 390 px phone viewport the table opened in the bottom sheet and scrolled sideways.
Tests:
ui/src/pages/chat/components/chat-text-attachment.test.tsgains one case (quoted comma, escaped quotes, a line break inside a field, CRLF, BOM, an empty cell, and the raw text toggle). It fails onmain(no table rendered) and passes here; the file passes 40 of 40.pnpm tsgo:ui, oxlint and the formatter are clean on the changed files. The Control UI bundle budget reports the same numbers asmain, since the code loads with the lazily loaded detail panel.