Skip to content

feat(artifacts): reuse shared preview host for Artifacts pane - #27605

Merged
teamleaderleo merged 30 commits into
feat-cmux-nextfrom
lane/artifacts-shared-host-seam
Nov 5, 2026
Merged

teamleaderleo merged 30 commits into
feat-cmux-nextfrom
lane/artifacts-shared-host-seam

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Status: brought current with feat-cmux-next (clean merge at d2869d7). One semantic conflict with #29837's passive-frame contract: its C++ test asserted the Artifacts page never loads the bootstrap, which is exactly what this PR admits; 48f3129 updates that assertion (allowed for an empty direct child, still refused for a srcdoc child). Gates at the head: fleet compile-check --app passed (job 8e05f4a5206e8c69f2bc6254), shared-preview and artifact-html web tests 17/17 and tsc clean, test-cmux-page-path-cpp.sh passes; fleet Swift suites PageArtifactFrameTests, PageArtifactsParentTests, ChromiumPageHostBridgeTests, ArtifactsPageProviderTests all passed (step 6eff5d24834aa7cdfe72d8fb at d2869d7, whose Swift tree is identical to 48f3129); independent review SHIP at 48f3129. Nothing mounts ArtifactPreview on the Artifacts page yet: the consumer PR also needs frame-src cmux-page://cmux.agent/__artifact on the artifacts PageDescriptor.

Leo, 2026-11-05, on the remaining Artifacts PRs: "Yes, push them".

#26286 merged; this branch now merges feat-cmux-next directly.

The read-only Artifacts pane needs the same isolated HTML preview as the agent side panel. This extends the existing CEF/WK artifact host to accept the exact cmux.artifacts parent alongside cmux.agent and exports ArtifactPreview for both consumers. The canonical route stays cmux-page://cmux.agent/__artifact. #27264 will consume this after landing; no pane or feature default is enabled here.

Leo: “like the claude.ai artifacts but imagine you didnt need to only have it on claude.ai”. On the MVP: “go ahead”.
Requested seam: “extend the shared PageArtifactFrame/CEF (and WK) host policy to accept the cmux.artifacts origin next to cmux.agent, and reuse the shared Preview/Run component.”

Reuses #26216's Preview/Run flow, #26224's CEF endpoint, and #26286's PageArtifactFrame/WebKit implementation, retaining their authorship in the stack. Austin Wang's project-local Artifacts design in #8610 is related prior work (session-rooted .cmux artifacts/notes and LocalArtifactRepository); this host change copies no storage implementation and leaves that PR untouched.

Security: the response retains its opaque sandbox without allow-same-origin, no network/file/bridge access, and one-shot render protocol. Only the two exact parent origins are admitted; ports, credentials, lookalikes, arbitrary pages, main-frame loads, repeated/nested navigation and resource escapes remain refused. Passive preview has no script capability; Run uses the existing native endpoint. Existing gallery-only fallback remains synthetic, and native origins always select the endpoint. RenderCard behavior is unchanged. The existing message listener is removed on unmount/document replacement; this change adds no timer or observer.

Validation:

  • Regression-first commit: 89b6f29.
  • Implementation head: 1e3f21d.
  • Scoped prepush static gate passes; changed web files are formatted.
  • Added C++ navigation/resource cases, Swift endpoint/navigation/bridge cases, and shared React Preview/Run/message-source tests. Remote execution pending; Swift syntax was unavailable on the agent VM.
  • No browser capture or live backend/connector receipt claimed. Before/after Linux gallery evidence and native compile/test evidence remain pending.

The own delta is the shared-host seam and its tests; the larger base diff is #26286's prerequisite stack and will disappear after that PR merges and this branch is rebased. No changes are pushed to the prerequisite branches.

Agent session: agent session

Red: bun test test/artifact-html.test.tsx: 5 expected failures (no JSX kind or HTML write output). bun run check blocked by pre-existing design-token findings outside changed files; focused lint passed.
Agent-Session: https://cmux.com/deeplink/agent?harness=codex&session=01a1756c-cf95-7a30-a911-a4a2d18a4841&host=gcp-codex-lane-2
HTML/SVG/JSX use the existing side preview, with an offline native artifact endpoint, isolated scripts, and navigation refusal. Completed full HTML writes from normalized ACP tools appear in the transcript and Outputs, with file-based versions. React/Sucrase are bundled locally and loaded after Run.

Red 68de299107d: bun test test/artifact-html.test.tsx had 5 expected failures. Green: same command 7 passed; focused artifact/panel/Inspector suite 17 passed; scoped gallery suite 27 passed. Manual Chromium VM check: 10 fixtures and parent/storage/network/file/WebSocket/image/script policy probes passed, with captures. Web bundle build, typecheck, formatting and changed-file lint passed. Localization audit passed with no new keys.

