Skip to content

feat: play YouTube videos inline in Control UI chats - #164576

Merged
steipete merged 4 commits into
mainfrom
codex/youtube-chat-embeds
Oct 3, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/youtube-chat-embeds

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Control UI replies had no supported inline YouTube player or cover preview.

User Impact

Assistants can emit [embed url="https://www.youtube.com/watch?v=VIDEO_ID" title="Video" /] to show a thumbnail card with click-to-load playback, timestamps, and an always-visible Open on YouTube link. Starting another card stops the previous video. Strict embed mode and narrow layouts keep external playback available.

Thumbnails contact Google before Play. The player loads from youtube-nocookie.com after activation and receives only the Control UI origin as its referrer. No new configuration or migration is required; generic external embeds and widget sandbox rules retain their existing behavior.

Why This Change Was Made

The existing embed shortcode gives agents a direct way to present videos without a new media tool, download, or rehosting step. A small hint in the Control UI prompt advertises it while preserving the stable prompt prefix and other channels' link behavior. The UI owns URL normalization and playback lifecycle; the privileged parent does not load YouTube's API script.

Evidence

  • Full build, changed-file checks, 133 focused parser/prompt/lifecycle/widget tests, and 58 existing style-policy tests passed. Independent review and ClawSweeper's review of the final head found no actionable findings.
  • Bundled Chromium E2E passed: lazy activation, origin-only referrer, timestamps, switching cards, close/focus, narrow fallback, external links, and missing thumbnail. The overlapping-player and narrow-overflow assertions each failed before their fixes. Fixture responses prove transport/lifecycle, not provider playback.
  • Real YouTube demo playback exceeded two seconds in WebKit and Chromium under the production CSP and parent referrer policy. Wheel input over the playing iframe scrolled the chat, and Close removed the player. Native fullscreen interaction was not verified.
  • Exact-head CI run passed for 88952a178850481708137dc553dce10323418100. Earlier CI exposed handler-binding and theme/cursor-policy errors; all were corrected and verified with their existing checks.
  • Test cost: pnpm test <focused files> --maxWorkers=1 took 94.52s cold across the prompt/UI shards; final prompt/lifecycle replay took 73.95s and widget siblings 9.37s. Style-policy coverage took 43.66s. Bundled E2E took 21.97s local wall; its new case took 2.04s in CI (2.20s for the file), within the existing shared job.
  • Build caveat: the non-blocking UI startup-size report measured 364.9 KiB gzip against a 364.7 KiB budget. No budget or baseline was changed. The initial build's freshness stamp rejected edits made while it ran; the final frozen-source build completed successfully.

The before/after screenshots use the same synthetic conversation and artwork. The narrow preview was also inspected in the user's gallery after refresh: 188px preview inside a 190px card, with matching button/card centers.

Before: the YouTube embed leaves an empty area

After: a YouTube thumbnail card with Play and an external watch link

@clawsweeper

clawsweeper Bot commented Oct 3, 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.

@steipete
steipete marked this pull request as ready for review October 3, 2026 22:14
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui agents Agent runtime and tooling size: L labels Oct 3, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 7:00 PM ET / 23:00 UTC (Revision 4).

ClawSweeper review

What this changes

Adds click-to-play YouTube cards to Control UI chat replies, with timestamp support, external watch links, playback cleanup, documentation, and assistant guidance.

Merge readiness

✅ Ready for maintainer review

Keep open: current main lacks the dedicated playback path, and the PR remains useful. No actionable correctness or security finding emerged from this re-review.

Priority: P2
Reviewed head: 88952a178850481708137dc553dce10323418100

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable feature with useful visual evidence and distinct lifecycle coverage; no blocking defect was found.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The verified repository-admin author is exempt from ordinary contributor proof. Inspected before/after screenshots demonstrate the chat preview; the captured body reports real browser playback, while the browser fixture separately covers requests and cleanup. No stored-data contract changes or material transfer of privileged authority were introduced.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The verified repository-admin author is exempt from ordinary contributor proof. Inspected before/after screenshots demonstrate the chat preview; the captured body reports real browser playback, while the browser fixture separately covers requests and cleanup. No stored-data contract changes or material transfer of privileged authority were introduced.
Evidence reviewed 10 items Pinned introduced change: Reviewed the merge-base-to-head introduction and corresponding production modules. The new route reuses the existing assistant-message embed contract, excludes MCP App previews, and keys playback by session and normalized watch URL.
Current main still needs the feature: The fetched main renderer routes assistant embeds through the existing Canvas/MCP paths and has no dedicated YouTube renderer. Generic external embedding requires its existing configuration and is not equivalent to the specialized preview and playback lifecycle.
Latest release context: Inspected the widget documentation at v2026.9.8; its media policy does not grant nested frames and uses a no-referrer policy. No shipped dedicated YouTube-card implementation was established.
Findings None None.
Security None None.

How this fits together

