Skip to content

fix(source-control): route hosted reviews by resolved execution host - #18382

Merged
nwparker merged 1 commit into
mainfrom
fix/hosted-review-execution-host
Sep 3, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/hosted-review-execution-host

Conversation

@nwparker

@nwparker nwparker commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 22 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​978 $\color{#cf222e}{\Huge{\mathbf{−}}}$​333 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​645
Prod 18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​280 $\color{#cf222e}{\Huge{\mathbf{−}}}$​124 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​156

Follow-up scoped out of #18377. Sixth in the series after #18296, #18307, #18325, #18358, #18377.

The defect

ForgeProvider.createReview(repoPath, input, connectionId, options) and the connectionId on ForgeProviderRepositoryContext carried the same collapse the five prior migrations closed: string | null spells "genuinely local", "runtime host" and "could not resolve" with one value.

The value was decided two layers up — repo.connectionId ?? null at the hostedReview:* IPC handlers and in RuntimeHostedReviewCommands — and from there it fanned out through getProjectSlug, getCurrentBranch, hasUncommittedChanges, getDefaultBaseRef, baseRefExistsOnRemote, getHostedReviewUpstreamStatus, isProviderAuthenticated and getHostedReviewForBranch. So a repo row naming its owner only as executionHostId: ssh:<target> ran the entire review path against this machine's copy of a remote path (#11163): git rev-parse --abbrev-ref HEAD, git status --porcelain, the base-on-remote ref probe, the upstream divergence read, and gh/glab with no host flags. A runtime: row handed its nested SSH target to this client's dispatch table — a same-named box of ours.

Fixed at the decision point, not at the leaf: getRepoHostedReviewExecutionHostId(repo) resolves the host where repo.connectionId ?? null used to be read, and a required ExecutionHostId is threaded through the contract. The forge clients themselves (src/main/gitlab/, src/main/github/, …) keep taking a connection id — the conversion happens once, at the contract boundary, through #18296's resolveGitRouteForHost.

Removed, not added beside

The parameter is removed, so all five implementations — GitLab, GitHub, Bitbucket, Azure DevOps, Gitea — and every caller became a compile error. This mattered more than usual: ExecutionHostId is a subtype of string, so leaving an implementation on connectionId?: string | null would still have satisfied a widened createReview signature and silently received 'ssh:host-a' as a connection id. Each of the five now takes executionHostId: ExecutionHostId and resolves it itself.

@ts-nocheck check (per #18325): none of src/main/source-control/, src/main/gitlab/, src/main/github/, src/main/bitbucket/, src/main/gitea/, src/main/azure-devops/, src/main/ipc/hosted-review.ts or src/main/runtime/runtime-hosted-review-commands.ts carries one, so the compile-error guarantee is real — the #18358 case, not the #18325 one. (src/main/runtime/orca-runtime-file-commands.ts does carry @ts-nocheck, but it only constructs RuntimeHostedReviewCommands with deps this PR does not change.)

Also fixed at the sites

  • The branch cache scoped entries on connectionId ?? ''. Two rows at one path on different hosts shared one cached review, one backoff deadline and one invalidation. Now keyed on the resolved host, the same collapse fix(repos): route icon and remote-identity probes on a resolved execution host #18377 fixed for its probe location key.
  • hostedReview:create read the raw field for file-holder questions. An executionHostId-only SSH row resolved shared symlink paths locally (reading an unrelated orca.yaml, the exact thing the existing comment warns about) and resolve()d a remote POSIX worktree path. Those ask getRepoSshConnectionId — "which host holds the files" — not the dialable one.
  • An unreachable SSH host no longer falls through to the local branch in the git-state layer. provider: null is "remote and currently unreachable", which is not "local" (docs/reference/ssh-execution-boundary.md).

The runtime: exception

hostedReviewSshConnectionId throws for runtime: — that environment's server runs its own git, and the SSH target on its repo row is nested in that server's namespace.

But store-backed callers ask getRepoHostedReviewExecutionHostId first, which is the "what may this client dial" question and answers local for a runtime: row. That is deliberate and matches #18377's exception: RuntimeRepositoryRegistrationController.add only adopts a runtime: stamp onto a row with no connectionId (runtimeRepoMatchesExecutionHost refuses to match a row that already names an SSH owner), so the checkout really is in this process. Refusing would have regressed a runtime server creating reviews for its own rows — the same shape as #18377's git clone finding. Both branches are covered by tests.

Wire compatibility

No wire change. connectionId on CreateHostedReviewArgs, CreateStackedHostedReviewArgs and HostedReviewCreationEligibilityArgs in src/shared/hosted-review.ts is untouched. Every host already ignores it in favour of the repo row it looked up, so it is inert request content; removing it from the request types would only churn a schema older clients still populate, with nothing gained. The main-side eligibility input Omits it instead, so nothing on this side can read the ambiguous field again. Nothing this PR touches is published content — no result field carries a host id.

Verification

  • pnpm tc — clean.
  • pnpm test src — whole tree. 7467 files pass. One unrelated file (src/main/runtime/rpc/terminal-output-frame-chunks-equivalence.test.ts, an 800-iteration fuzz) hit the 30s vitest timeout under full-tree load and passes in 11.3s on its own; it touches no hosted-review code.
  • pnpm run check:code-quality:changed — 0 new findings across 40 changed files.
  • oxlint — clean. max-lines was proven to fire first with a 400-line positive control (it caught hosted-review-creation-eligibility.test.ts crossing 800 and was resolved by collapsing a repeated fixture, not by a disable or a bump).
  • oxfmt --check — clean.
  • Docker SSH lane (pnpm test:e2e:ssh-docker).

Failed-first: 9 of 14

src/main/source-control/hosted-review-execution-host-routing.test.ts drives the two decision points through their unchanged public entry points (RuntimeHostedReviewCommands), so it runs against the pre-change tree. 9 failed / 5 passed before the change.

Two SSH targets (ssh-a, ssh-b) are registered simultaneously in every case, and the runtime: cases reuse ssh-b as the nested target so a wrong-namespace dial cannot hide behind a matching name. Four forge providers are exercised — GitHub, GitLab, Bitbucket, Azure DevOps, plus Gitea in the runtime-stamp case — since this is a shared contract.

Failed first (9):

  • GitHub review lookup on an executionHostId-only SSH row
  • GitLab review lookup where connectionId names a different registered target
  • Bitbucket lookup on a runtime: row must not dial this client's same-named ssh-b
  • branch cache must not serve one host's answer to a row at the same path on another host
  • GitLab create: preflight git and the create must both land on ssh-a, never local
  • GitHub create: preflight must follow executionHostId, not connectionId
  • Bitbucket create on a runtime: row must stay local rather than dial the nested target
  • Azure DevOps creation eligibility on an executionHostId-only SSH row
  • getRepoSlug on an executionHostId-only SSH row

Passed before and after — intended no-ops (5):

  • Gitea lookup on a runtime: row with no nested target. connectionId ?? null already answered null; the test pins the self-addressed-stamp exception so a future "refuse runtime" change has to confront it.
  • Legacy connectionId-only SSH row keeps its target. Regression guard for the incumbent spelling.
  • Three unit tests on the new module's refusal contract (runtime: throws; both SSH spellings resolve; a runtime: row in this store reads as local with and without a nested target). They exercise a module this PR adds, so they cannot fail against a tree that lacks it — they exist to keep the exception from being silently widened.

`ForgeProvider.createReview(repoPath, input, connectionId, options)` and the
`connectionId` on `ForgeProviderRepositoryContext` carried the same collapse the
five prior migrations closed: `string | null` spells "genuinely local", "runtime
host" and "could not resolve" with one value. Because it was decided two layers
up -- `repo.connectionId ?? null` at the `hostedReview:*` IPC handlers and in
`RuntimeHostedReviewCommands` -- a row naming its owner only as
`executionHostId: ssh:<target>` ran the whole review path against this machine's
copy of a remote path (#11163): `git rev-parse`, `git status`, the base-on-remote
ref probe, the upstream divergence read, and `gh`/`glab` with no host flags.

Replace it with a required `ExecutionHostId` threaded from the decision point
through the contract, routed by #18296's `resolveGitRouteForHost`. The parameter
is removed rather than added beside, so all five implementations -- GitLab,
GitHub, Bitbucket, Azure DevOps, Gitea -- and every caller became a compile
error. None of these families carries `@ts-nocheck`, so unlike #18325 that
guarantee is real here; `orca-runtime-file-commands.ts` does, but it only
constructs `RuntimeHostedReviewCommands` with unchanged deps.

Also fixed at the sites:

- The branch cache scoped entries on `connectionId ?? ''`, so two rows at one
  path on different hosts shared one cached review, one backoff deadline and one
  invalidation. Keyed on the resolved host now, as #18377 did for its probe key.
- `hostedReview:create` resolved shared symlink paths and normalized worktree
  paths off the raw field, so an `executionHostId`-only SSH row read `orca.yaml`
  and `resolve()`d a remote POSIX path on the client. Those ask the file-holder
  question -- `getRepoSshConnectionId` -- not the dialable one.
- An SSH host with no provider now refuses inside the git-state layer instead of
  reaching the local branch, keeping "remote and unreachable" distinct from
  "local" (docs/reference/ssh-execution-boundary.md).

`runtime:` is a routing mistake inside `hostedReviewSshConnectionId` -- that
environment's server runs its own git, and the SSH target on its repo row is
nested in that server's namespace, so dialing it here reaches a same-named box of
ours. But store-backed callers ask `getRepoHostedReviewExecutionHostId` first,
which is "what may this client dial" and answers `local` for a `runtime:` row.
That is deliberate and matches #18377: the runtime registration controller only
adopts a `runtime:` stamp onto a row with no `connectionId`
(`runtimeRepoMatchesExecutionHost` refuses to match an SSH row), so the checkout
really is in this process and refusing would regress a runtime server creating
reviews for its own rows.

No wire change. `connectionId` on `CreateHostedReviewArgs`,
`CreateStackedHostedReviewArgs` and `HostedReviewCreationEligibilityArgs` in
src/shared/hosted-review.ts is untouched -- every host already ignores it in
favor of the repo row, and removing it from the request types would only churn
the schema older clients still populate. The main-side eligibility input `Omit`s
it so nothing on this side can read the ambiguous field again.
@pullfrog

pullfrog Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit d05dd8e into main Sep 3, 2026
27 of 28 checks passed
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: ea7979a3-d3e5-45c7-a4ca-f94aede72a86

📥 Commits

Reviewing files that changed from the base of the PR and between 573537e and 5198a11.

📒 Files selected for processing (40)
  • src/main/azure-devops/pull-request-creation.test.ts
  • src/main/azure-devops/pull-request-creation.ts
  • src/main/bitbucket/pull-request-creation.test.ts
  • src/main/bitbucket/pull-request-creation.ts
  • src/main/gitea/pull-request-creation.test.ts
  • src/main/gitea/pull-request-creation.ts
  • src/main/github/client-create-pr.test.ts
  • src/main/github/client/create/create-github-pull-request.ts
  • src/main/github/stacked-pr-creation.test.ts
  • src/main/github/stacked-pr-creation.ts
  • src/main/gitlab/merge-request-creation.test.ts
  • src/main/gitlab/merge-request-creation.ts
  • src/main/ipc/hosted-review.test.ts
  • src/main/ipc/hosted-review.ts
  • src/main/ipc/worktree-remote.ts
  • src/main/runtime/orca-runtime-tests/hooks-and-hosted-review-part-02.spec.ts
  • src/main/runtime/runtime-hosted-review-commands.ts
  • src/main/runtime/runtime-worktree-create-git.ts
  • src/main/source-control/forge-provider.test.ts
  • src/main/source-control/forge-provider.ts
  • src/main/source-control/hosted-review-azure-devops.integration.test.ts
  • src/main/source-control/hosted-review-base-ref-suffix.test.ts
  • src/main/source-control/hosted-review-bitbucket.integration.test.ts
  • src/main/source-control/hosted-review-branch-cache.test.ts
  • src/main/source-control/hosted-review-branch-cache.ts
  • src/main/source-control/hosted-review-creation-eligibility.test.ts
  • src/main/source-control/hosted-review-creation-git-state.ts
  • src/main/source-control/hosted-review-creation-gitlab-self-hosted.test.ts
  • src/main/source-control/hosted-review-creation-provider.ts
  • src/main/source-control/hosted-review-creation-shared-symlinks.test.ts
  • src/main/source-control/hosted-review-creation.test.ts
  • src/main/source-control/hosted-review-creation.ts
  • src/main/source-control/hosted-review-dirty-preflight-wsl-paths.test.ts
  • src/main/source-control/hosted-review-execution-host-routing.test.ts
  • src/main/source-control/hosted-review-execution-host.ts
  • src/main/source-control/hosted-review-gitea.integration.test.ts
  • src/main/source-control/hosted-review.test.ts
  • src/main/source-control/hosted-review.ts
  • src/main/source-control/stacked-hosted-review-creation.test.ts
  • src/main/source-control/stacked-hosted-review-creation.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

Hosted-review APIs now require ExecutionHostId values. SSH connection IDs are derived from ssh: host identifiers, while local and runtime routes use explicit handling. Git operations, forge providers, cache keys, eligibility checks, creation flows, stacked reviews, IPC handlers, runtime commands, and related tests now use the new execution-host contract.

Merge Risk: ⚪ Minimal · up to 5198a

Hosted-review execution routing consistently uses resolved execution-host identifiers across provider, cache, creation, IPC, and runtime paths.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 24.44% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 45 functions across 40 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 and concisely describes the main change: routing hosted reviews by the resolved execution host.
Description check ✅ Passed The description thoroughly explains the defect, implementation, scope, runtime exception, compatibility impact, and verification. It does not use the repository template headings and omits an explicit…
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 thoroughly explains the defect, implementation, scope, runtime exception, compatibility impact, and verification. It does not use the repository template headings and omits an explicit Linked Issue entry, Visual Proof/N/A statement, checklist responses, and agent-boundary section.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#18382)

`ForgeProvider.createReview(repoPath, input, connectionId, options)` and the
`connectionId` on `ForgeProviderRepositoryContext` carried the same collapse the
five prior migrations closed: `string | null` spells "genuinely local", "runtime
host" and "could not resolve" with one value. Because it was decided two layers
up -- `repo.connectionId ?? null` at the `hostedReview:*` IPC handlers and in
`RuntimeHostedReviewCommands` -- a row naming its owner only as
`executionHostId: ssh:<target>` ran the whole review path against this machine's
copy of a remote path (stablyai#11163): `git rev-parse`, `git status`, the base-on-remote
ref probe, the upstream divergence read, and `gh`/`glab` with no host flags.

Replace it with a required `ExecutionHostId` threaded from the decision point
through the contract, routed by stablyai#18296's `resolveGitRouteForHost`. The parameter
is removed rather than added beside, so all five implementations -- GitLab,
GitHub, Bitbucket, Azure DevOps, Gitea -- and every caller became a compile
error. None of these families carries `@ts-nocheck`, so unlike stablyai#18325 that
guarantee is real here; `orca-runtime-file-commands.ts` does, but it only
constructs `RuntimeHostedReviewCommands` with unchanged deps.

Also fixed at the sites:

- The branch cache scoped entries on `connectionId ?? ''`, so two rows at one
  path on different hosts shared one cached review, one backoff deadline and one
  invalidation. Keyed on the resolved host now, as stablyai#18377 did for its probe key.
- `hostedReview:create` resolved shared symlink paths and normalized worktree
  paths off the raw field, so an `executionHostId`-only SSH row read `orca.yaml`
  and `resolve()`d a remote POSIX path on the client. Those ask the file-holder
  question -- `getRepoSshConnectionId` -- not the dialable one.
- An SSH host with no provider now refuses inside the git-state layer instead of
  reaching the local branch, keeping "remote and unreachable" distinct from
  "local" (docs/reference/ssh-execution-boundary.md).

`runtime:` is a routing mistake inside `hostedReviewSshConnectionId` -- that
environment's server runs its own git, and the SSH target on its repo row is
nested in that server's namespace, so dialing it here reaches a same-named box of
ours. But store-backed callers ask `getRepoHostedReviewExecutionHostId` first,
which is "what may this client dial" and answers `local` for a `runtime:` row.
That is deliberate and matches stablyai#18377: the runtime registration controller only
adopts a `runtime:` stamp onto a row with no `connectionId`
(`runtimeRepoMatchesExecutionHost` refuses to match an SSH row), so the checkout
really is in this process and refusing would regress a runtime server creating
reviews for its own rows.

No wire change. `connectionId` on `CreateHostedReviewArgs`,
`CreateStackedHostedReviewArgs` and `HostedReviewCreationEligibilityArgs` in
src/shared/hosted-review.ts is untouched -- every host already ignores it in
favor of the repo row, and removing it from the request types would only churn
the schema older clients still populate. The main-side eligibility input `Omit`s
it so nothing on this side can read the ambiguous field again.
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