Skip to content

fix(repos): route icon and remote-identity probes on a resolved execution host - #18377

Merged
nwparker merged 1 commit into
mainfrom
fix/host-id-repo-icon-remote-identity
Sep 3, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/host-id-repo-icon-remote-identity

Conversation

@nwparker

@nwparker nwparker commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Step 5 of #18296's consolidation audit, and the same defect the four prior PRs closed (#18296, #18307, #18325, #18358): connectionId: string | null spells "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 shared getRepoExecutionHostId / getSshTargetIdForExecutionHost. No new resolver.

module before after
probeGitRemoteIdentity / detectGitRemoteIdentity connectionId?: string | null executionHostId: ExecutionHostId
detectRepoIcon / detectRepoIconAndUpstream / detectGitHubAvatarIcon connectionId?: string | null executionHostId: ExecutionHostId
detectRepoFileIcon { connectionId?, fsProvider? } ExecutionHostFilesystemRoute

Behavior changes

  1. repo-git-remote-identity-enrichment read repo.connectionId raw. A row minted with only executionHostId: 'ssh:<t>' (the spelling feat(ssh): host-stamped remote foreground identity #18078 now stamps at creation) ran git remote -v against 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.
  2. A 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.
  3. The enrichment location key had the same collapse (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 on getRepoExecutionHostId now.
  4. runtime-repository-fork-backfill guarded on repo.connectionId, so an executionHostId-only SSH row slipped through and had its upstream read off the client. It guards on getRepoSshConnectionId — the row's file-holding target — now.

Deliberate no-ops

  • Repo registration / clone / nested import / local + remote registration already passed the right thing or had no ambiguity; they now pass an explicit host id. Same behavior.
  • runtime-repository-registration-controller and runtime-repository-clone-controller stay local even when the row is stamped runtime:<env>. Those controllers validate, mkdir, git init and git clone in this process — assertCloneHostIsSupported states it outright ("cloneRepo runs git clone on the client"). A runtime: 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 ask getSshTargetIdForExecutionHost — the documented "what may this client dial" question — so a runtime: 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-creation

The audit lists it as a parameter-threaded module. It is a different problem and is untouched here. Its connectionId is not its own: it is the ForgeProvider.createReview(repoPath, input, connectionId, options) contract shared by five implementations (GitLab, GitHub, Bitbucket, Azure DevOps, Gitea), threaded from createHostedReview, which reads repo.connectionId ?? null at src/main/ipc/hosted-review.ts and runtime-hosted-review-commands.ts. The same value flows into getProjectSlug, getCurrentBranch, hasUncommittedChanges, getHostedReviewUpstreamStatus, getDefaultBaseRef, baseRefExistsOnRemote, isProviderAuthenticated, getHostedReviewForBranch and invalidateHostedReviewBranchCache — ~26 src/main/gitlab/ files plus ~10 in src/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: GitRemoteIdentity is {canonicalKey, remoteName, remoteUrl}, RepoIcon carries no host, and detectRepoIconAndUpstream returns only {repoIcon, gitRemoteIdentity, upstream}.

Verification

  • Failed-first: 19 of 66 in the five touched test files fail against unmodified source (proved twice — before implementing, and again against the final expectations by stashing only the source files).
  • Tests register two distinct SSH hosts simultaneously (m4air / openclaw, via the real registerSshGitProvider / registerSshFilesystemProvider registries rather than mocks) and cover runtime: with a nested SSH target whose name is also registered on this client, and without.
  • pnpm tc clean. pnpm test src: 69537 passed, 2 failed — wsl-hook-relay-manager and codex-tui-resume-real-binary, both pass in isolation and neither imports anything changed here.
  • pnpm run check:code-quality:changed: 0 new findings. max-lines proven to fire with a positive control (a padded copy reported File has too many lines (643)) and reports nothing on the real files.
  • Docker SSH lane: 24 passed, 0 failed on rerun. The first run had one failure, ssh-cold-hydration-gap-tab-seeding — a 120s poll on remoteWorkspaceHydratedTargetIds in the remote-workspace-snapshot subsystem, which shares no code with this change — and it passed on the second run.

…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`).
@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) | 𝕏

@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: 24ec2d68-37d2-404e-ad91-23d60bc3cc86

📥 Commits

Reviewing files that changed from the base of the PR and between 968dbd9 and 7ad984a.

📒 Files selected for processing (17)
  • src/main/ipc/repos/local-repo-registration.ts
  • src/main/ipc/repos/nested-repo-import-handler.ts
  • src/main/ipc/repos/remote-repo-registration.ts
  • src/main/ipc/repos/repo-clone-lifecycle.ts
  • src/main/ipc/repos/repo-creation-handlers.ts
  • src/main/repo-git-remote-identity-enrichment.test.ts
  • src/main/repo-git-remote-identity-enrichment.ts
  • src/main/repo-git-remote-identity.test.ts
  • src/main/repo-git-remote-identity.ts
  • src/main/repo-icon-autodetect.test.ts
  • src/main/repo-icon-autodetect.ts
  • src/main/repo-icon-file-detection.test.ts
  • src/main/repo-icon-file-detection.ts
  • src/main/runtime/repo-icon-fork-backfill.test.ts
  • src/main/runtime/runtime-repository-clone-controller.ts
  • src/main/runtime/runtime-repository-fork-backfill.ts
  • src/main/runtime/runtime-repository-registration-controller.ts

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


📝 Walkthrough

Walkthrough

Repository 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 7ad98

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.09% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 17 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly and concisely summarizes the main change: routing repository icon and remote-identity probes through resolved execution hosts.
Description check ✅ Passed 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 t…
Full details: Description check

Explanation

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.

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

@nwparker
nwparker merged commit 316ec38 into main Sep 3, 2026
27 of 28 checks passed
nwparker added a commit that referenced this pull request Sep 3, 2026
…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.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…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`).
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