Skip to content

feat(claw-app): drive the cockpit video rail from PostHog remote config - #2103

Open
Dani Akash (DaniAkash) wants to merge 2 commits into
mainfrom
feat/cockpit-video-config
Open

feat(claw-app): drive the cockpit video rail from PostHog remote config#2103
Dani Akash (DaniAkash) wants to merge 2 commits into
mainfrom
feat/cockpit-video-config

Conversation

@DaniAkash

Copy link
Copy Markdown
Contributor

Follows the video-rail removal (#2097). Brings the cockpit video rail back, now controlled entirely from PostHog remote config instead of hardcoded in the bundle.

What

The "Learn BrowserClaw" rail lineup comes from a PostHog remote-config JSON payload (flag key cockpit-videos), not the app bundle. Edit the payload in PostHog to change which videos appear, no redeploy.

  • YouTube URLs only — the client parses the video id (watch / youtu.be / embed / shorts / live) and derives the thumbnail on the fly (i.ytimg.com/.../maxresdefault.jpg, falling back to hqdefault on error).
  • Tiles link out to YouTube in a new tab. A YouTube iframe cannot play from the extension origin, so there is no embed/lightbox.
  • Horizontally scrollable, and collapsible — the collapsed state persists to chrome.storage.local via WXT, so it stays collapsed across new tabs until the reader expands it again.
  • Hidden when the config lists no videos (so an empty videos: [] turns the section off from PostHog).

PostHog payload schema (author this as a non-encrypted remote-config flag cockpit-videos, 100% rollout)

{
  "heading": "Learn BrowserClaw",
  "videos": [
    { "url": "https://youtu.be/AF05B1O9nq8", "title": "Automate the web", "channel": "BrowserOS" },
    { "url": "https://www.youtube.com/watch?v=rIZ8OBHL7Zo" }
  ]
}

url is required; heading, title, channel, and a thumbnail override are optional. The payload is zod-validated; anything malformed, or a non-YouTube url, is dropped.

Privacy note (please review)

The cockpit's posthog wrapper deliberately disabled feature flags. This enables remote-config loading so the payload can be read. The only flag read is a global 100%-rollout config payload with no person targeting; the distinct id stays the anonymous install uuid, and all other privacy settings (no autocapture, url stripping, person_profiles: 'never') are unchanged. Because reading it requires PostHog to be initialised (which is consent-gated), the rail only appears for users with telemetry enabled — with telemetry off, the section is simply hidden. Flag me if you'd prefer the lineup decoupled from consent.

Verification

typecheck clean, biome clean. New cockpit-video-config.test.ts covers url parsing across forms, thumbnail derivation/override, dropping invalid urls, and the empty/malformed fallback. Existing cockpit/RecentActivity tests pass (the rail renders nothing without a config). The SavedStatsBand cross-file test flake is pre-existing and unrelated (fails alongside any cockpit test, passes in isolation and in the full CI run).

The Learn BrowserClaw rail lineup now comes from a PostHog remote-config JSON
payload (flag key cockpit-videos) instead of the app bundle. Videos are given as
YouTube URLs; the client derives each thumbnail (i.ytimg.com, hq fallback) and
tiles link out to YouTube in a new tab, since a YouTube iframe cannot play from
the extension origin. The rail scrolls horizontally and its collapsed state
persists to chrome.storage via WXT, so it stays collapsed until reopened. Hidden
when the config lists no videos.

Enables PostHog remote-config loading in the cockpit posthog wrapper (the one
flag read is a global 100% rollout payload with no person targeting); the
distinct id stays the anonymous install uuid. Adds zod-validated parsing of the
untrusted payload.
@DaniAkash
Dani Akash (DaniAkash) marked this pull request as ready for review August 5, 2026 11:12
@greptile-apps

greptile-apps Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR restores the cockpit’s video rail using a consent-gated PostHog remote-config payload instead of a bundled lineup.

  • Validates remote video metadata and supports common YouTube URL forms.
  • Adds collapsible, persistent UI with externally linked video cards and thumbnail fallback behavior.
  • Enables PostHog feature-flag payload loading while retaining the existing privacy-oriented analytics configuration.
  • Adds focused tests for payload validation, URL parsing, and thumbnail derivation.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code failure established.

The remote payload is validated before rendering, non-YouTube entries are excluded, disabled or unavailable telemetry produces an intentionally hidden rail, and the UI integration preserves the cockpit’s existing behavior when no valid configuration is available.

Important Files Changed

Filename Overview
packages/browseros-agent/apps/claw-app/components/cockpit/CockpitVideoRail.tsx Adds the collapsible, horizontally scrollable video rail, external YouTube cards, thumbnail fallback, and persisted collapse-state integration.
packages/browseros-agent/apps/claw-app/components/cockpit/cockpit-video-config.ts Defines and validates the remote payload, restricts videos to recognized YouTube URLs, and derives render-ready metadata.
packages/browseros-agent/apps/claw-app/components/cockpit/cockpit-video-config.hooks.ts Reads the initial PostHog payload and updates the lineup when remote configuration becomes available.
packages/browseros-agent/apps/claw-app/modules/analytics/posthog.ts Enables remote feature configuration and exposes guarded payload-reading and callback-subscription helpers.
packages/browseros-agent/apps/claw-app/components/cockpit/cockpit-videos.storage.ts Adds lazy WXT-backed local persistence for the rail’s collapsed state.
packages/browseros-agent/apps/claw-app/components/cockpit/cockpit-video-config.test.ts Covers supported YouTube URL forms, invalid entries, thumbnail overrides, defaults, and malformed payload handling.
packages/browseros-agent/apps/claw-app/screens/cockpit/Cockpit.tsx Mounts the new video rail beneath recent cockpit activity.

Sequence Diagram

sequenceDiagram
  participant User
  participant Cockpit
  participant Analytics
  participant PostHog
  participant Storage as chrome.storage.local
  participant YouTube

  Cockpit->>Analytics: Resolve telemetry consent
  alt Telemetry enabled
    Analytics->>PostHog: Initialize anonymous client
    PostHog-->>Cockpit: Deliver cockpit-videos payload
    Cockpit->>Cockpit: Validate payload and derive thumbnails
    User->>Cockpit: Collapse or expand rail
    Cockpit->>Storage: Persist collapsed state
    User->>YouTube: Open selected video in new tab
  else Telemetry disabled
    Cockpit->>Cockpit: Keep video lineup empty
  end
Loading

Reviews (1): Last reviewed commit: "feat(claw-app): drive the cockpit video ..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

✅ Tests passed — 2548/2552

Suite Passed Failed Skipped
agent 367/367 0 0
build 34/34 0 0
claw-app 299/299 0 0
claw-mcp 109/109 0 0
claw-onboard 87/87 0 0
claw-server-rust-quality passed 0 0
claw-server-rust 558/558 0 0
server-agent 313/313 0 0
server-api 170/170 0 0
server-browser 10/10 0 0
server-integration 10/10 0 0
server-lib 299/300 0 1
server-root 38/41 0 3
server-tools 254/254 0 0

passed = ran successfully but emits no JUnit counts (a lint/format gate).

View workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant