Skip to content

feat(next): Pin an artifact preview across chat switches (W2-17) - #30798

Merged
teamleaderleo merged 14 commits into
feat-cmux-nextfrom
w2-17-pin-preview-across-chats-20261101
Nov 2, 2026
Merged

teamleaderleo merged 14 commits into
feat-cmux-nextfrom
w2-17-pin-preview-across-chats-20261101

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

W2-17: an explicit Pin on the existing document preview

Independently implements the smallest source-owned slice of W2-17's investigation and brief. This is an own-branch draft, isolated from Austin's custom panes #26713, Leo's inline HTML/SVG #30673, and the still-held Artifacts/renderer owners.

User journey

  1. Open an agent-produced HTML, SVG or Markdown document from the conversation into the existing side preview.
  2. Click the new Pin control (reuses the existing message pushpin drawing and existing translated strings).
  3. Switch to another chat within the same agent-pane runtime. The side preview retains the pinned document with a "Pinned · " label.
  4. Versions come only from the original chat, snapshotted at Pin; another chat's document with the same <title> can never masquerade as a revision. Returning to the original chat resumes its live revision list.
  5. Unpin from another chat closes the old preview; Unpin in its source chat resumes ordinary close-on-chat-switch behavior. Opening a different preview intentionally replaces the previous one.

Changes

  • artifactPin.ts: small pure, testable state transitions, source identity and snapshot selection.
  • App.tsx: source-session gate on version lookup; pin state and originating chat title for the current panel.
  • ArtifactPanel.tsx: explicit accessible Pin/Unpin with aria-pressed, a compact source label; reuse the current preview, code, version and Run controls.
  • conversation.css: truncate long originating-chat names and keep narrow panes compact.
  • ArtifactPanel.gallery.ts: real-page Pin interaction fixture.
  • Tests: source-session collision/revision regressions plus component control test.

Evidence and limits

  • Source model: exact artifactPin.ts Git blob SHA 89da729b69013dde8f0d713fee16c6a7a833c5d0 was independently reproduced and SHA-matched in an isolated Node/TypeScript harness; 14 assertions PASS, covering wrong-chat same-title outputs, pin/unpin, source snapshots, null sessions and partial/paged source history.
  • Validation: focused webviews run 41372526014 passed all artifact-pin and artifact-panel tests; its only failure is the existing render-fence.test.tsx cut-reply assertion, reproduced on base by run 41373367717 with the same error. Router review SHIP at this exact head; its P2 follow-up is tracked in NEXT: preserve accepted artifact revisions across chat switches #31620.
  • Starting base at branch creation: 265c68a569ac4af557bdd5ad2e4b26365a453503; current branch head: 6a7d2cb7bd04056548956f5650483a8e51f215c6. Base had advanced to ca44136b499d5782e4f21a9e01da37817a132285 at PR creation. Recheck/merge latest base before SHIP.
  • Scope: a retained preview during an in-page chat switch, not a durable, synced artifact or a native split/tab. It does not persist through an app restart or onto another computer; those are owned by HQ #4984, Artifacts PRs and the right-pane API. No new network access, storage ledger, renderer, daemon action, store listing or grant.
  • Risks to examine: full pane unmount or native tab replacement; narrow-width preview covering the chat; a pinned preview deliberately replaced by another Open; source chat deleted/offline; existing ranRenders behavior inherited from the renderer. Keep the parent render/consent PR reviews separate.

Reviewer acceptance

  1. Pin a completed preview in chat A, choose revision 2, switch to chat B with a different document of the same title, return to A: the pinned preview still shows revision 2 and its source label, B's document never enters the version list.
  2. Unpin in B: the preview closes. Unpin in A: stays open until chat switch. Close and Escape always work; Pin is absent in gallery/no-host surfaces.
  3. During partial reconnect/paged reload of chat A, the saved revisions remain visible until A's complete history arrives.
  4. Scripted HTML still asks Run in each appropriate owner path, and the existing sandbox/CSP/bridge policy remains untouched.

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