Not run: native compilation and AgentPaneArtifactNavigationTests (Linux VM has no swiftc; integration owner runs fleet verification). Full web check remains red on untouched base design-token debt at a30f457. No PR or push; artifact A handoff to nx-chat.

Agent-Session: https://cmux.com/deeplink/agent?harness=codex&session=01a1756c-cf95-7a30-a911-a4a2d18a4841&host=gcp-codex-lane-2
Draw passive artifact markup in a script-disabled srcdoc frame, then reserve the native opaque allow-scripts endpoint for explicit Run. Parse inert HTML for consent markers and refuse srcdoc-origin navigation to allowed pane or loopback routes. Deduplicate the standalone opened-write version list by recorded body.

Validation: scoped vp fmt passes on seven web files; scoped vp lint passes on new safety/runtime files. App lint reports only existing unlift/follow exhaustive-deps warnings. Swift syntax parse and git diff --check pass. No tests, builds, browser execution, push or hosted dispatch were run locally; parent owns exact-head hosted red/green and review.
Agent-Session: https://cmux.com/deeplink/agent?id=aid-196c8c4a1f392915fbea
Carry toolCanonical onto synthesized full-write diffs so canonical creates and raw-input overwrites remain one document in Outputs and the opened artifact version list.

Validation: scoped vp fmt and vp lint pass on writtenArtifacts.tsx and artifact-html.test.tsx; git diff --check passes. The focused behavioral regression is committed first at fbfd741; tests and builds are deferred to the coordinator's hosted lane. No push or dispatch.
Agent-Session: https://cmux.com/deeplink/agent?id=aid-196c8c4a1f392915fbea
Regression command for hosted runner: scripts/cmux-next/test-cmux-page-path-cpp.sh. The first two new cases are statically red on the base because PageRequestAllowed accepts the artifact URL as the same page host. Native test execution intentionally deferred by task scope.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-ecd03ea7c2f13c412b34
Serve exact cmux-page://cmux.agent/__artifact with an opaque sandbox CSP and the one-shot render protocol. Gate artifact/srcdoc navigation before the main-frame fast return, deny network/file/page subresources throughout descendant frames, and retain normal page navigation.

Observed: scoped verify-local checks passed (localization-defaults, package-groups, feature-flags), git diff --check passed, bootstrap node --check passed. Not run: native CEF compilation, browser probe, and C++ tests, per task scope. Hosted regression: scripts/cmux-next/test-cmux-page-path-cpp.sh. Test-first parent b71fd15 contains two statically failing page-authority cases; hosted red/green still required.
Agent-Session: https://cmux.com/deeplink/agent?id=aid-ecd03ea7c2f13c412b34
Serve the exact cmux-page://cmux.agent/__artifact bootstrap with an opaque sandbox CSP and apply the one-shot direct-child navigation policy in shared WebKit pages. Ordinary page navigation remains unchanged.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-wk-artifact-frame
Artifact pages remain fenced by the agent-only source-frame guard and restricted-context policy; ordinary pages may let their navigation hook admit srcdoc.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-wk-artifact-frame
@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Oct 29, 2026
@blacksmith-sh

blacksmith-sh Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Found 8 test failures on Blacksmith runners:

Failures

Test View Logs
---/--- View Logs
---/--- View Logs
test/agent-pane-attach-huge-files.test.ts/agent-pane-attach-huge-files.test View Logs
test/agent-pane-attach-huge-files.test.ts/agent-pane-attach-huge-files.test View Logs
test/agent-pane-attach-huge-files.test.ts/agent-pane-attach-huge-files.test View Logs
test/thread-rail-pending-load.test.ts/thread-rail-pending-load.test View Logs
test/thread-rail-pending-load.test.ts/thread-rail-pending-load.test View Logs
test/thread-rail-pending-load.test.ts/thread-rail-pending-load.test View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review a6051dc: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr27605 -f ref=lane/artifacts-shared-host-seam -f platform=macos -f backend_mode=local

Gallery before/after for a6051dc: 16 states rendered, 12 images differ, 3664 more touched states not rendered. Images are in the run's artifact, not on this public PR; the independent review of this head reads them on its own, so the PR needs no hand-made screenshots of these states.

gh run download 41993926167 -R manaflow-ai/cmux -n gallery-advisory-27605-a6051dcf241b8200aef82ff66d9464087ba583dc (then read gallery-review.json)

