Skip to content

fix(control-ui): audio and video replies show a download card when playback metadata is missing - #197290

Merged
obviyus merged 3 commits into
openclaw:mainfrom
masatohoshino:fix/control-ui-absent-playback
Nov 11, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
masatohoshino:fix/control-ui-absent-playback

Conversation

@masatohoshino

@masatohoshino masatohoshino commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #197289

What Problem This Solves

Fixes: the Control UI shows a download card instead of a player for assistant audio or video in a transcode-only format (AIFF, Ogg, FLAC, AMR, AVI, ...) when the Gateway published the reply without playback metadata, which happens when its media inspector is busy or a probe fails.

User Impact

User impact: such replies now play inline in the Control UI. When the metadata is missing, the Control UI asks the Gateway's playback route, which inspects the file then and either converts it or serves the original bytes. Apple clients have done the same since #191517.

Why This Change Was Made

resolveAttachmentSource decides the playback mode for every attachment consumer: the inline audio player, the Files sidebar and the video gallery. Before this change it defaulted a missing value to native. It now defaults managed outgoing media (/api/chat/media/outgoing/...) to transcode, matching the Apple fallback in #191517. Explicit playback metadata still wins, and non-managed sources keep native.

  • Requests: for an already-playable file, the only extra cost is one inspection request to the playback route, which then serves the original bytes.
  • Fixtures: the test fixtures that model probed native files now say playback: "native", the field the Gateway sets after a successful probe. Those fixtures share one constant, so the net test change is −5 (no allocation).
  • Docs: docs/nodes/media-playback.md now names the Control UI next to Apple clients.
  • Unaffected: in current sources, previews of user-sent videos do not use managed outgoing URLs, so they are unchanged.
  • Android: the Android client has the same native default (ChatMediaPlayer.kt). This change is limited to the Control UI, because Android needs its own device proof.

Evidence

Maintainer proof (built Gateway and Control UI in Chromium, the AIFF published while ffprobe was unavailable, main and fix plus controls): #197290 (comment). Screenshots: #197290 (comment)

Tested at 7347f442a3a948cdecab6539cf87fa47bad2607c (base upstream/main 04e941df29283d3c7a2e770c552a464e465f47ad).

Both builds ran the same steps. Each built checkout started one isolated Gateway through openclaw qa suite --provider-mode mock-openai, using a one-off flow scenario that was not committed:

  • The scenario sent one WebChat chat.send turn. The mock provider replied with MEDIA:<workspace>/playback-qa-clip.aiff, a synthetic 3-second 440 Hz sine AIFF.
  • While the reply was published, ffprobe failed on purpose (a shim in front of the real binary). The real ffprobe and ffmpeg handled every later request. This produces the same history block as a busy inspector: a managed audio block, audio/aiff, with no playback field.
  • Headless Google Chrome opened the Control UI served by that Gateway. It recorded the media requests and the openclaw-chat-audio-player state, then took a screenshot of the reply.

Before (base 04e941df292):

history block: audio, audio/aiff, playback (absent), /api/chat/media/outgoing/agent%3Aqa%3Amain/<id>/full
player: playback "native", <audio> present: false
text: "playback-qa-clip.aiff: Preview unavailable\nplayback-qa-clip.aiff\nAudio · 129 KB\nOpen"
media requests:
  GET  .../full                -> 206 audio/aiff

Before: download card

After (this PR):

history block: audio, audio/aiff, playback (absent), /api/chat/media/outgoing/agent%3Aqa%3Amain/<id>/full
player: playback "transcode", <audio> readyState 4, duration 3s, error null
text: "playback-qa-clip.aiff\n·\n129 KB\n0:00 / 0:03"
media requests:
  HEAD .../full?playback=1     -> 202 application/json (preparing)
  HEAD .../full?playback=1     -> 200 audio/mp4
  GET  .../full?playback=1     -> 206 audio/mp4

After: audio player

Observed result: with the same history block, the base read the original AIFF and fell back to the download card. The PR asked the playback route, waited for the rendition, and loaded a playable 3-second M4A.

Checks:

  • The touched tests ran with pnpm test <file> --maxWorkers=1. Wall times are in the table below.
  • 8 chat attachment and media UI test files ran on the head (149 tests). With the fix but without the fixture update, 4 tests in the 3 files with updated fixtures failed, because they modeled probed native files without the field.
  • The test files were typechecked at the head with test/tsconfig/tsconfig.core.test.ui-chat.json.
  • Also run at the head: changed-file lint as CI runs it, check-test-lines-ratchet against the base, oxfmt --check on the changed files, and git diff --check against the base.
  • The regression assertion fails on the base in 3 tests of chat-message-attachment-source.test.ts and passes on this branch.
  • The broad suites run in this PR's CI.
