Skip to content

fix(runtime): PR/MR worktree base refuses SSH projects named only by executionHostId - #31054

Merged
nwparker merged 3 commits into
mainfrom
nwparker/host-id-worktree-base
Oct 20, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/host-id-worktree-base

Conversation

@nwparker

@nwparker nwparker commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When you start a workspace from a pull request (GitHub) or merge request (GitLab), Orca first works out which branch to start from. For a project that lives on an SSH machine, Orca must not do that work on this computer. It checked an old field to decide "is this an SSH project?", and newer projects don't always fill that field in. Those projects slipped through and Orca ran git fetch on this computer instead.

What Changed

  • Before: a project whose row records its machine only as executionHostId: 'ssh:<target>' (no legacy connectionId) passed the "is this SSH?" guard in resolveRuntimeGitHubWorktreeBase / resolveRuntimeGitLabWorktreeBase. The server then ran git fetch in a local directory with the same path and returned a local commit as the base for a remote project.
  • After: both guards go through one new gate, requireRepoLocalGitRoute (src/main/repo-execution-host.ts).
    • It resolves the row's stored host (getStoredRepoExecutionHostId) and passes it to the existing requireReachableGitRoute.
    • It also refuses any row that still carries a connectionId: a nested SSH target, or a stale one beside local.
    • An SSH project of either spelling is refused with SshHostNotServedError, the same error the legacy spelling already got.
    • Projects registered on this server, including older rows that kept a client-minted runtime:<id> stamp, still resolve locally.

Why

The gate is built from the existing resolvers (getStoredRepoExecutionHostId, requireReachableGitRoute), so these guards answer the same way the rest of the main process does. A follow-up PR adds a ratchet that flags new raw connectionId host checks and points at this gate.

Codex review 6, item #4.

Linked Issue

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

Visual Proof

N/A. This changes server-side routing only; nothing is drawn differently.

Testing

  • Automated tests added/updated, or explained why not below
  • New src/main/runtime/runtime-review-worktree-base-execution-host.test.ts. On main, the two executionHostId-only cases fail: they returned a local SHA after a local git fetch. With the fix, they pass. The test covers four refused row shapes (SSH by either spelling, a stale connectionId beside local, a nested SSH target beside runtime:) and two local shapes (local, and a runtime: stamp), for both GitHub and GitLab.
  • Live verification: none. Only the server's own guard changed, and the unit test drives it with the real resolver and a mocked git runner.

Review

  • Codex (gpt-6.1-sol, high):
    • Round 1: no findings.
    • Later round: one P2, fixed. An earlier revision refused runtime:-stamped rows, which older servers keep on rows they own.
  • Opus:
    • P3: a local row with a stale connectionId became local. Fixed: it now refuses.
    • P3: make base resolution refuse runtime: rows the way create does. Declined: those rows are this server's own files, see the Codex point above. Create's refusal of them already exists on main and is separate.

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. Mobile and wire format: unchanged. Cross-platform: no path handling changed.

Rows with contradictory host fields are refused rather than guessed.

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)

…executionHostId

Codex review 6 #4: the guard read the legacy connectionId, so a row stamped
executionHostId 'ssh:<target>' without it ran git fetch on this machine.
@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: 657b3855-d017-4158-8b1b-559d43424c82
📥 Commits

Reviewing files that changed from the base of the PR and between 4fd2ebf and aad97a9.

📒 Files selected for processing: 4
  • src/main/repo-execution-host.ts
  • src/main/runtime/runtime-github-worktree-base.ts
  • src/main/runtime/runtime-gitlab-worktree-base.ts
  • src/main/runtime/runtime-review-worktree-base-execution-host.test.ts
🚧 Files skipped from review as they are similar to previous changes: 2
  • src/main/runtime/runtime-github-worktree-base.ts
  • src/main/runtime/runtime-gitlab-worktree-base.ts

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

📝 Walkthrough

The repository execution-host module now provides requireRepoLocalGitRoute. The GitHub and GitLab runtime worktree resolvers use it before Git execution. Tests cover SSH, legacy, stale, contradictory local, runtime-host, and local repository data.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to aad97

SSH projects identified only by an execution host are now refused instead of running a local fetch. Local and server-local rows continue to resolve locally. No remaining merge-blocking risk was found.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 4 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 identifies the runtime fix and the affected SSH projects that use only executionHostId.
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.
Description check Passed The description covers the required sections. It explains the change, reason, testing, scope, review findings, and checklist status. It identifies the linked issue as an internal review finding rather…
Full details: Description check

Explanation

The description covers the required sections. It explains the change, reason, testing, scope, review findings, and checklist status. It identifies the linked issue as an internal review finding rather than providing an issue link, which is acceptable for this stated internal change.

  • 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.

…grees with create

Review follow-up: a local row with a stale connectionId and runtime: rows now
refuse too (create already refused runtime: rows), through
requireRepoLocalGitRoute in repo-execution-host.ts.
…er owns

Codex follow-up: older servers keep a client-minted runtime:<id> stamp on
rows whose files are here, and base resolution worked for them before.
requireRepoLocalGitRoute reads the stored host (getStoredRepoExecutionHostId),
so they run locally again; SSH rows and any row with a connectionId still
refuse.
@nwparker
nwparker merged commit 41f1580 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