Repository navigation
Conversation
…or server-owned SSH targets A clipboard image pasted into a runtime-owned pane whose worktree lives on a server-owned SSH target (client -> orca serve -> SSH) was routed to the client's own SSH stack, which has no such connection, failing with 'Remote connection dropped. Click Reconnect on the SSH target'. Route to the runtime whenever a runtime environment id is present and thread the server-owned connection id into the chunked upload start and the small-image single-frame fallback, so the server forwards the file over its own SFTP connection - matching the paired web client, which already passes the connection through. No wire change: the RPCs have accepted the optional connection id since introduction. Fixes stablyai#17679 Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019G22teMcYiNe9RmGQ4dKuK
…nd harden runtime routing Review follow-ups: extract the chunked upload / single-frame fallback / abort protocol into one shared driver used by both the desktop main process and the web preload (their fork is what let connectionId handling diverge), normalize an empty connectionId to null before forwarding, and pin at the IPC seam that a failed runtime upload rejects rather than falling back to a client-reachable host. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019G22teMcYiNe9RmGQ4dKuK
Greptile SummaryThe PR enables clipboard, drop, and picker attachments for runtime-owned native chat panes by routing uploads through the owning runtime and preserving host context for uploaded files. The clipboard path’s ownership fix remains incomplete because pasted chips still discard their captured host before submission.
Confidence Score: 4/5The PR is not yet safe to merge because a pasted remote image can still be submitted to a different host than the one that created its temporary path. The new post-save check prevents ownership changes during the clipboard save, but the accepted path is stored without its captured host and remains available across later pane-owner changes, allowing submission to the wrong execution host. Files Needing Attention: src/renderer/src/components/native-chat/use-native-chat-composer-paste.ts, src/renderer/src/components/native-chat/use-native-chat-composer-attachments.ts
|
| Filename | Overview |
|---|---|
| src/renderer/src/components/native-chat/use-native-chat-composer-paste.ts | Adds runtime clipboard routing and an in-flight stale-owner guard, but drops owner metadata when committing the pasted attachment. |
| src/renderer/src/components/native-chat/use-native-chat-composer-attachments.ts | Extends attachment chips with host metadata, although pasted images do not provide that metadata. |
| src/renderer/src/components/native-chat/native-chat-attachment-upload.ts | Adds enriched runtime ownership resolution, destination uploads, and host-transition fencing. |
| src/main/window/clipboard-runtime-image-upload.ts | Consolidates runtime clipboard uploads through the shared chunking protocol and supports server-owned nested SSH connections. |
| src/renderer/src/components/native-chat/NativeChatImageAttachmentPreview.tsx | Routes previews for runtime-owned worktree attachments through the runtime image-loading context. |
Sequence Diagram
sequenceDiagram
participant U as User
participant C as Composer
participant H1 as Original host
participant H2 as Current host
U->>C: Paste image
C->>H1: Save temporary image
H1-->>C: Return host-local path
C->>C: Validate owner and store path without host
U->>C: Change pane owner
C->>H2: Submit stored path
H2-->>C: Path unreadable or resolves incorrectly
Comments Outside Diff (1)
-
src/renderer/src/components/native-chat/use-native-chat-composer-paste.ts, line 129 (link)Pasted attachment loses host ownership
When a runtime or SSH owner changes after an image is attached but before submission, this call stores the temporary path without the captured owner, causing the current agent to receive a path belonging to the previous host where it is unreadable or can identify an unrelated file.
Knowledge Base Used: Remote connectivity and execution
Reviews (4): Last reviewed commit: "fix(native-chat): share the catalog fall..." | Re-trigger Greptile
…ad driver
A blank connectionId reached the runtime schema ('' fails min(1)) from
callers that pass it through raw — the web preload used '?? null'. Trim
inside the driver so every transport treats blank as 'no connection'.
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019G22teMcYiNe9RmGQ4dKuK
… panes Wire the composer's three attach surfaces - clipboard image paste, file drag-and-drop, and the file picker - to the existing runtime transports, so a client paired to a Remote Orca Server can attach local files and screenshots the same way SSH panes already do. - The attachment owner resolver returns a full runtime owner (environment id, worktree, server-owned SSH connection for nested topologies, and the host-change expectation), failing closed to not-ready mid-flip. - Paste routes through saveClipboardImageAsTempFile with the runtime environment and server-owned connection, matching terminal paste. - Drop/picker upload through importExternalPathsToRuntime into the worktree's .orca/drops (no-clobber), mirroring terminal drops including the per-file skip/failure toasts and a stale-owner guard. - The attach funnel now keys on owner-resolved host contexts instead of blocking every remote pane; client-local paths still cannot reach a remote agent because every entry point resolves and uploads first. - Attachment chips carry the owning host so image previews read via the runtime for in-worktree files; server-tmp pastes fall back to the generic thumbnail, matching SSH behavior. Old servers degrade visibly: file uploads surface the existing 'requires a newer Orca server' capability message and small-image pastes use the single-frame fallback. No new wire methods. Fixes stablyai#12572 Fixes stablyai#17410 Fixes stablyai#6889 Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019G22teMcYiNe9RmGQ4dKuK
…l closed on unresolved connections Review follow-ups: extract the runtime .orca/drops upload flow into one core used by terminal drops and the composer (they were statement-for- statement duplicates), fail closed to not-ready when a runtime worktree's server-owned connection has not hydrated (nested topology, stablyai#17679), build the chip preview's runtime context without a settings-store subscription, drop the dead attached-host helper, and delete the now- unused local-attachment notice from all five locales. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019G22teMcYiNe9RmGQ4dKuK
e3a6b57 to
1a12c0f
Compare
Drop and picker uploads already assert the owner is unchanged before attaching; clipboard paste attached the saved temp path without re-checking, so a pane re-pair or SSH generation bump during the async save could hand the new agent a path minted on the old host (review finding on stablyai#17797). Re-resolve the owner after the save and drop the attachment with a visible notice when the host identity drifted, using one shared owner-match helper for both fences. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019G22teMcYiNe9RmGQ4dKuK
|
Addressed Greptile's P1 (clipboard paste retains stale owner) in f5aad0f:
Full native-chat suite (952 tests), typecheck, and lint pass. |
There was a problem hiding this comment.
ℹ️ No critical issues — one edge-case suggestion inline.
Reviewed changes
Reviewed the full four-commit stack (the two clipboard commits are from the stacked #17787, the native-chat commits are this feature), including the main-process clipboard routing, the shared upload driver, the web preload path, the attachment-owner resolver, and the terminal drop refactor.
- Runtime paste routing — runtime-owned paste now saves over the pairing channel and forwards the server-owned nested-SSH
connectionId, so a client-owned SSH provider is never dialed for a server-owned connection (#17679). - Shared upload protocol — the chunked clipboard-image upload driver is extracted to
src/shared/clipboard-image-upload-protocol.tsand reused by the desktop main process and the web preload instead of two divergent copies. - Owner resolution —
resolveNativeChatAttachmentOwnerForWorktreereturns a full runtime owner (environment id, worktree, server-owned connection, host expectation) and fails closed tonot-readywhile ownership is mid-flip. - Drop/picker upload — runtime drop and file-picker attach upload client paths into
.orca/dropsthrough a sharedruntime-drop-dir-uploadcore that the terminal drop path now also uses. - Host-aware chips — attachment chips carry their owning host: in-worktree runtime images get real previews via the runtime, pasted
/tmpimages fall back to the generic thumbnail.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| @@ -139,3 +184,41 @@ export async function uploadNativeChatAttachmentPaths( | |||
| toast.dismiss(pending) | |||
| } | |||
| } | |||
|
|
|||
| function assertNativeChatRuntimeOwnerCurrent(owner: NativeChatRuntimeAttachmentOwner): void { | |||
| const current = resolveNativeChatAttachmentOwnerForWorktree( | |||
There was a problem hiding this comment.
This re-resolution drops the terminalTabId that the terminal-tab capture path used, so worktreePath comes only from getKnownWorktreeById while the captured owner's path may have come from resolveNativeChatFileLinkContext's worktreesByRepo fallback. In the hydration window that fallback exists for (catalog row present, known-worktree index not yet populated), the assert resolves not-ready and fails a legitimate attach with "Attachment upload host changed" even though nothing changed.
There was a problem hiding this comment.
Confirmed and fixed in 48ece5f. The asymmetry was real: the tab-path capture resolves the worktree path with the worktreesByRepo fallback, while the assert's tab-less re-resolution used only getKnownWorktreeById — so during index hydration the assert could resolve not-ready and spuriously fail a legitimate attach. The structured branch (which the assert re-resolves through) now uses the same fallback, pinned by a test that captures through an empty known-worktree index.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Delta review of the two commits pushed since the prior pullfrog review (plus the rebased base commits): the blank-connection normalization inside the shared upload driver, and the mid-save owner fence added to clipboard paste.
- Blank connection normalization —
saveClipboardImageBase64ThroughRuntimenow trimsrawConnectionIdtonullinside the shared driver, so the web preload no longer forwards an empty string that the runtime schema rejects. - Paste owner fence — a shared
nativeChatAttachmentOwnersMatchpredicate compares the owner captured at paste time against a post-save re-resolution, and bothhandlePasteandpasteFromClipboarddrop the temp path with the host-changed notice when the pane's host drifted mid-save.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…d re-resolution The tab-path owner capture resolves the worktree path with a worktreesByRepo fallback, but the stale-owner assert's tab-less re-resolution used only the known-worktree index — during index hydration a legitimate attach could spuriously fail as 'host changed' (review finding on stablyai#17797). Use the same fallback in both branches. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019G22teMcYiNe9RmGQ4dKuK
|
Pullfrog's review is in (no critical issues, one inline edge-case) — addressed in 48ece5f:
Full native-chat suite (953 tests), typecheck, and lint pass. That closes out all bot findings on this PR: Greptile's P1 (paste fence, f5aad0f) and pullfrog's inline edge-case (48ece5f). |
|
Hi @cmer, thanks for this PR. We run Orca as a headless Do you plan to rebase this? If so, we're happy to test the branch on that setup and post the results here. If you'd rather keep it moving in smaller pieces, would you mind if we opened a narrow PR for clipboard image paste in Chat view only on paired-runtime panes? It would reuse |

Fixes #12572
Fixes #17410
Fixes #6889
Problem
On a runtime-owned (
remote:) native chat pane, none of the composer's attach surfaces work: drag-and-drop and the file picker show "Local attachments are not available for remote sessions", and clipboard image paste is refused. Meanwhile the same pane's terminal view happily uploads a pasted image to the server, and mobile clients attach images to the very same sessions — the gap was specific to the desktop/web composer. Users fall back to scp/synced folders or pasting screenshots into GitHub comment boxes for the URL (#12572, #6889 comments).What this does
All three composer attach surfaces now work on runtime-owned panes, producing the same end state the SSH composer path already produces — and it's wiring, not new transport:
saveClipboardImageAsTempFile({ runtimeEnvironmentId, connectionId })terminal paste uses (chunked upload over the pairing channel, single-frame fallback for old servers). Nested worktrees on a server-owned SSH target work from day one (fix(clipboard): route runtime-owned image paste through the runtime for server-owned SSH targets #17787).importExternalPathsToRuntimeinto the worktree's.orca/drops(no-clobber), mirroring terminal drops — including the per-file skip/failure toasts and the capability assertion that surfaces "Remote file changes require a newer Orca server" against old servers.not-readywhile ownership is mid-flip. A stale-owner guard fails an in-flight upload if the pane's host changes underneath it.attachResolvedPathsreceives owner-resolved host contexts. Client-local paths still can't reach a remote agent because every entry point resolves the owner and uploads first (the [Bug]: Remote host attempting to view a file results in error #6648 property, now enforced at the entries and pinned by tests)./tmpimages fall back to the generic thumbnail, matching current SSH-paste behavior. A runtime chip never carries a connection id — that connection is server-owned and must not be dialed from the client.No new wire methods, no capability negotiation needed. The send path is untouched (runtime image sends already existed for mobile). The paired web client shares the renderer, so it gets all three surfaces too; mobile already worked and is unchanged.
Testing
At the pre-agreed seams:
native-chat-attachment-upload.test.ts— resolver returns the enriched runtime owner (plain, nested-SSH, focused-host, not-ready), and the runtime upload flow: import args,.orca/dropsdestination, skip/failure toasts, stale-owner failure, error → null.use-native-chat-composer-paste.test.tsx— runtime paste routes to the runtime save (plain + nested) and attaches the returned path; existing SSH/local/failure cases unchanged.use-native-chat-external-attachments.test.tsx— runtime drop/picker uploads and attaches destination-side paths with the runtime host context; failed uploads attach nothing; SSH/local/not-ready/disabled cases unchanged.Full
pnpm test,pnpm tc, oxlint, and the localization verifies pass.🤖 Generated with Claude Code
https://claude.ai/code/session_019G22teMcYiNe9RmGQ4dKuK