Skip to content

fix(ui): structure chat transcript attachments by kind - #127076

Merged
vyctorbrzezowski merged 80 commits into
mainfrom
brzezowski/chat-attachment-kinds
Aug 26, 2026
Merged

vyctorbrzezowski merged 80 commits into
mainfrom
brzezowski/chat-attachment-kinds

Conversation

@vyctorbrzezowski

@vyctorbrzezowski vyctorbrzezowski commented Aug 21, 2026 •

Copy link
Copy Markdown
Member

Size at a glance — production +2,250/−909 (net +1,341), tests +1,433/−804, tooling +669/−6. Before this PR the model could already send attachments, but the UI had no wiring, no design and no structure for them: files surfaced with no dedicated rendering, lifecycle or ownership. This PR builds that layer — per-type wiring (audio, video, documents, spreadsheets, images) plus the redesigned attachment surfaces around it (cards vs bounded previews, lazy loading, sidebar ownership).

Closes #127066

What problem this solves

In this PR, transcript attachments get one coherent presentation by kind. Non-image files use compact cards with a colored glyph, filename, type/size metadata, and the existing Download, Open, and Files actions. Raster images and SVGs keep the image/lightbox flow.

Owner decisions

  • HTML, PDF, CSV, document, audio, and video transcript attachments render as compact cards; the transcript does not embed document previews or media players.
  • Raster images and SVGs continue through the image lightbox.
  • Audio/video playback remains available in Files. The transcript player code was removed cleanly, so that direction can be revisited without retaining a parallel implementation.
  • The approved card design, glyphs, spacing, states, actions, and image lightbox are unchanged by the cleanup pass.

Planned follow-up

Inline previews for selected document types, including HTML, PDF, and CSV, remain a possible future direction and are intentionally outside this PR.

Implementation

  • Removes the obsolete document-preview component, HTML sandbox/isolation path, CSV/document preview rendering, transcript media players, preview lazy-load callbacks, related styles, and preview-only tests.
  • Keeps attachment rendering and icon ownership in the compact card path.
  • Separates attachment Files content from Detail content per sidebar slot, preserving both states across multi-column use.
  • Bounds same-origin SVG loading and reconnect behavior while retaining the existing safe cross-origin image path and fallback card.
  • Keeps the real-conversation fixture confined to scripts/control-ui-mock-attachments.ts; no mock fixture ships in production UI code.

Validation

  • Focused UI/UI-isolated/E2E suite: 704 tests passed across 12 files.
  • Changed-surface typecheck, lint, stylelint, formatting, i18n, assertion-safety, coercion-helper, dependency-pin, and script guards passed.
  • Production Knip scan: zero unused exports.
  • Dead-CSS audit plus manual ownership audit of all 24 added attachment selectors: zero attachment-preview orphans.
  • Nine recursive diff-review passes completed; final pass reported zero actionable findings.

The repository-wide unused-export scan could not be completed in this sparse worktree because resolving unrelated plugin modules would require an install, which was prohibited for this task. The production Knip lane and all changed-surface checks completed successfully.

Post-merge provenance

captured on merged main @ 1c1673c

Kind Dark Light
Image Image attachment in dark mode Image attachment in light mode
Document Document attachment card in dark mode Document attachment card in light mode
Audio Audio attachment card in dark mode Audio attachment card in light mode
Video Video attachment card in dark mode Video attachment card in light mode
SVG SVG attachment in dark mode SVG attachment in light mode

@clawsweeper

clawsweeper Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui scripts Repository scripts labels Aug 21, 2026
@vyctorbrzezowski vyctorbrzezowski self-assigned this Aug 21, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Aug 21, 2026
@vyctorbrzezowski
vyctorbrzezowski marked this pull request as ready for review August 21, 2026 07:00
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 21, 2026
@clawsweeper

clawsweeper Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 26, 2026, 8:44 AM ET / 12:44 UTC.

ClawSweeper review

What this changes

The branch adds type-aware chat attachment cards, safe SVG/image handling, and Files-panel rendering for transcript attachments.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 5 items remain

Keep this PR open: it replaces current inline transcript audio/video playback with a Files-only path, contradicting the linked bug’s expected behavior and regressing the default chat-reading flow.