Control UI chat turns assistant embed shortcodes into inline content. The new renderer recognizes supported YouTube URLs and presents a preview, then loads the external player after user activation.

flowchart TD
  A[Assistant reply] --> B[Existing embed parser]
  B --> C[YouTube URL validation]
  C --> D[Thumbnail card]
  D --> E{Playback permitted and activated}
  E -->|Yes| F[YouTube privacy player]
  E -->|No| G[External watch link]
  F --> H[Card and session cleanup]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +429, Tests +331, Docs +52. Total +812 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 5 433 4 +429
Tests 4 331 0 +331
Docs 3 54 2 +52
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 818 6 +812

Review metrics

Metric Value Why it matters
Production versus test growth production +429 net lines; tests +331 lines Production growth is justified by the dedicated player, URL normalization, and playback lifecycle; coverage targets parser, rendering, and browser boundaries.

Technical review

Best possible solution:

Keep the dedicated lazy renderer within the existing embed contract, preserving strict-mode fallback, bounded provider URLs, and card-owned playback cleanup.

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

Not applicable as a feature request. Current-main source establishes the missing dedicated renderer; this read-only review did not execute playback.

Is this the best way to solve the issue?

Yes. Reusing the embed syntax with a narrow provider renderer avoids another model-facing tool and preserves the existing widget isolation boundary.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1a158881cd01.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded improvement to Control UI chat media playback, with no demonstrated urgent regression.
  • 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. Not applicable: The verified repository-admin author is exempt from ordinary contributor proof. Inspected before/after screenshots demonstrate the chat preview; the captured body reports real browser playback, while the browser fixture separately covers requests and cleanup. No stored-data contract changes or material transfer of privileged authority were introduced.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The verified repository-admin author is exempt from ordinary contributor proof. Inspected before/after screenshots demonstrate the chat preview; the captured body reports real browser playback, while the browser fixture separately covers requests and cleanup. No stored-data contract changes or material transfer of privileged authority were introduced.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head introduction and corresponding production modules. The new route reuses the existing assistant-message embed contract, excludes MCP App previews, and keys playback by session and normalized watch URL. (ui/src/pages/chat/components/widget-card.ts:573, 88952a178850)
  • Current main still needs the feature: The fetched main renderer routes assistant embeds through the existing Canvas/MCP paths and has no dedicated YouTube renderer. Generic external embedding requires its existing configuration and is not equivalent to the specialized preview and playback lifecycle. (ui/src/pages/chat/components/widget-card.ts, 1a158881cd01)
  • Latest release context: Inspected the widget documentation at v2026.9.8; its media policy does not grant nested frames and uses a no-referrer policy. No shipped dedicated YouTube-card implementation was established. Public docs: docs/tools/show-widget.md. (docs/tools/show-widget.md, fc23bc864e45)
  • Network and privilege boundaries: The parser accepts fixed HTTPS YouTube hosts and valid video IDs, rejects credentials and unsupported ports, and reconstructs provider URLs without copying arbitrary parameters. The player receives no widget prompt bridge or Gateway credentials; existing CSP permits its frame origin without a policy change. (ui/src/lib/chat/youtube-video.ts:31, 88952a178850)
  • Playback lifecycle and supplemental coverage: The component stops playback on disconnection, source changes, strict-mode changes, narrow layouts, and activation of another card. The browser test checks actual frame requests, origin-only referrers, absent authorization headers, switching cards, close/focus behavior, and fallback links using explicitly identified provider fixtures. These tests were inspected, not executed by this review. (ui/src/pages/chat/components/youtube-video-card.ts:157, 88952a178850)
  • Inspected visual evidence and captured runtime claims: Inspected both downloaded screenshots: the before image has an empty embed area; the after image shows the thumbnail, Play control, title, and external link in the same synthetic conversation. Captured body sourceRevision 959eb836ab400092ec63212e3e14337899266ff0c45e94ecb70b0a01455f2514 reports real YouTube playback in WebKit and Chromium under production CSP. The screenshots directly establish appearance, not provider playback or network diagnostics. (88952a178850)

Likely related people:

  • Peter Steinberger: Raw commit 668c062 adds ui/src/pages/chat/components/widget-card.ts:153 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 668c06211e6c; files: ui/src/pages/chat/components/widget-card.ts)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

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 (3 earlier review cycles)
  • reviewed 2026-10-03T22:19:38.146Z sha 363f9e8 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-03T22:27:28.409Z sha 73eba80 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-03T22:40:03.177Z sha 8521cd7 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit c758137 into main Oct 3, 2026
127 checks passed
@steipete
steipete deleted the codex/youtube-chat-embeds branch October 3, 2026 23:20
@steipete

steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
* feat: play YouTube videos inline in Control UI chats

* fix: keep narrow YouTube previews inside their cards

* fix: bind YouTube playback handler to the card

* fix: use Control UI tokens and link cursor styling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

1 participant