Repository navigation
fix(source-control): route hosted reviews by resolved execution host - #18382
Conversation
`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.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (40)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughHosted-review APIs now require Merge Risk: ⚪ Minimal · up to 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)
✅ Passed checks (4 passed)
Full details: Description checkExplanation 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.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
…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.

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 theconnectionIdonForgeProviderRepositoryContextcarried the same collapse the five prior migrations closed:string | nullspells "genuinely local", "runtime host" and "could not resolve" with one value.The value was decided two layers up —
repo.connectionId ?? nullat thehostedReview:*IPC handlers and inRuntimeHostedReviewCommands— and from there it fanned out throughgetProjectSlug,getCurrentBranch,hasUncommittedChanges,getDefaultBaseRef,baseRefExistsOnRemote,getHostedReviewUpstreamStatus,isProviderAuthenticatedandgetHostedReviewForBranch. So a repo row naming its owner only asexecutionHostId: 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, andgh/glabwith no host flags. Aruntime: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 whererepo.connectionId ?? nullused to be read, and a requiredExecutionHostIdis 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'sresolveGitRouteForHost.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:
ExecutionHostIdis a subtype ofstring, so leaving an implementation onconnectionId?: string | nullwould still have satisfied a widenedcreateReviewsignature and silently received'ssh:host-a'as a connection id. Each of the five now takesexecutionHostId: ExecutionHostIdand resolves it itself.@ts-nocheckcheck (per #18325): none ofsrc/main/source-control/,src/main/gitlab/,src/main/github/,src/main/bitbucket/,src/main/gitea/,src/main/azure-devops/,src/main/ipc/hosted-review.tsorsrc/main/runtime/runtime-hosted-review-commands.tscarries one, so the compile-error guarantee is real — the #18358 case, not the #18325 one. (src/main/runtime/orca-runtime-file-commands.tsdoes carry@ts-nocheck, but it only constructsRuntimeHostedReviewCommandswith deps this PR does not change.)Also fixed at the sites
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:createread the raw field for file-holder questions. AnexecutionHostId-only SSH row resolved shared symlink paths locally (reading an unrelatedorca.yaml, the exact thing the existing comment warns about) andresolve()d a remote POSIX worktree path. Those askgetRepoSshConnectionId— "which host holds the files" — not the dialable one.provider: nullis "remote and currently unreachable", which is not "local" (docs/reference/ssh-execution-boundary.md).The
runtime:exceptionhostedReviewSshConnectionIdthrows forruntime:— 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
getRepoHostedReviewExecutionHostIdfirst, which is the "what may this client dial" question and answerslocalfor aruntime:row. That is deliberate and matches #18377's exception:RuntimeRepositoryRegistrationController.addonly adopts aruntime:stamp onto a row with noconnectionId(runtimeRepoMatchesExecutionHostrefuses 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'sgit clonefinding. Both branches are covered by tests.Wire compatibility
No wire change.
connectionIdonCreateHostedReviewArgs,CreateStackedHostedReviewArgsandHostedReviewCreationEligibilityArgsinsrc/shared/hosted-review.tsis 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 inputOmits 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-lineswas proven to fire first with a 400-line positive control (it caughthosted-review-creation-eligibility.test.tscrossing 800 and was resolved by collapsing a repeated fixture, not by a disable or a bump).oxfmt --check— clean.pnpm test:e2e:ssh-docker).Failed-first: 9 of 14
src/main/source-control/hosted-review-execution-host-routing.test.tsdrives 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 theruntime:cases reusessh-bas 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):
executionHostId-only SSH rowconnectionIdnames a different registered targetruntime:row must not dial this client's same-namedssh-bssh-a, never localexecutionHostId, notconnectionIdruntime:row must stay local rather than dial the nested targetexecutionHostId-only SSH rowgetRepoSlugon anexecutionHostId-only SSH rowPassed before and after — intended no-ops (5):
runtime:row with no nested target.connectionId ?? nullalready answerednull; the test pins the self-addressed-stamp exception so a future "refuse runtime" change has to confront it.connectionId-only SSH row keeps its target. Regression guard for the incumbent spelling.runtime:throws; both SSH spellings resolve; aruntime:row in this store reads aslocalwith 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.