Test file --maxWorkers=1 wall
ui/src/pages/chat/components/chat-message-attachment-source.test.ts 2.0 s
ui/src/pages/chat/components/chat-message.attachments.test.tsx 3.2 s
ui/src/pages/chat/components/chat-video-gallery-source.test.ts 2.4 s
ui/src/pages/chat/chat-pane-embedded-panels.test.ts 4.4 s

Review: autoreview (Codex gpt-6.1-sol, thinking high, threshold P1) on base 04e941df29283d3c7a2e770c552a464e465f47ad and head 7347f442a3a948cdecab6539cf87fa47bad2607c returned scoped-clean with 0 findings. Priorities below P1 were not assessed. A pr-simplify pass made no edits: the change is one expression at the existing owner and adds no new path. Against the merge base it adds 5 production lines and 1 docs line; tests are net −5.

Not covered:

  • The busy inspector was modeled by a failing probe at publish time. A real PlaybackInspectionBusyError produces the same history block, but it was not triggered here.
  • Only Chrome and an AIFF audio clip were exercised. Video uses the same playback value and route, but this run did not capture it.
  • Android is not changed.

@clawsweeper

clawsweeper Bot commented Nov 11, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: XS labels Nov 11, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 11, 2026
@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Managed audio and video attachments without playback metadata use the Gateway’s existing playback route.

Example: An assistant sends a three-second AIFF while ffprobe is unavailable during publication.

  • Before: Chrome fetches the original audio/aiff and displays a download card.
  • After: The UI requests playback=1, waits for preparation, and plays the three-second M4A inline.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, useful fix with shipped-entry-point proof, preserved controls, and no actionable findings; pending CI remains the ordinary landing gate.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Built Gateway and Control UI in Chromium exercised an assistant AIFF published without playback metadata, then used real ffprobe/ffmpeg to prepare and play M4A; inspected screenshots and HTTP traces corroborate the result, with explicit native/transcode controls preserved. Production inputs are unchanged at the reviewed head. Metadata-less video and actual inspector saturation were not directly exercised.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Some assistant audio and video replies show a download card even though the Gateway can prepare a playable rendition.
Reason: Restores documented inline playback through existing owners without introducing configuration, storage, or public APIs.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a verified playback failure still present on current main, with convincing browser proof and no actionable findings. Exact-head CI remains pending.

Priority: P2
Reviewed head: 187081e8915121091691dd1062d57c23fd53fa40

Before merge

None.

Findings

None.

Agent review details

How this fits together

The attachment resolver supplies playback sources to inline players, the Files sidebar, and the video gallery; the Gateway owns inspection, conversion, and authorized byte delivery.

flowchart LR
  A[Assistant media attachment] --> B[Attachment source resolver]
  B --> C[Inline player or Files or gallery]
  C --> D[Gateway playback route]
  D --> E[Inspect and prepare rendition]
  E --> F[Original or playable media bytes]
  F --> C
Loading

Technical review

Best possible solution:

Land the focused resolver fallback after the existing exact-head CI gate passes.

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

The publication and resolver sources establish the failure path, and supplied built-Gateway Chromium traces reproduce it with a synthetic AIFF; this read-only review ran no target code.

Is this the best way to solve the issue?

This is the smallest complete fix: preserve authoritative playback metadata and route unknown managed media through the existing preparation owner shared by the affected UI consumers.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7154e4efb11b.

