Skip to content

feat: show CSV attachments as a table in the chat file viewer - #206148

Merged
daniel-lxs merged 4 commits into
openclaw:mainfrom
daniel-lxs:openclaw-file-viewer-shows-csv
Nov 27, 2026
Merged

daniel-lxs merged 4 commits into
openclaw:mainfrom
daniel-lxs:openclaw-file-viewer-shows-csv

Conversation

@daniel-lxs

Copy link
Copy Markdown
Member

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/csv or a .csv file 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 main UI build and once with this branch.

Before:

Before: the CSV attachment opens as raw text

After:

After: the CSV attachment opens as a table with a View raw text button

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.ts gains one case (quoted comma, escaped quotes, a line break inside a field, CRLF, BOM, an empty cell, and the raw text toggle). It fails on main (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 as main, since the code loads with the lazily loaded detail panel.

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. labels Nov 26, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 26, 2026
@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

CSV 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.

  • Before: The viewer displays comma-separated text.
  • After: The viewer displays both records as table rows without column headers.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, bounded implementation with visible product proof, distinct regression coverage, and compatible existing storage.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after browser screenshots show a synthetic CSV uploaded through an isolated Gateway opening as a table in the existing attachment viewer; the body additionally reports raw-toggle and mobile-scroll verification.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: CSV columns are difficult to read as raw text, forcing users to download attachments into another application.
Reason: Readable tables provide clear value within the existing viewer, and maintainer authorship establishes direction without another product approval.

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: 112cd72d152a13bd0f474b506bd890b7493ecc6a

Before merge

None.

Findings

None.

Agent review details

How this fits together

Composer 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]
Loading

Technical review

Best 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

  • Structured-data attachment presentation changes intended behavior with a stated reason (fix(ui): render Markdown attachments in the sidebar #145555: The Markdown renderer deliberately kept ordinary text and structured-data attachments literal while preserving bounded fetching and downloads.)
  • Attachment reader lifecycle keeps the original intent (0ee5e4e: Solid async readers own loading, cancellation, retained content, and lifecycle cleanup.)
  • Upload MIME normalization and recovery keeps the original intent (fix(chat): restore large attachments without losing queued sends #92223: Parameterized attachments and supported-size payloads must serialize and recover without losing bytes or queued sends.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 0ee5e4e adds ui/src/pages/chat/components/chat-text-attachment.tsx:144 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0ee5e4e375dd; files: ui/src/pages/chat/components/chat-text-attachment.tsx)
  • Vyctor H. Brzezowski: Raw commit 9e21f72 adds src/gateway/chat-attachments.test.ts:258 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 9e21f72f4ca9; files: src/gateway/chat-attachments.test.ts)
  • Shakker: Raw commit 8bc3a82 adds ui/src/pages/chat/components/chat-text-attachment.tsx:51 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 8bc3a821e3bf; files: ui/src/pages/chat/components/chat-text-attachment.tsx)

PR surface

Source +173, Tests +119, Docs +6. Total +298 across 10 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 212 39 +173
Tests 3 121 2 +119
Docs 1 9 3 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 342 44 +298

Preflight source

Source 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 cluster

Relationship: same_root_cause
Canonical: #206147
Summary: This PR implements the paired CSV table-viewing request.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-11-26T20:23:54.884Z sha 204cf60 :: needs changes before merge. :: [P2] [P2] Preserve a final quoted empty CSV record
  • reviewed 2026-11-26T20:49:53.380Z sha 52d75ad :: passed. :: none
  • reviewed 2026-11-26T21:26:17.655Z sha d184153 :: blocked before merge. :: none

Reviewed November 26, 2026, 5:16 PM ET / 22:16 UTC (Revision 4).

@daniel-lxs

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 26, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: M and removed size: S labels Nov 26, 2026
@daniel-lxs

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Nov 26, 2026
@clawsweeper clawsweeper Bot removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Nov 26, 2026
@daniel-lxs

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Nov 26, 2026
@daniel-lxs
daniel-lxs merged commit b3bdfb5 into openclaw:main Nov 27, 2026
203 of 205 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 27, 2026
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.
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Show CSV attachments as a table in the Control UI

1 participant