States
State Theme Status Diff Picked by
agent-pane.artifact-panel/live-stream Apple System Colors Light changed 0% own ArtifactPanel.tsx
agent-pane.artifact-panel/live-stream Apple System Colors unchanged 0% own ArtifactPanel.tsx
agent-pane.artifact-panel/live-finished Apple System Colors Light unchanged 0% own ArtifactPanel.tsx
agent-pane.artifact-panel/live-finished Apple System Colors unchanged 0% own ArtifactPanel.tsx
agent-pane.artifact-panel/live-history Apple System Colors Light unchanged 0% own ArtifactPanel.tsx
agent-pane.artifact-panel/live-history Apple System Colors unchanged 0% own ArtifactPanel.tsx
agent-pane.artifact-panel/claude-write Apple System Colors Light changed 0% own ArtifactPanel.tsx
agent-pane.artifact-panel/claude-write Apple System Colors changed 0% own ArtifactPanel.tsx
agent-pane.artifact-panel/codex-write Apple System Colors Light changed 0% own ArtifactPanel.tsx
agent-pane.artifact-panel/codex-write Apple System Colors unchanged 0% own ArtifactPanel.tsx
agent-pane.artifact-panel/pi-write Apple System Colors Light changed 0% own ArtifactPanel.tsx
agent-pane.artifact-panel/pi-write Apple System Colors changed 0% own ArtifactPanel.tsx
agent-pane.artifact-panel/gemini-write Apple System Colors Light changed 0% own ArtifactPanel.tsx
agent-pane.artifact-panel/gemini-write Apple System Colors changed 0% own ArtifactPanel.tsx
agent-pane.artifact-panel/edit-complete Apple System Colors Light changed 0% own ArtifactPanel.tsx
agent-pane.artifact-panel/edit-complete Apple System Colors changed 0% own ArtifactPanel.tsx
agent-pane.render-card/chart Apple System Colors Light unchanged 0% own RenderCard.tsx
agent-pane.render-card/chart Apple System Colors unchanged 0% own RenderCard.tsx
agent-pane.render-card/plain Apple System Colors Light unchanged 0% own RenderCard.tsx
agent-pane.render-card/plain Apple System Colors unchanged 0% own RenderCard.tsx
agent-pane.render-card/tall Apple System Colors Light unchanged 0% own RenderCard.tsx
agent-pane.render-card/tall Apple System Colors unchanged 0% own RenderCard.tsx
agent-pane.render-card/untitled Apple System Colors Light unchanged 0% own RenderCard.tsx
agent-pane.render-card/untitled Apple System Colors unchanged 0% own RenderCard.tsx
agent-pane.transcript-type/reading Apple System Colors Light changed 0.003% own RenderCard.tsx
agent-pane.transcript-type/reading Apple System Colors changed 0.0026% own RenderCard.tsx
agent-pane.transcript-type/claude-sign-in Apple System Colors Light unchanged 0% own RenderCard.tsx
agent-pane.transcript-type/claude-sign-in Apple System Colors unchanged 0% own RenderCard.tsx
agent-pane.transcript-type/claude-code-entry Apple System Colors Light unchanged 0% own RenderCard.tsx
agent-pane.transcript-type/claude-code-entry Apple System Colors unchanged 0% own RenderCard.tsx
agent-pane.transcript-type/claude-approve Apple System Colors Light unchanged 0% own RenderCard.tsx
agent-pane.transcript-type/claude-approve Apple System Colors unchanged 0% own RenderCard.tsx

Pick other states with a Gallery: entry.id, entry.id/variant line in the PR body.

Passes: CI passes on a6051dcf24.

CI passes on a6051dcf24 (run 41993926248 attempt 1).

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's; yours means the failing file is one this PR changes, also red on main that main's latest full suite fails the same way, seen on other PRs that it failed on another pull request's run lately.

web and size checks: green

Shipped in:

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Fleet focused suites at head 1e3f21db006fc8d084c4cfb02187832b082f947a (cmux-ci step 322c64ad, aws-m4pro-9, Xcode 26.6). All passed:

suite result
PageArtifactFrameTests passed
PageArtifactsParentTests passed
ChromiumPageHostBridgeTests passed
CmuxNextPagesTests (whole target: 131 tests in 36 suites) passed, 1 skipped (the PageHostPoolClaimReadyBenchmark suite)

The independent review is still running, and the WIP HOLD stays.

Agent session: agent session

@teamleaderleo

teamleaderleo commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Owned by an agent session · session