Priority: P1
Reviewed head: ae4c99308297138b01f65505c30d62273ace46ab
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The attachment work is substantial, but a source-proven default-path media regression blocks merge readiness.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable: this PR is authored by a repository MEMBER; the visible current blocker is a source-proven compatibility regression.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable: this PR is authored by a repository MEMBER; the visible current blocker is a source-proven compatibility regression.
Evidence reviewed 6 items Current-main media behavior: Current main renders audio and video transcript attachments with dedicated player elements once their source is available.
Proposed regression: The branch routes every non-image attachment through the compact-card return path, including audio and video.
Regression encoded in test: The added parameterized test covers audio and video and explicitly asserts that no audio or video element is rendered.
Findings 1 actionable finding [P1] Preserve inline audio and video playback
Security None None.

Live Verification

Command: pnpm dev:ui:mock -- --fixture attachments --port 5173

Result: FAIL (failed) — step 1 run pnpm dev:ui:mock -- --fixture attachments --port 5173: previous terminal command was still running after 30 seconds: "pnpm dev:ui:mock -- --fixture attachments --port 5173"

$ node --import tsx scripts/control-ui-mock-dev.ts -- --fixture attachments --port 5173
[control-ui-mock] http://127.0.0.1:5173/chat
[control-ui-mock] board fixture: http://127.0.0.1:5173/__fixtures/board/

Assertions:

  • FAIL expect_output: [control-ui-mock]

How this fits together

Control UI classifies transcript attachment metadata and renders images, media, and files in the chat thread. Attachment actions can then open a side-panel view or download the resolved media source.

flowchart LR
A[Chat transcript] --> B[Attachment extraction]
B --> C[Type classification]
C --> D[Transcript card or player]
D --> E[Files side panel]
D --> F[Image lightbox]
E --> G[Resolved media playback]
Loading

Decision needed

Question Recommendation
Should Control UI intentionally replace direct transcript audio/video playback with Files-panel-only playback? Preserve inline playback: Keep the new attachment-card system but retain the current transcript audio and video player path.

Why: Current main and the linked report establish direct transcript playback as existing behavior, while this PR expressly removes it; that user-experience tradeoff requires an owner decision.

Before merge

  • Preserve inline audio and video playback (P1) - Current main renders available transcript media through the dedicated audio/video players, but this generic card path now covers both kinds and the new test asserts that no player exists. The Files action adds a second path; it does not preserve direct playback on the default transcript surface required by the linked report.
  • Resolve merge risk (P1) - Merging would remove a current default-path capability—playing audio or video directly from the transcript—and require an extra Files-panel interaction instead.
  • Resolve merge risk (P1) - The PR adds net +1,341 production lines for a fix; retain existing player composition rather than making the side panel a parallel media path.
  • Complete next step (P2) - A UI owner must resolve the Files-only versus direct-playback product choice before any repair is automated.

Findings

  • [P1] Preserve inline audio and video playback — ui/src/pages/chat/components/chat-message-attachments.ts:591-607
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production vs test LOC production +2,250/−909 (net +1,341); tests +1,433/−804 The substantial production growth changes established transcript media behavior, so preserving the existing player path is important before merge.

Stored data model

Persistent data-model change detected: unknown-truncated-pull-files, vector/embedding metadata: ui/src/pages/chat/chat-view.test.ts, vector/embedding metadata: ui/src/pages/chat/components/chat-video-player.test.ts. Confirm migration or upgrade compatibility proof before merge.

Mantis proof suggestion

A redacted Control UI chat capture would directly show whether audio/video remain playable in the transcript and whether document cards retain their actions. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis web UI chat proof: verify and capture whether audio and video attachments remain directly playable in the transcript while document cards still open and download.

Merge-risk options

Maintainer options:

  1. Retain direct transcript playback (recommended)
    Restore the existing audio/video player rendering while keeping document cards and Files-side-panel behavior.
  2. Approve the Files-only interaction
    Accept the compatibility change only after the UI owner records that transcript playback is intentionally being removed.

Technical review

Best possible solution:

Keep the type-aware card treatment for documents while preserving inline audio/video players in the transcript, unless the relevant UI owner explicitly accepts the Files-only product change.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: current main sends available audio/video attachments to player elements, while this head instead returns a compact card and its test asserts that no player exists.

Is this the best way to solve the issue?

No: a Files-only card is not the best repair because it removes established transcript playback; retain the player composition alongside the card treatment.

