Skip to content

fix(files): client drops on a remote composer upload through the import transaction - #27227

Merged
OrcaWin merged 1 commit into
mainfrom
OrcaWin/d4-d4-v1b
Oct 10, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
OrcaWin/d4-d4-v1b

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​231 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​231
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​18

ELI5

When you start a new workspace on a project that lives on a paired Orca server and drop a file into the prompt, Orca should copy the file to that server (into the project's .orca/drops folder) and put the server-side path into the prompt. Instead the drop failed with a cryptic selector_not_found error. Now the file lands on the server and its path is attached.

What Changed

  • Before: dropping or picking a file in the new-workspace composer for a project owned by a paired server showed a selector_not_found toast and attached nothing. SSH and local projects worked.
  • After: the file is uploaded to <project>/.orca/drops/ on the server that owns the project, and that path is attached. Dropping a second file with the same name keeps both (shot.png, shot copy.png).

Mechanism: the composer already used the shared file-import path (stage on the client, stream to a hidden temp file, commit without overwriting, clean up the temp file, and stop if the server disconnects or is re-paired). But it named the destination by the project's path where the server expects a worktree id. The server looks up file operations by worktree id, so a bare path never matched. The composer's attachment target now carries the project's main worktree id (getRepoMainWorktreeId, which other server calls already use), and the upload passes it. Routing is unchanged: it still follows the project's own host, not the focused server.

Why

The design called for reusing the existing import transaction instead of adding a new upload method, and it turned out the transaction was already in use. The only defect was the identifier it was given. Passing the right id fixes the bug without any wire change, so older servers work too. Other options were a path: lookup, which searches the whole server and can be ambiguous when two hosts have the same path, or a new drop method, which would duplicate the import transaction.

Not in scope: a folder project (project group) on a paired server has no worktree yet when the composer is open, so drops there are still refused by the server. They are never written to the wrong machine.

Linked Issue

Fixes #16558

Visual Proof

N/A. The fix is in how the upload addresses the server. The visible change is that a drop now attaches a path where it used to show an error toast, and the new tests cover that.

Testing

  • New composer-remote-server-drop.test.tsx runs the real composer drop state and the real import client against a fake paired server that, like the real one, accepts only registered worktree ids:

    • a drop uploads into /srv/repo/.orca/drops/ and every file call targets the project's worktree (on origin/main this fails with selector_not_found)
    • two drops with the same name keep both files (fails on origin/main)
    • a disconnect mid-drop commits nothing and attaches nothing (fails on origin/main)
    • re-pairing mid-drop never sends a temp-file cleanup to the replacement server
  • Updated the existing composer target and drop tests for the new field.

  • pnpm tc, focused pnpm test, oxlint and pnpm run check:code-quality:changed all pass.

  • I manually tested these changes locally

  • 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

Security: nothing new is trusted. The server still resolves the worktree from its own catalog. Cross-platform: the worktree id uses the same repo path the server reports. SSH: SSH and local uploads ignore the worktree id and behave as before. Mobile: not affected. Compatibility: no wire change.

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)

…rt transaction

The new-workspace composer addressed a paired server's files by the project
path instead of the project's worktree id, so every drop onto a server-owned
project was refused with selector_not_found. Pass the repo's main worktree id
so the existing import transaction (unique temp, no-clobber commit, fenced
cleanup) runs against the right worktree.

Fixes #16558
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 61593851-d260-4b65-8c60-da35c77a0dbb

📥 Commits

Reviewing files that changed from the base of the PR and between 9d43038 and 52f4ac7.


📒 Files selected for processing (9)
  • src/renderer/src/components/NewWorkspaceComposerCard.file-drop.test.tsx
  • src/renderer/src/hooks/composer-state/attachment-drop-failure.test.tsx
  • src/renderer/src/hooks/composer-state/attachment-drop-lifetime.test.tsx
  • src/renderer/src/hooks/composer-state/attachment-drop-state.ts
  • src/renderer/src/hooks/composer-state/composer-attachment-drop-state.ts
  • src/renderer/src/hooks/composer-state/composer-attachment-target.test.ts
  • src/renderer/src/hooks/composer-state/composer-attachment-target.ts
  • src/renderer/src/hooks/composer-state/composer-remote-server-drop.test.tsx
  • src/renderer/src/hooks/composer-state/composer-source-model.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.



📝 Walkthrough

Walkthrough

Attachment target resolution now includes a worktree ID for ungrouped repository targets. Drop uploads forward the selected worktree ID and use it for runtime imports, with a repository-path fallback when it is nullish. New tests cover paired-server drops, duplicate filenames, and connection-generation or pairing-revision changes during upload.


Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 52f4a

This change lets file drops in the new-workspace composer reach paired-server projects. SSH and local uploads behave as before. No merge-blocking risk was found.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the main change: fixing client file drops for remote composer uploads through the import transaction. It is concise and specific.
Description check Passed The description covers the required sections, user impact, mechanism, rationale, linked issue, visual proof, testing, compatibility considerations, and checklist. Manual testing is unchecked, but this…
Linked Issues check Passed Issue [#16558] requires file drops to work for projects hosted by a remote Orca server. The composer now resolves the selected repository main worktree ID with getRepoMainWorktreeId and passes it to…
Out of Scope Changes check Passed The production changes are limited to composer attachment target resolution and propagation of the selected worktree ID into the existing upload path. The added and updated tests cover this behavior a…

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@OrcaWin
OrcaWin merged commit aea19ae into main Oct 10, 2026
72 of 76 checks passed
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.

[Bug]: Copy pasting files to remote orca server don't seem to work

1 participant