Skip to content

fix(runtime): new local projects never dedupe onto an SSH project at the same path - #31055

Merged
nwparker merged 3 commits into
mainfrom
nwparker/host-qualified-project-dedupe
Oct 20, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/host-qualified-project-dedupe

Conversation

@nwparker

@nwparker nwparker commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​263 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​263
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​33 $\color{#cf222e}{\Huge{\mathbf{−}}}$​23 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​10

ELI5

When you create a new local project, Orca first checks whether you already have a project at that folder, so it doesn't add the same project twice. The check compared folder paths only. If an SSH machine had a project at the same path (say /home/me/notes), creating a local project there silently handed you the SSH project instead. No local folder was made and no local project was added.

What Changed

  • Before: RuntimeRepositoryRegistrationController.create matched any project at the target path on any machine. add with no host given (repo.add) matched across machines too.
  • After: registration dedupes only against projects whose files are on this machine. Both use one predicate, runtimeRepoIsRegistrationCandidate (src/main/runtime/runtime-worktree-selection.ts): the existing same-host match, plus "not an SSH row" through the shared getRepoSshConnectionId. add, create (both its first check and its race re-check) and the clone controller, which had its own copy of the same rule inline, all go through it. A project already registered locally at that path is still returned instead of being duplicated.

Why

Registration reads and creates the folder on this machine, so an SSH row at the same path string is a different directory on a different machine. Using one predicate for all three registration paths keeps them from drifting apart. The clone controller already had this fix; add and create didn't.

Codex review 6, item #7.

Linked Issue

N/A (internal review finding: Codex review 6 #7).

Visual Proof

N/A. Server-side registration logic only; nothing is drawn differently.

Testing

  • Automated tests added/updated, or explained why not below
  • New src/main/runtime/runtime-repository-registration-host-dedupe.test.ts runs the real controller on a temp directory. On main, all four SSH cases fail (create and add, with both SSH spellings), and create makes no directory. With the fix, all pass, and the "local project already there is returned" case still passes.
  • Existing runtime-repository-registration-controller.test.ts still passes.
  • Live verification: none beyond the real-filesystem controller test.

Review

  • Codex (gpt-6.1-sol, high): no findings.

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: this is the SSH fix. Folder workspaces are covered: the tests use folder projects. Wire format: unchanged.

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)

…machine

Codex review 6 #7: create() matched paths across hosts, so creating a local
project at a path an SSH project used returned the SSH row and made no
directory. add() with no host had the same gap. One predicate,
runtimeRepoIsRegistrationCandidate, now backs add, create and clone.
@coderabbitai

coderabbitai Bot commented Oct 20, 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: b95cc377-bb99-4148-9a76-aec251bb59d9
📥 Commits

Reviewing files that changed from the base of the PR and between 384278d and 58956ba.

📒 Files selected for processing: 2
  • src/main/runtime/runtime-repository-clone-host-dedupe.test.ts
  • src/main/runtime/runtime-repository-registration-host-dedupe.test.ts

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

📝 Walkthrough

Runtime repository registration and clone reuse now use runtimeRepoIsRegistrationCandidate to check execution-host compatibility and exclude repositories with an SSH connection ID. Registration and clone tests cover local and SSH repositories that share a path, including multiple SSH identity field spellings.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 58956

No issue requiring a fix before merge was established. The tested SSH collision permits a separate local clone.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary fix: preventing local projects from deduplicating onto SSH projects at the same path.
Description check Passed The description follows the required template and explains the user impact, implementation, rationale, testing, scope, and compatibility considerations. It documents that lint, typecheck, full test, a…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description follows the required template and explains the user impact, implementation, rationale, testing, scope, and compatibility considerations. It documents that lint, typecheck, full test, and build commands were not confirmed, and it marks the linked issue as an internal review finding.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • 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.

…d dedupe

Review follow-up (Opus P3s): runtime:<env> rows carrying a nested SSH
connectionId, add() for a runtime host, the clone controller, and a stricter
create() assertion.
@nwparker
nwparker merged commit 2d41a26 into main Oct 20, 2026
35 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.

1 participant