Full review comments:

  • [P1] Preserve inline audio and video playback — ui/src/pages/chat/components/chat-message-attachments.ts:591-607
    Current main renders available transcript media through the dedicated audio/video players, but this generic card path now covers both kinds and the new test asserts that no player exists. The Files action adds a second path; it does not preserve direct playback on the default transcript surface required by the linked report.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7b1e562b8638.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Not applicable: this PR is authored by a repository MEMBER; the visible current blocker is a source-proven compatibility regression.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove merge-risk: 🚨 security-boundary: Current PR review merge-risk labels are merge-risk: 🚨 compatibility.
  • remove status: 📣 needs proof: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P1: The patch removes direct playback from the default transcript path for existing audio and video attachments.
  • merge-risk: 🚨 compatibility: Existing users who play media directly in chat would instead need to navigate through Files after merge.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Not applicable: this PR is authored by a repository MEMBER; the visible current blocker is a source-proven compatibility regression.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Introduced the first-class Control UI audio/video player feature that this branch removes from the transcript path. (role: feature introducer; confidence: high; commits: 7a4649ceb39f, d60436a4eee2; files: ui/src/pages/chat/components/chat-audio-player.ts, ui/src/pages/chat/components/chat-video-player.ts, ui/src/pages/chat/components/chat-message-attachments.ts)
  • sunlit-deng: Current-main blame assigns the audio/video transcript rendering branch to this recent attachment-surface commit. (role: recent area contributor; confidence: high; commits: 87b93b53036f; files: ui/src/pages/chat/components/chat-message-attachments.ts, ui/src/pages/chat/components/chat-message-media.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Restore direct transcript audio/video playback or obtain an explicit owner decision accepting its removal.
  • Capture a current-head Control UI attachment fixture after the final interaction model is settled.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (33 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-25T22:01:23.156Z sha e4a520edcc3fb69dd2af81930403ede7e021e6a2 :: found issues before merge. :: [P1] Respect the image CSP for remote SVG attachments
  • reviewed 2026-08-25T22:58:42.114Z sha f6acce6 :: found issues before merge. :: [P1] Avoid CSP-blocked remote SVG sources
  • reviewed 2026-08-26T00:32:08.230Z sha 43043f7 :: found issues before merge. :: [P1] Keep remote SVGs within the served image CSP
  • reviewed 2026-08-26T06:34:15.528Z sha d15d25480302d0f20f409d8ef5f93dc5745e0425 :: found issues before merge. :: [P1] Keep CDN SVGs within the served image CSP
  • reviewed 2026-08-26T08:10:47.784Z sha d15d25480302d0f20f409d8ef5f93dc5745e0425 :: needs changes before merge. :: [P1] Keep remote SVGs within the served image policy
  • reviewed 2026-08-26T09:58:58.798Z sha 502eeaa :: found issues before merge. :: [P1] Classify remote SVGs from their source URL
  • reviewed 2026-08-26T10:28:58.528Z sha 0d57085 :: needs real behavior proof before merge. :: [P1] Revalidate authority after the Workshop idle delay
  • reviewed 2026-08-26T12:20:46.451Z sha fc4b237 :: needs real behavior proof before merge. :: [P1] Preserve the foreground runtime tool allowlist for delayed reviews | [P2] Keep audio and video playable in the transcript

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 22, 2026
@vyctorbrzezowski
vyctorbrzezowski force-pushed the brzezowski/chat-attachment-kinds branch from d74c186 to e62b8b8 Compare August 23, 2026 13:25
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 23, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the scripts Repository scripts label Aug 23, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 23, 2026
@vyctorbrzezowski

vyctorbrzezowski commented Aug 23, 2026 •

Copy link
Copy Markdown
Member Author

Light mode — same attachment fixture and PR head (3506c5a5a576ca06708d1b75564d9626a03e4d02).

Desktop light
File families
Desktop light file attachment families
Images
Desktop light standalone image attachments
HTML preview
Desktop light HTML attachment preview
Audio preview
Desktop light audio attachment preview
Video preview
Desktop light video attachment preview
Mobile light
File families
Mobile light file attachment families
Images
Mobile light standalone image attachments
HTML preview
Mobile light HTML attachment preview
Audio preview
Mobile light audio attachment preview
Video preview
Mobile light video attachment preview

@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Merged via squash.

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 maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chat transcript attachments need type-aware cards and stable image actions

1 participant