Provenance checked

  • Missing playback metadata fallback changes intended behavior with a stated reason (d60436a: The transcode-aware UI feature selected playback from metadata while retaining original downloads; the later Solid migration carried this fallback forward.)
  • Playback documentation keeps the original intent (cdfda39: Documented Apple clients recovering from absent metadata through the existing playback route; this PR extends that behavior to the Control UI.)
  • Native playback fixtures keeps the original intent (feat(ui): navigate expanded videos within a chat turn #154051: Gallery and sidebar tests protect ticket renewal, retry, and player continuity; explicit native metadata retains those scenarios under the corrected fallback.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vyctor H. Brzezowski: Raw commit be0519d adds ui/src/pages/chat/components/chat-message-attachment-source.ts:135 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: be0519d983fb; files: ui/src/pages/chat/components/chat-message-attachment-source.ts)

PR surface

Source +5, Tests -5, Docs +1. Total +1 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 6 1 +5
Tests 4 10 15 -5
Docs 1 3 2 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 19 18 +1

Preflight source

Source stale. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test LOC Production +6/−1; tests +10/−15 The small production increase documents and implements one fallback at the existing owner; fixture reuse reduces test code.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A bounded media-playback failure affects replies lacking optional metadata; downloading remains available.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 (1 earlier review cycle)
  • reviewed 2026-11-11T16:42:11.815Z sha 7347f44 :: needs maintainer review before merge. :: none

Reviewed November 11, 2026, 1:28 PM ET / 18:28 UTC (Revision 2).

@obviyus

obviyus commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

Proof with a built Gateway and the built Control UI in real Chromium (Playwright), in Docker (node:24.22.1 with Debian ffmpeg 5.1). Main is 04e941df (merge base). The fix is 7347f442; production and UI code on the pushed head 4e9c14a3 are identical to it.

How the AIFF lost its playback information: a stand-in model replied MEDIA:<workspace>/proof.aiff. While that reply was published, /usr/bin/ffprobe was unavailable, so the Gateway's media check really failed. chat.history stores the attachment with no playback field ("mimeType":"audio/aiff", /api/chat/media/outgoing/.../full). ffprobe was then restored, the control replies were sent, and the chat was opened in a fresh browser context.

Attachment (stored playback) Main Fix
proof.aiff (none) download card ("Open"); the browser fetched the original audio/aiff inline player; HEAD ?playback=1 returns 202 then 200 audio/mp4, GET ?playback=1 returns 206 audio/mp4; playing advances currentTime (1.33 s of 3 s)
probed.aiff (transcode) player, ?playback=1, audio/mp4 same
proof.mp3 (native; one sent with ffprobe unavailable and one with it available, both stored native) player, original audio/mpeg same
proof.mp4 (native) video player, original video/mp4 same

On main, the Gateway's playback route does convert the same metadata-less AIFF: a direct HEAD ?playback=1 returns 202 then 200 audio/mp4. The UI just never asks for it.

External (non-managed) links: their source check is unchanged (isManagedOutgoingMediaSource is false, so they stay native). This is covered by the gallery tests' https://example.com/first.mp4 fixture, which passes with the fix.

UI bundle: the changed chunk chat-message-attachment-source-*.js grows by 16 B gzip (2,356 to 2,372). The total gzip size of all Control UI JS is +455 B, which includes rebuilt chunk hashes.

Changes on top of the contributor commit: removed the test-lines allocation. The fixtures that model probed native files now share one native constant, and the duplicate first fixture is hoisted, so the net test change is 0 (+11/−11). The production change and docs are unchanged. The touched UI tests (42) and pnpm tsgo:test:ui pass.

Before (main) and after (fix) screenshots of the metadata-less AIFF reply are attached below.

@obviyus

obviyus commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

Screenshots: metadata-less AIFF reply, main (before) and fix (after).

Before (main): metadata-less AIFF reply shows a download card

After (fix): metadata-less AIFF reply shows the inline player

@obviyus

obviyus commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

Head is now 187081e8. It only changes tests: CI lint flagged a no-shadow on 4e9c14a3, and the Files player ticket test now uses the existing nativeAudio helper. The net test change is now −5 (+10/−15). Production code and docs are unchanged since the browser proof. The checks-ui (3/3) failure on 4e9c14a3 was chat-read-aloud.test.tsx "keeps native transcript speech with its current application context" (button.click on null). That test is flaky on main too: it failed in 2 of 6 local runs at the merge base with the same error, and in 1 of 3 at the head. It does not touch attachments.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 11, 2026
@clawsweeper clawsweeper Bot removed clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 11, 2026
@obviyus
obviyus merged commit 62f42dc into openclaw:main Nov 11, 2026
101 of 102 checks passed
@obviyus

obviyus commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

Landed in 62f42dc. Thanks @masatohoshino.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 12, 2026
…ayback metadata is missing (openclaw#197290)

fix(ui): play assistant media that arrives without playback metadata

When the Gateway published an assistant audio or video attachment without playback information, because its media check failed or the inspector was busy, the Control UI treated the file as natively playable. For formats a browser cannot play, such as AIFF, Ogg, FLAC, AMR and AVI, it showed a download card instead of using the Gateway's converting playback route, which Apple clients already use (openclaw#191517). Attachments without playback information now go through the playback route; attachments marked native or transcode, and external media links, are unchanged. No new UI text. Chat attachment chunk gzip grows by 16 B.

Evidence: a built Gateway and the built Control UI in real Chromium on node:24.22.1 with ffmpeg. A stand-in model replied with an AIFF while ffprobe was missing, so the Gateway's check really failed and the attachment was stored without playback information. On main the chat showed a download card and the browser fetched the original audio/aiff; with this change it shows the inline player, the playback route returns audio/mp4 and the clip plays. A transcode-marked AIFF, native MP3s and a native MP4 behave the same on both. Before and after screenshots: openclaw#197290 (comment). Tests are -5 net. Details: openclaw#197290 (comment).

Closes openclaw#197289. Thanks @masatohoshino.

Co-authored-by: Ayaan Zaidi <[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 P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS 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.

Control UI shows a download card for assistant audio/video published without playback metadata

2 participants