Repository navigation
fix(repos): route icon and remote-identity probes on a resolved execution host - #18377
Conversation
…tion host `detectRepoIcon`, `detectRepoIconAndUpstream`, `detectGitHubAvatarIcon`, `detectRepoFileIcon` and `probeGitRemoteIdentity` took a `connectionId`-shaped parameter threaded down from their callers. That shape spells "runtime host", "unresolved" and "genuinely local" all as one falsy value, and because it is a *parameter* each caller decided independently what to pass — a wrong answer was invisible at the boundary. Replace it with a required `ExecutionHostId` and route through #18296's `resolveGitRouteForHost` / `resolveFilesystemRouteForHost`. The parameter is removed rather than added beside, so every caller became a compile error. No new resolver, no wire change: nothing these modules return carries a host id. Fixed at the call sites: - `repo-git-remote-identity-enrichment` read `repo.connectionId` raw, so a row minted with only `executionHostId: ssh:<t>` ran `git remote -v` against this machine's copy of the path (#11163), and a `runtime:` row handed its *nested* SSH target to this client's dispatch table — a same-named box of ours. - Its location key had the same collapse, so two rows at one path on different hosts shared a probe, an abort controller and a backoff deadline. - `runtime-repository-fork-backfill` guarded on `repo.connectionId`, so an `executionHostId`-only SSH row had its upstream read off the client. `runtime:` is refused inside the modules (this process does not execute another environment's git or filesystem), but store-backed callers ask `getSshTargetIdForExecutionHost` — "what may this client dial" — so a `runtime:` row keeps the probe this process has always run for it. Registering and cloning stay `local` on purpose: those controllers do the filesystem work here, whatever host id is stamped on the row (see `assertCloneHostIsSupported`).
|
|
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 (17)
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughRepository metadata detection now uses explicit execution-host IDs. Git probes resolve local, SSH, and runtime routes. Icon detection uses resolved filesystem routes and skips runtime hosts. Identity enrichment keys and probes repositories by execution host. Registration, cloning, and runtime backfill handlers pass local or SSH host identifiers and skip repositories stored on SSH hosts. Tests cover host-specific routing, runtime refusal, and same-path repositories on different hosts. Merge Risk: ⚪ Minimal · up to Repository metadata probing now targets the correct execution host and safely refuses unsupported runtime routes. The change is ready to merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description is detailed, focused, and covers the change, rationale, behavior changes, scope boundaries, compatibility, linked issue context, and verification results. It does not reproduce every template heading or checklist item, but the substantive information is mostly complete.
✨ 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 |
…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 (#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.
…tion host (stablyai#18377) `detectRepoIcon`, `detectRepoIconAndUpstream`, `detectGitHubAvatarIcon`, `detectRepoFileIcon` and `probeGitRemoteIdentity` took a `connectionId`-shaped parameter threaded down from their callers. That shape spells "runtime host", "unresolved" and "genuinely local" all as one falsy value, and because it is a *parameter* each caller decided independently what to pass — a wrong answer was invisible at the boundary. Replace it with a required `ExecutionHostId` and route through stablyai#18296's `resolveGitRouteForHost` / `resolveFilesystemRouteForHost`. The parameter is removed rather than added beside, so every caller became a compile error. No new resolver, no wire change: nothing these modules return carries a host id. Fixed at the call sites: - `repo-git-remote-identity-enrichment` read `repo.connectionId` raw, so a row minted with only `executionHostId: ssh:<t>` ran `git remote -v` against this machine's copy of the path (stablyai#11163), and a `runtime:` row handed its *nested* SSH target to this client's dispatch table — a same-named box of ours. - Its location key had the same collapse, so two rows at one path on different hosts shared a probe, an abort controller and a backoff deadline. - `runtime-repository-fork-backfill` guarded on `repo.connectionId`, so an `executionHostId`-only SSH row had its upstream read off the client. `runtime:` is refused inside the modules (this process does not execute another environment's git or filesystem), but store-backed callers ask `getSshTargetIdForExecutionHost` — "what may this client dial" — so a `runtime:` row keeps the probe this process has always run for it. Registering and cloning stay `local` on purpose: those controllers do the filesystem work here, whatever host id is stamped on the row (see `assertCloneHostIsSupported`).
…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.

Step 5 of #18296's consolidation audit, and the same defect the four prior PRs closed (#18296, #18307, #18325, #18358):
connectionId: string | nullspells "runtime host", "unresolved" and "genuinely local" as one value. Here it was worse in one respect — the ambiguity lived in a parameter, so each caller independently decided what to pass and a wrong answer was invisible at the boundary.Technique
Neither of the three families carries
@ts-nocheck, so the parameter was removed rather than added beside — every caller became a compile error, the property that made #18307 and #18358 safe. No ratchet test was needed.Routing goes through #18296's existing resolvers (
resolveGitRouteForHost/resolveFilesystemRouteForHost) and the sharedgetRepoExecutionHostId/getSshTargetIdForExecutionHost. No new resolver.probeGitRemoteIdentity/detectGitRemoteIdentityconnectionId?: string | nullexecutionHostId: ExecutionHostIddetectRepoIcon/detectRepoIconAndUpstream/detectGitHubAvatarIconconnectionId?: string | nullexecutionHostId: ExecutionHostIddetectRepoFileIcon{ connectionId?, fsProvider? }ExecutionHostFilesystemRouteBehavior changes
repo-git-remote-identity-enrichmentreadrepo.connectionIdraw. A row minted with onlyexecutionHostId: 'ssh:<t>'(the spelling feat(ssh): host-stamped remote foreground identity #18078 now stamps at creation) rangit remote -vagainst this machine's copy of the path — the reproduced [Bug]: SSH worktree/terminal operations are validated locally instead of routing to the connected SSH target (DaemonProtocolError: working directory does not exist) #11163 leak. It now probes on that host.runtime:row handed its nested SSH target to this client's dispatch table. That id is addressable only as the pair(environmentId, targetId), so dialing it here reached a same-named box of ours — a silent wrong-host answer. It no longer can.connectionId ?? 'local'). Two rows at one path on different hosts shared a probe, an abort controller and a backoff deadline, so one host being down suppressed the other's probe entirely. Keyed ongetRepoExecutionHostIdnow.runtime-repository-fork-backfillguarded onrepo.connectionId, so anexecutionHostId-only SSH row slipped through and had its upstream read off the client. It guards ongetRepoSshConnectionId— the row's file-holding target — now.Deliberate no-ops
runtime-repository-registration-controllerandruntime-repository-clone-controllerstaylocaleven when the row is stampedruntime:<env>. Those controllers validate,mkdir,git initandgit clonein this process —assertCloneHostIsSupportedstates it outright ("cloneReporunsgit cloneon the client"). Aruntime:stamp there is how a paired client addresses the row, not a second machine holding the files.runtime:is refused inside the modules (this process does not execute another environment's git or filesystem), but store-backed callers askgetSshTargetIdForExecutionHost— the documented "what may this client dial" question — so aruntime:row keeps the probe this process has always run for it. Refusing there would regress a runtime server enriching its own rows.Not in scope:
gitlab/merge-request-creationThe audit lists it as a parameter-threaded module. It is a different problem and is untouched here. Its
connectionIdis not its own: it is theForgeProvider.createReview(repoPath, input, connectionId, options)contract shared by five implementations (GitLab, GitHub, Bitbucket, Azure DevOps, Gitea), threaded fromcreateHostedReview, which readsrepo.connectionId ?? nullatsrc/main/ipc/hosted-review.tsandruntime-hosted-review-commands.ts. The same value flows intogetProjectSlug,getCurrentBranch,hasUncommittedChanges,getHostedReviewUpstreamStatus,getDefaultBaseRef,baseRefExistsOnRemote,isProviderAuthenticated,getHostedReviewForBranchandinvalidateHostedReviewBranchCache— ~26src/main/gitlab/files plus ~10 insrc/main/source-control/.Removing the parameter from the GitLab implementation alone breaks
satisfies ForgeProvider, leaves the four siblings with the identical defect, and does not close it — the decision is made two layers up. This is a whole-forge-provider migration and should get its own PR.Wire compatibility
No wire change. Neither module puts a host id into anything crossing the wire or persisted for a client:
GitRemoteIdentityis{canonicalKey, remoteName, remoteUrl},RepoIconcarries no host, anddetectRepoIconAndUpstreamreturns only{repoIcon, gitRemoteIdentity, upstream}.Verification
m4air/openclaw, via the realregisterSshGitProvider/registerSshFilesystemProviderregistries rather than mocks) and coverruntime:with a nested SSH target whose name is also registered on this client, and without.pnpm tcclean.pnpm test src: 69537 passed, 2 failed —wsl-hook-relay-managerandcodex-tui-resume-real-binary, both pass in isolation and neither imports anything changed here.pnpm run check:code-quality:changed: 0 new findings.max-linesproven to fire with a positive control (a padded copy reportedFile has too many lines (643)) and reports nothing on the real files.ssh-cold-hydration-gap-tab-seeding— a 120s poll onremoteWorkspaceHydratedTargetIdsin the remote-workspace-snapshot subsystem, which shares no code with this change — and it passed on the second run.