Summary by cubic

Adds an explicit Pin control to the artifact preview so a document stays open when you switch chats within the same agent pane.

  • Pinning snapshots the source chat's version list, so a different chat's document with the same title never appears as a revision. The snapshot is kept until every captured revision reappears, so paged or reconnecting transcripts never show stale versions as new ones.
  • The pane shows a "Pinned · " label and keeps using the pinned preview's existing controls.
  • Unpinning from another chat closes the preview; unpinning in the source chat restores close-on-switch behavior.
  • Pinning has no effect when the preview lacks an owning session, and the Pin control is absent on gallery/no-host surfaces.

Written for commit fa53e05. Summary will update on new commits.

View guided diff Turn on auto-fix

Agent session: agent session

@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Nov 1, 2026
@blacksmith-sh

blacksmith-sh Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Found 15 test failures on Blacksmith runners:

Failures

Test View Logs
/tmp/tmp_77dvdx0/summary-missing.json (live):/summary-missing.json (live): View Logs
/tmp/tmpt6wh7lv4/summary-fail.json (live):/summary-fail.json (live): View Logs
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows/
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows
View Logs
[new_workspaces] the window draws no frames/[new_workspaces] the window draws no frames View Logs
[tabs] debug.tab_switch timed 0 of 40 switches/
[tabs] debug.tab_switch timed 0 of 40 switches
View Logs
[tabs] the window draws no frames/[tabs] the window draws no frames View Logs
main.DeveloperIdAppTests.test_download_prints_the_active_profile_only/
test_download_prints_the_active_profile_only
View Logs
imported web bundle inputs are not routed:/imported web bundle inputs are not routed: View Logs
stubs: /System/Library/Frameworks/Security.framework/Versions/A/Security has no stub/
Security has no stub
View Logs
stubs: CoreFoundation.tbd: install-name /System/Library/Frameworks/
CoreFoundation.framework/Versions/A/CoreFoundation, missing 1: ['_CFRetain']/
CoreFoundation, missing 1: ['_CFRetain']
View Logs

...and 5 more test failures. View all on Blacksmith: run 41372738033, run 41372738013

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

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Awareness note from an agent lane that does not own this PR; it is not a review or a request to take the PR over.


Triage for Leo's ask ask-e06a62154f: close, not carried. This adds a new control and a new behaviour (a Pin on the artifact side panel that keeps a preview across chat switches). Leo never asked for it, and the rulebook keeps us from adding features or changing how the panel behaves without his word. It is also 551 commits behind, and the side panel has changed under it since (#31174 guarded its passive frame), so it would need a rebase and a fresh design pass anyway. If pinning a preview across chats becomes an ask, start from the artifactPin.ts state rules here (versions come only from the source chat, snapshotted at Pin), which are the reusable part. The broker on this lane can't close it, so a coordinator will.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Owned by an agent session · session

@teamleaderleo
teamleaderleo force-pushed the w2-17-pin-preview-across-chats-20261101 branch from 6a7d2cb to fa53e05 Compare November 2, 2026 01:29
@teamleaderleo
teamleaderleo marked this pull request as ready for review November 2, 2026 01:29
@cursor

cursor Bot commented Nov 2, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

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

Review fa53e05: 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=pr30798 -f ref=w2-17-pin-preview-across-chats-20261101 -f platform=macos -f backend_mode=local

Gallery before/after for fa53e05: 16 states rendered, 14 images differ, 1946 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 41372754174 -R manaflow-ai/cmux -n gallery-advisory-30798-fa53e051cba310a18f7beb2328fc287fb4cff0db (then read gallery-review.json)

States
State Theme Status Diff Picked by
agent-pane.access-offer/turn-no-credits Apple System Colors Light unchanged 0% own conversation.css
agent-pane.access-offer/turn-no-credits Apple System Colors unchanged 0% own conversation.css
agent-pane.access-offer/turn-low-credits Apple System Colors Light unchanged 0% own conversation.css
agent-pane.access-offer/turn-low-credits Apple System Colors unchanged 0% own conversation.css
agent-pane.access-offer/turn-no-offer Apple System Colors Light unchanged 0% own conversation.css
agent-pane.access-offer/turn-no-offer Apple System Colors unchanged 0% own conversation.css
agent-pane.approval-edits/single Apple System Colors Light unchanged 0% own conversation.css
agent-pane.approval-edits/single Apple System Colors unchanged 0% own conversation.css
agent-pane.approval-edits/grouped Apple System Colors Light unchanged 0% own conversation.css
agent-pane.approval-edits/grouped Apple System Colors unchanged 0% own conversation.css
agent-pane.approval-edits/single-multiedit Apple System Colors Light unchanged 0% own conversation.css
agent-pane.approval-edits/single-multiedit Apple System Colors unchanged 0% own conversation.css
agent-pane.approval-edits/grouped-multiedit Apple System Colors Light unchanged 0% own conversation.css
agent-pane.approval-edits/grouped-multiedit Apple System Colors unchanged 0% own conversation.css
agent-pane.approval-edits/single-long Apple System Colors Light unchanged 0% own conversation.css
agent-pane.approval-edits/single-long Apple System Colors unchanged 0% own conversation.css
agent-pane.approval-edits/grouped-long Apple System Colors Light unchanged 0% own conversation.css
agent-pane.approval-edits/grouped-long Apple System Colors unchanged 0% own conversation.css
agent-pane.artifact-panel/pinned Apple System Colors Light new 0% own ArtifactPanel.gallery.ts
agent-pane.artifact-panel/pinned Apple System Colors new 0% own ArtifactPanel.gallery.ts
agent-pane.artifact-panel/claude-write Apple System Colors Light changed 0.0166% own ArtifactPanel.gallery.ts
agent-pane.artifact-panel/claude-write Apple System Colors changed 0.0159% own ArtifactPanel.gallery.ts
agent-pane.artifact-panel/codex-write Apple System Colors Light changed 0.0166% own ArtifactPanel.gallery.ts
agent-pane.artifact-panel/codex-write Apple System Colors changed 0.0159% own ArtifactPanel.gallery.ts
agent-pane.artifact-panel/pi-write Apple System Colors Light changed 0.0166% own ArtifactPanel.gallery.ts
agent-pane.artifact-panel/pi-write Apple System Colors changed 0.0159% own ArtifactPanel.gallery.ts
agent-pane.artifact-panel/gemini-write Apple System Colors Light changed 0.0166% own ArtifactPanel.gallery.ts
agent-pane.artifact-panel/gemini-write Apple System Colors changed 0.0159% own ArtifactPanel.gallery.ts
agent-pane.artifact-panel/edit-complete Apple System Colors Light changed 0% own ArtifactPanel.gallery.ts
agent-pane.artifact-panel/edit-complete Apple System Colors changed 0% own ArtifactPanel.gallery.ts
agent-pane.artifact-panel/replace-complete Apple System Colors Light changed 0% own ArtifactPanel.gallery.ts
agent-pane.artifact-panel/replace-complete Apple System Colors changed 0% own ArtifactPanel.gallery.ts

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

Shipped in:

@teamleaderleo
teamleaderleo merged commit 053cc66 into feat-cmux-next Nov 2, 2026
191 of 220 checks passed
@teamleaderleo
teamleaderleo deleted the w2-17-pin-preview-across-chats-20261101 branch November 2, 2026 01:48
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex gpt-6-astra high, sweep, via the review router; full diff from merge base 230f7e9 to this head): SHIP at fa53e05

No P1/P2 findings.

This branch was previously deployed

1 inactive deployment
ci-routing-agent — fa53e051 Deployed Nov 2, 2026 by teamleaderleo via wait for same-key tree publisher #98334
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