Repository navigation
fix(files): client drops on a remote composer upload through the import transaction - #27227
Conversation
…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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to 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 |
|
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/dropsfolder) and put the server-side path into the prompt. Instead the drop failed with a crypticselector_not_founderror. Now the file lands on the server and its path is attached.What Changed
selector_not_foundtoast and attached nothing. SSH and local projects worked.<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.tsxruns 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:/srv/repo/.orca/drops/and every file call targets the project's worktree (onorigin/mainthis fails withselector_not_found)origin/main)origin/main)Updated the existing composer target and drop tests for the new field.
pnpm tc, focusedpnpm test, oxlint andpnpm run check:code-quality:changedall pass.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
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
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)