Conflicts (from #26286 having landed as a squash): artifact_page.h, ArtifactPanel.tsx,
RenderCard.tsx, artifactSandbox.ts, artifact-panel-sandbox.test.tsx; the rest taken from base.
The shared preview now wraps the side panel's current frame instead of the pre-#31174 copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-159afad10a5ab45ea16c
…d artifact bootstrap

The base's passive-frame contract (#29837) asserted the Artifacts page never loads the
bootstrap; this PR admits it as the second exact parent, so that assertion now expects
the load to be allowed, and a srcdoc child still refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-0b517f2a10c3ba1c8f62
@teamleaderleo
teamleaderleo marked this pull request as ready for review November 5, 2026 08:02
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (independent subagent, correctness + security): SHIP at 48f3129

  • d2869d7 merges feat-cmux-next (bdd3569) cleanly. Review at d2869d7: only cmux.agent and cmux.artifacts are admitted as parents (exact scheme, no port or credentials); the Artifacts page gets the exact endpoint and no other agent resource (WebKit served/route, and CEF's PageRequestAllowed gives other paths a 403); bridge trust and the passive srcdoc path are unchanged; the agent pane's RunningFrame behaves the same; no import cycles.
  • 48f3129 (test only): feat(next): Artifacts page provider and passive-frame contract (slice 1 of #27823) #29837's C++ assertion that the Artifacts page never loads the bootstrap contradicted this PR's purpose and failed test-cmux-page-path-cpp.sh. It now expects an empty direct child to be allowed and a srcdoc child to be refused. Every #expect in base's PagePassiveFrameNavigationTests was traced under this PR's PageNavigation and still holds.

Gates: fleet compile-check --app passed (job 8e05f4a5206e8c69f2bc6254); the 4 focused Swift suites passed (step 6eff5d24834aa7cdfe72d8fb); web tests 17/17 and tsc are clean; the C++ page-path test passes with the fix.

Follow-up for the consumer: the artifacts PageDescriptor needs frame-src cmux-page://cmux.agent/__artifact before the page mounts ArtifactPreview.

Leo, 2026-11-05: "Yes, push them".

…as ignored (web lint)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-0b517f2a10c3ba1c8f62
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (independent subagent): SHIP at a6051dc. The delta from 48f3129 is test-only (web lint): void act(...) on a synchronous act and a formatter rewrap in artifact-shared-preview.test.tsx; assertions unchanged. A fleet run of that file with the fix passed (0 fail, no type errors).

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex, router-review): SHIP at a6051dc

Reviewer: codex gpt-6-astra high, fast tier.

SHIP at a6051dc

Visual verdict: no images; Leo tries the build

The focused C++ navigation test passes (219 cases); no correctness, security, or regression findings found in the changed paths.

Follow-ups: none

@cmux-bot cmux-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmux-bot approves a6051dc: an independent review passed this exact head (router-review receipt by teamleaderleo). A push needs a new review; a later BLOCK at this head dismisses this approval.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (claude opus subagent, correctness + security): SHIP at a6051dc

The same Claude Opus reviewer read the whole PR at d2869d7 (full diff against base bdd3569), then each later commit: 48f3129 (C++ assertion reconciled with #29837, every base PagePassiveFrameNavigationTests expectation traced) and a6051dc (web lint only). No findings at any of the three heads. Non-blocking: the artifacts PageDescriptor needs frame-src cmux-page://cmux.agent/__artifact in the PR that mounts ArtifactPreview.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Merging at a6051dc. The one red check, cmux-next swift test, failed 14 suites. All are outside this PR's files, and each was compared by name at base bdd3569 on the fleet (step c564379a370f587e40497a64):

  • 13 also fail at base: CloudConfigurationSignedDEVTests, CloudNewWorkspaceLateStartTests, FocusedPanePresentedFirstTests, HoverCardMachineColorTests, NativeTooltipGuardTests, PlacementWriteOrderTests, ReduceMotionLoopTests, SidebarBandRowHeightEveryDensityTests, SidebarRowTitleAndCloseTests, SidebarUniformRowSpacingTests, TabMachineBadgeColorTests, TornOffWorkspaceNameTests, WindowCleanupCoverageTests.
  • 1 passed at base: AcpmuxRestartStuckTests. Re-run at this head, it passes (step dac535ae1e12393b557567a3), so this was a flake.

This PR's own suites pass (PageArtifactFrameTests, PageArtifactsParentTests, ChromiumPageHostBridgeTests, ArtifactsPageProviderTests).

@teamleaderleo
teamleaderleo merged commit 8c52aca into feat-cmux-next Nov 5, 2026
213 of 214 checks passed
@teamleaderleo
teamleaderleo deleted the lane/artifacts-shared-host-seam branch November 5, 2026 10:01

This branch was previously deployed

1 inactive deployment
ci-routing-agent — a6051dcf Deployed Nov 5, 2026 by teamleaderleo via namespace autofix #15040
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant