Skip to content

Share a chat visual straight from the inline preview - #27634

Closed
brennanb2025 wants to merge 22 commits into
brennanb2025/chat-html-workspace-filesfrom
brennanb2025/chat-visual-inline-share
Closed

brennanb2025 wants to merge 22 commits into
brennanb2025/chat-html-workspace-filesfrom
brennanb2025/chat-visual-inline-share

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​278 $\color{#cf222e}{\Huge{\mathbf{−}}}$​69 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​209
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​203 $\color{#cf222e}{\Huge{\mathbf{−}}}$​31 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​172

Stacked on #27633 (chat HTML visuals are ordinary workspace files) and #27608 (one Share link per file). The base is #27633's branch, and this branch also merges #27608, so the diff shows #27608's change too until it lands. This PR's own change is the commit "Share a chat visual from one fresh read of its file". Because the base isn't main, only part of CI runs on this PR; the full run happens once it is retargeted to main.

ELI5

When an agent shows a chart or report inline in a native chat, you can now share it as an artifact right there. Hover the visual and a Share button appears next to "Open in new tab". It's the same Share button the editor, the HTML preview and the browser tab use, and it updates the same link they would for that file.

What Changed

The problem (STA-10098): to share an inline chat visual you had to open it in a tab first and share from there. #27633 makes these visuals ordinary files in the chat's folder, and #27608 gives every surface one Share link per file. The inline preview itself still had no Share.

Before:

  • The inline visual's hover toolbar had only "Open in new tab".

After:

  • Hover toolbar: "Open in new tab" plus the existing Share button, with the same popover, sign-in prompt and settings link as everywhere else.
  • One link per file: sharing from the chat, the editor tab, the HTML preview or the local browser tab publishes and updates the same link for that file on that host. Sharing again updates it instead of making a second one.
  • What gets shared is what you see after the click: Share reads the file again when you click it. If the page changed since it was shown (say you edited and saved it in the editor), the frame updates to the saved page and that same page is published.
  • If the file can't be read (host unreachable, file deleted): the frame keeps showing the page and Share shows its existing "Orca couldn't read this file" message. Nothing is published.
  • Not shown when: the visual shows "Visualization unavailable", or a floating chat's folder isn't pinned yet (the visual is still a placeholder). The phone has no Share, since it has no artifact sharing.
  • Small visual change: the two buttons sit in one small bordered bar with a background, so they stay readable over any page. Before, a single outlined button floated over the page.

Mechanism:

  • One read per click. The Share button's request builder (readNativeChatVisualArtifactRequest, native-chat-visual-share.ts) does one read through the same reader the inline frame uses (Save chat HTML visuals as ordinary workspace files #27633's readNativeChatVisualFile), with a new fresh option. A normal read joins any read of the same file already under way; a fresh read never does, so its answer comes from after the click. Share any HTML file from the editor and the remote preview #27608's publish flow builds the request once per click, before sign-in and its retry, so the page read is the page sent.
  • The frame follows that read. The visual's document hook now also returns showDocument, which swaps the frame only when the HTML changed (the same rule its own reads use). Share calls it with the page it read, so what you see and what is published are the same text.
  • The key. fileArtifactSourceKey(owner, absolutePath) from Share any HTML file from the editor and the remote preview #27608, where owner (host and environment) and absolutePath come from Save chat HTML visuals as ordinary workspace files #27633's one resolution of the visual's path against the chat's folder. No copy of the key format here, so the key is the editor's, preview's and browser tab's key for the same file, Windows drive paths included.
  • On failure the request builder throws the existing ArtifactPublishPreparationError('unreadable') and does not touch the frame.
  • No main-process, host or phone change.

Why

STA-10098 asked for Share right on the inline preview. Reusing the shared button, the one key function and the visual's own reader keeps chat visuals the same as every other HTML file, which is the point of #27633 and #27608.

Alternatives considered:

  • Publish the page already shown in the frame, without reading again. Rejected: the shown copy can be older than the file (a save in the editor isn't always seen by a watch), so Share could publish a stale page.
  • Read again but leave the frame alone. Rejected: you'd share a page you aren't looking at.
  • Join a read already under way. Rejected: that read may have started before your save, which is exactly the stale case above. That is why the fresh option exists.

Difference from the common pattern: none intended. This reuses Orca's existing Share button and publish flow unchanged; only the request builder is new.

Linked Issue

STA-10098 (Linear)

Visual Proof

Live check on the M4Air at head 745b0011590 (all three PRs together): a hidden, isolated dev build with real Claude, plus a second isolated Orca paired to it as a remote host.

Hovering the inline visual shows Open and Share:

Open and Share on an inline visual

Share opens the same popover as everywhere else. That rig had no Orca account and sharing was off, so it asks for both:

Share popover on an inline visual

On a chat on a paired remote host, the toolbar showed the same buttons and Share opened the same popover.
Not checked live: an actual publish (needs a signed-in account), so the fresh read at publish time is covered only by unit tests.

Testing

  • NativeChatMarkdown.visual.test.tsx (rendered visual, real Share button and publish flow):

    • after the file is saved with new content that no watch reported, Share publishes the saved page under the file's key, reads the file exactly once for the click, builds one publish request, and the frame shows the saved page;
    • a file that can't be read keeps the shown page, publishes nothing, and shows the "couldn't read this file" message;
    • no Share on an unavailable visual or on a floating chat whose folder isn't pinned.
  • native-chat-visual-share.test.ts:

    • the chat visual's key equals the editor tab's and browser tab's key for a local file, and the editor tab's and preview's key on a paired host, including Windows C:\ / C:/ spellings (local and paired), using Share any HTML file from the editor and the remote preview #27608's parity helpers (moved into file-artifact-source-key.test-support.ts so both tests share them);
    • Share's read does not join a read already under way, and returns the page from its own read;
    • unreachable and missing files report unreadable and leave the frame alone.
  • Also passed: all native-chat, artifacts, browser-pane and editor-share tests (502 files), tc:web, oxlint, oxfmt, the changed-code quality gate, and orca-ci-checks.

  • I manually tested these changes locally (toolbar and Share popover live on head 745b0011590, local and paired host; no publish, no account)

  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • SSH / paired hosts: the read goes to the host that owns the chat's folder, and the key names that host, matching the preview's and editor's key for the same file. Known limit carried from Save chat HTML visuals as ordinary workspace files #27633 (STA-4343): when two hosts share a workspace id, Share reads and keys the selected host's file; read and key always come from the same resolution, so they never disagree.
  • Mobile: no Share on the phone, which has no artifact sharing today.
  • Cross-platform: the path resolves with the same helper chat file links use; the key canonicalizes Windows drive and UNC paths.
  • Mixed versions: no new RPC, field or capability.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

brennanb2025 and others added 5 commits October 11, 2026 14:15
HTML could only be shared as an artifact from a local file:// browser tab.
The editor offered Share only for Markdown, and the document preview that
renders HTML on SSH and paired hosts had no Share at all.

The editor now shares HTML files too, and the document preview's toolbar
gets the same Share button, reading the page from its owning host. Both use
one source key per file per host, so either surface finds the link the
other published.

Co-Authored-By: Claude <[email protected]>
The inline visual's hover toolbar gets the existing Share button beside
Open in new tab. It re-reads the page through the chat's host and
publishes it under the same key as the file's editor tab and preview, so
every surface updates one link.

Co-Authored-By: Claude <[email protected]>
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Sharing a chat-generated chart or report previously required opening it in another tab. This PR adds the existing Share control to the inline preview and publishes it through the ordinary file publisher.

Review status: blocked on the upstream stack; still draft. The published head remains 111c0a9d4e6. The corrections below are reviewed local work, not committed or pushed yet.

The review reproduced and corrected three problems in this PR’s initial implementation:

  • A retained chat could publish its bytes under another host’s file key. The key now comes from the same chat target that reads the file.
  • Windows path spelling could create a second link for the same file. The adapter now preserves the path spelling used by ordinary file surfaces.
  • Share could reuse a read sampled before the action. It now validates the file again after a mount read already pending.

An architecture challenge recommended keeping this approach. A fresh second correctness review accepted all three corrections, and the dedicated performance and eight-category readiness audits found no new issue in this PR’s own accepted source. The fixer passed 64 tests across eight focused suites, plus formatting, lint, code-quality and React Doctor checks. Independent tests also exercised real file rewrites, host selection, ordinary Windows file-listing paths, concurrent reads and callback changes.

Final integration waits for #27608’s complete file-read ownership correction and #27633’s ownership and contained-reader corrections. Both remain under review without final pushed heads. Those changes are owned by their PRs; no workaround or unrelated source change was added here.

Not yet verified: the final combined head, queued typecheck/pre-push checks, final-head CI, and remote rendered QA. M4Air preparation is complete but execution is held for that final head. Windows QA startup failed before task delivery and its process identity could not be verified, so its worktree was preserved. Authenticated publication and live paired/SSH execution were not exercised. The inherited local read transport’s unenforced deadline remains a documented limitation; no new regression from it was established here.

No PR merge, auto-merge or ready-state change has occurred. This comment will be updated after the final integration and validation, rather than adding another review summary.

brennanb2025 and others added 11 commits October 12, 2026 01:31
…rant's host

The editor, the rendered preview and a local browser tab each built their own
share key, so one file could publish to several links: a Windows path spelled
C:/ in one place and C:\ in another, and the preview keyed from whichever host
the workspace resolved to at render time, not the host it was reading from.

One key function now serves every surface, with main's formats (local path,
the CLI's SSH key, ['editor', env, host, path] with the 'remote' fallback) and
Windows drive/UNC paths spelled with backslashes.

The preview's grant handle keeps the location it was minted for. Share reads
the page through that location and keys from it, so a later host change can't
move either; an SSH grant keeps its connection id, so its read fails closed
instead of reading a local file.

Publishing prepares the request once per click, before sign-in and the auth
retry, so a retry publishes what the user clicked Share on.

Co-Authored-By: Claude <[email protected]>
…' into brennanb2025/chat-visual-inline-share
…-files' into brennanb2025/chat-visual-inline-share

# Conflicts:
#	src/renderer/src/components/native-chat/NativeChatInlineVisual.tsx
#	src/renderer/src/components/native-chat/NativeChatMarkdown.visual.test.tsx
Share on the inline visual reads the file again at the click, without
joining a read already under way, shows that page in the frame if it
changed, and publishes the same text under the file's one key (the key
the editor tab, preview and browser tab use for that file on that host).
A read that fails keeps the frame and reports the file as unreadable.

The parity helpers for the Share surfaces move into a test-support file so
the chat visual is checked against them too.

Co-Authored-By: Claude <[email protected]>
…-files' into brennanb2025/chat-visual-inline-share
The Share popover is portalled and takes focus, so neither hover nor
focus-within held the toolbar and the Share button faded out under its
own popover. The toolbar now owns the popover's open state and stays
visible while it is open.

Co-Authored-By: Claude <[email protected]>
…orkspaces

A preview of an SSH workspace a paired server proxies mints its grant on that
SSH target, so it already keys the file the same way the editor does; the new
test locks that in. Also corrects the SSH read comment: the connection id is
kept because dropping it would read the path on this machine.

Co-Authored-By: Claude <[email protected]>
The open state lived in the visual, which outlives the toolbar, so a
visual that went away while Share was open reopened the popover by
itself when it came back. The toolbar is now its own component holding
that state, so it unmounts with the toolbar.

Co-Authored-By: Claude <[email protected]>
…-files' into brennanb2025/chat-visual-inline-share
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status (quick review loop, 2026-10-12)

The problem this PR fixes. An inline HTML visual in a native chat could be opened but not shared. To share it you had to open the file somewhere else first, and the link you got could differ from the one the editor or preview would make for the same file.

What changes for you. The inline visual's hover toolbar now has Share next to Open.

  • At the click, Orca reads the file once, fresh from disk.
  • The inline view updates to that content, and exactly that file content is published.
  • The link is the same one the editor, the HTML preview and a browser tab use for that file on that host (from Share any HTML file from the editor and the remote preview #27608), so sharing again from any of them updates the same link.
  • If the file can't be read, the frame stays as it was and the existing "couldn't read this file" message shows. Nothing is published.

This round. A fresh reviewer went through this PR's own changes, and one architecture pass covered all three stacked PRs; the architecture pass kept the design. Fixes got a second, narrow review, then a readiness check ran on the final diff.

  • Fixed in b7163b08800: the hover toolbar faded out while its own Share popover was open (the popover sits outside the toolbar and takes focus), so the button the popover hangs from disappeared. The toolbar now stays visible while Share is open. The second review compiled the CSS and confirmed the rule wins.
  • Fixed in 78db218f2de, a bug from that first fix: if the visual disappeared while Share was open and later came back, the popover reopened on its own. Open and Share now live in a small toolbar component that owns the open state, so the state goes away with the toolbar. This changes what you see and was not re-checked live.
  • Deferred (accepted):
    • If an older background read of the file finishes after Share's fresh read, the frame can briefly show the older page until the next recheck. What gets published is unaffected.
    • When the same file appears as several visuals, only the one you shared from refreshes its frame at once; the others catch up at their next recheck.
  • 8ba4fcf277b and 4ba058686ed merge the final heads of Share any HTML file from the editor and the remote preview #27608 (d0f49fe3228) and Save chat HTML visuals as ordinary workspace files #27633 (6923d7a28c9, which includes current main). This PR's own changes are unchanged by those merges.

Verified.

  • Readiness on the final diff: 44/44 tests across this PR's test files plus ArtifactPublishButton.test.tsx.
  • Web typecheck passes, and oxlint and the code-quality gate are clean.
  • The repo's CI checks pass locally apart from the known local-only typecheck:ci failure.
  • Earlier live QA showed the toolbar's Open and Share and the Share popover, locally and on a paired host. Screenshots are in the body.

Not verified.

  • No real publish (it needs a signed-in account).
  • No live check of the two toolbar fixes above.
  • No test pins the inline visual's link for SSH owners; only local and paired hosts are covered.
  • CI on 4ba058686ed is red only because of a break on main. config/scripts/check-main-sync-spawn-ratchet.mjs (from ci: stop new main-process code from freezing Orca with synchronous launches #27756) imports four functions that chore(ratchet): one ratchet baseline library #27788 moved to ratchet-baseline.mjs (SyntaxError: Export named 'diffCounts' not found). That fails static analysis on every PR, and the test jobs after it are skipped, so CI ran no unit tests on this head. The last fully green CI run was on the previous head, 745b0011590. CI needs one re-run after main is fixed.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 12, 2026 21:17
…25/chat-visual-inline-share

# Conflicts:
#	src/renderer/src/lib/file-artifact-source-key.test.ts
@brennanb2025
brennanb2025 marked this pull request as draft October 13, 2026 02:37
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Superseded by the rebuilt six-PR chat scratch stack (#28385 merged, #28389, #28397, #28437, #28394, #28479). This piece is replaced by #28479. Closing.

@brennanb2025
brennanb2025 deleted the brennanb2025/chat-visual-inline-share branch October 14, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant