Skip to content

fix(runtime): route runtime Git by resolved execution host, not repo connectionId - #18307

Merged
nwparker merged 1 commit into
mainfrom
fix/runtime-git-target-execution-host
Sep 3, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/runtime-git-target-execution-host

Conversation

@nwparker

@nwparker nwparker commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​386 $\color{#cf222e}{\Huge{\mathbf{−}}}$​26 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​360
Prod 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​274 $\color{#cf222e}{\Huge{\mathbf{−}}}$​257 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​17

Step 2 of the execution-host dispatch consolidation, extending the adoption of #18296's host-keyed provider dispatch to the site its own audit named as the highest-leverage remaining one.

The defect

RuntimeGitTarget carried connectionId?: string and no host id. That type cannot express three distinct things, so undefined meant all of them at once:

  • runtime:<env> — a host whose connectionId names a target in the server's namespace
  • unresolved — resolution failed
  • local — genuinely this machine

Its sole resolver (orca-runtime-persist-headless-terminal-title.ts) had all three collapses in two lines and never read worktree.hostId — the field that outranks every repo row:

const repo = store.getRepo(worktree.repoId)      // host-blind: one id, many hosts
const connectionId = repo?.connectionId ?? undefined

36 downstream dispatches inherited that one answer.

The change

RuntimeGitTarget now carries executionHostId: ExecutionHostId — never optional, never null — resolved through the shared rule that landed with #17909/#17919 (resolveWorktreeExecutionHost) and dispatched through #18296's host-keyed routes. connectionId is gone from the type, so every reader had to be revisited rather than silently inheriting a changed meaning.

Dispatch sites call requireRuntimeGitProvider(target), where null means exactly one thing: the host is local and the command runs here as free functions.

host before after
ssh:m4air with a rival row on ssh:openclaw first row wins — the reproduced cross-host leak routes to m4air
local with a surviving connectionId dials that SSH target no connection handed out
runtime:env + nested SSH target dials a same-named target in this client's namespace ExecutionHostNotDispatchableError
runtime:env, no nested target runs Git locally against a remote path ExecutionHostNotDispatchableError
rival rows disagree, worktree names no host picks row 0 worktree_execution_host_unresolved
SSH host with no registered provider throws unchanged — loss of contact is never evidence of locality
single unambiguous row, no worktree host routes to it unchanged (no-op)

Which question each site needed

All 36 need "what may this client dial", not "which target holds the files" — this process is the one executing, so a runtime: host is a routing error here rather than a connection to look up. They did not split. resolveWorktreeLaunchHost keeps its exact signature and now delegates to a new sibling, resolveWorktreeHostRouting, which answers "which host is this on"; the git target needs that one because local and runtime: are two different non-SSH answers and only one may run here.

Other bits

  • localGitOptionsForTarget gates WSL routing on executionHostId === 'local' instead of on the absence of a connection, so a runtime: host can no longer inherit this machine's distro.
  • ExecutionHostGitRoute's ssh variant now carries SshGitProvider rather than IGitProvider. The SSH table stores the former; narrowing dropped the remote-only methods these callers need. requireGitProviderForHost's signature is unchanged.
  • RuntimeFileCommandHost.resolveRuntimeGitTarget's declared shape was still { connectionId?: string }, which structurally accepted the new target while reading undefined forever. Updated to the real field.
  • The one sentence in docs/reference/ssh-execution-boundary.md that pointed at target.connectionId as the enforcement point now points at requireRuntimeGitProvider.
  • pullRequestDraftGitExec moved to runtime-git-generation-context.ts — the two draft-context executors were duplicated option objects, and folding them keeps the commands file under max-lines without a disable.

Tests

runtime-git-target-execution-host.test.ts drives OrcaRuntimeService.getRuntimeGitStatus end to end through the real SSH provider table, with two distinct SSH hosts registered at once and a runtime: host with and without a nested target — including a case where the nested target's name is registered on this client, to prove it is refused rather than dialled.

Verified the suite fails against the old resolution: patching resolveRuntimeGitTarget back to repo?.connectionId fails exactly 6 of 8 cases. The 2 that pass are the intended no-ops (single unambiguous row; unreachable SSH host).

Also added runtime-git-command-target.test.ts (route/provider/WSL-option unit cases) and extended worktree-launch-host-repo.test.ts for resolveWorktreeHostRouting.

Verification

  • pnpm tc clean
  • pnpm test src — 69,182 passed; one unrelated flake in structured-tui-transcript-catchup.test.ts (a transcript-watcher timing test) that passes on its own
  • pnpm run check:code-quality:changed clean; no lint disables, no max-lines bump
  • Docker SSH lane: 24 passed / 2 skipped / 0 failed (first run flaked on ssh-lost-kill-tab-resurrection with "Execution context was destroyed" inside the connect helper; green on re-run)

No wire change. RuntimeGitTarget is main-process internal; no RPC params, stream frames, or published content are touched. The SSH and local commit-message model-discovery host keys are byte-identical to before.

Deliberately not in scope

RuntimeFileTarget (resolveRuntimeFileTarget, same file) has the identical defect across roughly 30 filesystem dispatches in runtime-file-commands-*.ts. It is a clean second PR on the same pattern; folding it in here would double a diff that is already 36 call sites.

…connectionId

`RuntimeGitTarget` carried `connectionId?: string` and no host id, so `undefined`
spelled three different answers at once — "runtime: host", "unresolved", and
"genuinely local". Its sole resolver read `store.getRepo(worktree.repoId)?.connectionId`
and never looked at `worktree.hostId`, which outranks every repo row, so one
arbitrarily chosen row decided the execution host for 36 downstream dispatches.

The target now carries `executionHostId: ExecutionHostId` (never null, never
optional), resolved through the shared rule that landed with #17909/#17919 and
dispatched through the host-keyed routes from #18296. Dispatch sites call
`requireRuntimeGitProvider`, where `null` means exactly one thing: the host is
`local` and the command runs here as free functions.

Four answers that used to collapse into one:

- `ssh:x` with a rival row on `ssh:y` — routes to x. Previously the first row won,
  which is the reproduced cross-host leak.
- `local` with a surviving `connectionId` — a row contradicting itself; no SSH
  connection is handed out.
- `runtime:<env>` — throws `ExecutionHostNotDispatchableError`. Its repo row's
  connection names a target in the *server's* namespace; dialling it here reaches a
  same-named target on this client.
- rival rows disagreeing with no worktree host — `worktree_execution_host_unresolved`,
  matching the launch path rather than guessing a row.

An unreachable SSH host still throws `SSH_GIT_PROVIDER_UNAVAILABLE_MESSAGE`; loss of
contact is never evidence of locality (docs/reference/ssh-execution-boundary.md).

`resolveWorktreeLaunchHost` keeps its exact signature and now delegates to
`resolveWorktreeHostRouting`, the same resolution answering "which host is this on"
rather than "what may this client dial" — the git target needs the first question
because `local` and `runtime:` are two different non-SSH answers.

No wire change: `RuntimeGitTarget` is main-process internal, and the SSH and local
model-discovery host keys are byte-identical to before.

`RuntimeFileTarget` has the same defect in ~30 filesystem dispatches and is
deliberately left for a follow-up.
@pullfrog

pullfrog Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor
  • Checkout PR and read diff + summary
  • Read learnings (runtime environment routing sections)
  • Triage: orient on PR scope and read related files
  • Dispatch reviewfrog specialists for unresolved questions
  • Aggregate findings and draft review
  • Submit review + update summary file

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: 80415b8e-c5f9-4b3e-9b0c-9c98a672172d

📥 Commits

Reviewing files that changed from the base of the PR and between 9cda5a9 and e213858.

📒 Files selected for processing (25)
  • docs/reference/ssh-execution-boundary.md
  • src/main/providers/execution-host-provider-dispatch.ts
  • src/main/runtime/orca-runtime-git-branch-diff.test.ts
  • src/main/runtime/orca-runtime-git-diff-budget.test.ts
  • src/main/runtime/orca-runtime-git.test.ts
  • src/main/runtime/orca-runtime-persist-headless-terminal-title.ts
  • src/main/runtime/rpc/methods/git-diff-transport-budget.test.ts
  • src/main/runtime/runtime-file-command-host.ts
  • src/main/runtime/runtime-git-branch-compare-admission.test.ts
  • src/main/runtime/runtime-git-command-target.test.ts
  • src/main/runtime/runtime-git-command-target.ts
  • src/main/runtime/runtime-git-conflict-operation-routing.test.ts
  • src/main/runtime/runtime-git-diff-commands.ts
  • src/main/runtime/runtime-git-execution-host-ownership.test.ts
  • src/main/runtime/runtime-git-generation-admission.test.ts
  • src/main/runtime/runtime-git-generation-commands.ts
  • src/main/runtime/runtime-git-generation-context.ts
  • src/main/runtime/runtime-git-staging-commands.ts
  • src/main/runtime/runtime-git-status-admission.test.ts
  • src/main/runtime/runtime-git-status-commands.ts
  • src/main/runtime/runtime-git-sync-commands.test.ts
  • src/main/runtime/runtime-git-sync-commands.ts
  • src/main/runtime/runtime-git-target-execution-host.test.ts
  • src/main/runtime/worktree-launch-host-repo.test.ts
  • src/main/runtime/worktree-launch-host-repo.ts

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


📝 Walkthrough

Walkthrough

Runtime Git targets now use a required executionHostId instead of an optional connectionId. Worktree routing distinguishes local, SSH, runtime, unowned, and ambiguous cases. Shared helpers select local Git or registered SSH providers and reject unsupported or unavailable hosts. Diff, status, staging, synchronization, and generation commands use the shared routing path. Tests cover host selection, provider availability, local options, and updated target fixtures.

Merge Risk: ⚪ Minimal · up to e2138

Runtime Git operations now route through explicit execution hosts and preserve local and SSH behavior while rejecting non-dispatchable runtime targets. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides a detailed explanation, rationale, scope, testing results, and out-of-scope work. However, it does not follow the required template structure and omits the required Linked Iss… Add the required template sections. Provide a linked issue using the required format, add visual proof or state N/A with a reason, complete AI Disclosure as applicable, complete Review and Checklist items, and preserve the existing technica…
Docstring Coverage ⚠️ Warning Docstring coverage is 21.05% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 24 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: runtime Git now routes by the resolved execution host instead of the repository connectionId.
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 provides a detailed explanation, rationale, scope, testing results, and out-of-scope work. However, it does not follow the required template structure and omits the required Linked Issue, Visual Proof or explicit N/A statement, AI Disclosure, Review, and Checklist sections.

Resolution

Add the required template sections. Provide a linked issue using the required format, add visual proof or state N/A with a reason, complete AI Disclosure as applicable, complete Review and Checklist items, and preserve the existing technical details under ELI5, What Changed, Why, and Testing.

Full details: Docstring Coverage

Explanation

Docstring coverage is 21.05% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 24 files. (1 skipped: 1 unsupported.)

  • 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 d575064 into main Sep 3, 2026
27 of 28 checks passed
nwparker added a commit that referenced this pull request Sep 3, 2026
… host

`ResolvedRuntimeFileTarget` carried `connectionId?: string` and no host id, so
`undefined` spelled three different answers at once — "runtime: host", "unresolved"
and "genuinely local". Its sole resolver read `store.getRepo(worktree.repoId)?.connectionId`
and never looked at `worktree.hostId`, which outranks every repo row, so one
arbitrarily chosen row decided the execution host for ~30 filesystem dispatches.
This is #18307's defect in the same file family; it was deliberately left out of
that PR rather than doubling an already-36-site diff.

The target now carries `executionHostId: ExecutionHostId` (never null, never
optional), resolved through `resolveWorktreeHostRouting` — the same adapter #18307
added — and dispatched through #18296's `resolveFilesystemRouteForHost`. Dispatch
sites call `requireRuntimeFileProvider`, where `null` means exactly one thing: the
host is `local` and the read happens here.

Four answers that used to collapse into one:

- `ssh:x` with a rival row on `ssh:y` — routes to x. Previously the first row won.
- `local` with a surviving `connectionId` — a row contradicting itself; no SSH
  connection is handed out.
- `runtime:<env>` — throws `ExecutionHostNotDispatchableError`. Its repo row's
  connection names a target in the *server's* namespace; reading it here reaches a
  same-named target on this client.
- rival rows disagreeing with no worktree host — `worktree_execution_host_unresolved`,
  matching the launch and Git paths rather than guessing a row.

Two further reads stop degrading. `assertRuntimeFileMutationExpectation` recomputed
the host from `connectionId`, so a client's host expectation could pass against a
host the workspace never named; it now compares the resolved host. And the
cross-workspace terminal tap coalesced `knownWorkspaceTarget?.connectionId ??
connectionId`, so a sibling workspace resolved as `local` inherited the origin
worktree's SSH target and statted a local path on the remote box; a non-optional
host id replaces rather than coalesces.

An unreachable SSH host still throws `SSH_FILESYSTEM_PROVIDER_UNAVAILABLE_MESSAGE`;
loss of contact is never evidence of locality (docs/reference/ssh-execution-boundary.md).
Quick-open listing and path search keep degrading to empty for an unreachable host —
that is a false negative, not a local answer — and now do so only for a host that
really is remote.

The whole `runtime-file-commands-*` family carries `@ts-nocheck` from a mechanical
class split, so removing the field could not raise the compile errors that made
#18307 safe. `runtime-file-command-target.ts` is deliberately checked, and a ratchet
test stands in for the errors the family cannot produce.

No wire change: `ResolvedRuntimeFileTarget` is main-process internal, and the SSH
watcher-release and grant keys are byte-identical to before.
nwparker added a commit that referenced this pull request Sep 3, 2026
… host (#18325)

`ResolvedRuntimeFileTarget` carried `connectionId?: string` and no host id, so
`undefined` spelled three different answers at once — "runtime: host", "unresolved"
and "genuinely local". Its sole resolver read `store.getRepo(worktree.repoId)?.connectionId`
and never looked at `worktree.hostId`, which outranks every repo row, so one
arbitrarily chosen row decided the execution host for ~30 filesystem dispatches.
This is #18307's defect in the same file family; it was deliberately left out of
that PR rather than doubling an already-36-site diff.

The target now carries `executionHostId: ExecutionHostId` (never null, never
optional), resolved through `resolveWorktreeHostRouting` — the same adapter #18307
added — and dispatched through #18296's `resolveFilesystemRouteForHost`. Dispatch
sites call `requireRuntimeFileProvider`, where `null` means exactly one thing: the
host is `local` and the read happens here.

Four answers that used to collapse into one:

- `ssh:x` with a rival row on `ssh:y` — routes to x. Previously the first row won.
- `local` with a surviving `connectionId` — a row contradicting itself; no SSH
  connection is handed out.
- `runtime:<env>` — throws `ExecutionHostNotDispatchableError`. Its repo row's
  connection names a target in the *server's* namespace; reading it here reaches a
  same-named target on this client.
- rival rows disagreeing with no worktree host — `worktree_execution_host_unresolved`,
  matching the launch and Git paths rather than guessing a row.

Two further reads stop degrading. `assertRuntimeFileMutationExpectation` recomputed
the host from `connectionId`, so a client's host expectation could pass against a
host the workspace never named; it now compares the resolved host. And the
cross-workspace terminal tap coalesced `knownWorkspaceTarget?.connectionId ??
connectionId`, so a sibling workspace resolved as `local` inherited the origin
worktree's SSH target and statted a local path on the remote box; a non-optional
host id replaces rather than coalesces.

An unreachable SSH host still throws `SSH_FILESYSTEM_PROVIDER_UNAVAILABLE_MESSAGE`;
loss of contact is never evidence of locality (docs/reference/ssh-execution-boundary.md).
Quick-open listing and path search keep degrading to empty for an unreachable host —
that is a false negative, not a local answer — and now do so only for a host that
really is remote.

The whole `runtime-file-commands-*` family carries `@ts-nocheck` from a mechanical
class split, so removing the field could not raise the compile errors that made
#18307 safe. `runtime-file-command-target.ts` is deliberately checked, and a ratchet
test stands in for the errors the family cannot produce.

No wire change: `ResolvedRuntimeFileTarget` is main-process internal, and the SSH
watcher-release and grant keys are byte-identical to before.
nwparker added a commit that referenced this pull request Sep 3, 2026
…try points (#18545)

Two entry points create the same workspace and disagreed about how to read its
host. `orca-runtime-create-managed-worktree.ts:63` resolved through
`getRepoSshConnectionId` and then normalized the row; the `worktrees:create` IPC
handler branched on raw `repo.connectionId`
(`register-worktree-create-handlers.ts:66-69`). So a repo naming its owner only
as `executionHostId: 'ssh:<target>'` created remotely through the runtime and ran
`git worktree add` on the client against a remote path through IPC (#11163).
Same repo, two entry points, different answers.

Both now take one route, resolved through the existing layer
(`getRepoExecutionHostId` -> #18296's `resolveGitRouteForHost`). No new resolver.

The row normalization on the `ssh` variant is kept, and it is a **workaround, not
the pattern**. `createRemoteWorktree` and its callees re-read `repo.connectionId!`
at five depths in `ipc/worktree-remote.ts` (1627, 1847, 1848, 1865, 2029), so the
resolved connection has to reach them through the field they already read. It
travels only as far as that object does — anything downstream that re-reads the
row from the store still sees the unnormalized one, and it cannot express the
`runtime:` refusal on its own. Proper fix, deliberately not done here: give that
pipeline an explicit connection parameter and delete `repo.connectionId!` from it
so every reader becomes a compile error, the technique #18307/#18325 used. That
is a change inside a 2800-line module plus its callers, and it wants its own PR.

Three answers that used to collapse into one, now distinct at both entry points:

- `executionHostId: 'ssh:*'` with no `connectionId` -> that SSH host (IPC used to
  create locally);
- `executionHostId: 'local'` with a surviving `connectionId` -> local, since a
  local row cannot nest an SSH namespace. This is what `getRepoSshConnectionId`
  and therefore the runtime sibling already answered; IPC used to go remote;
- `runtime:<env>` -> refused. Its worktree is created by that environment's own
  server and the SSH target on its repo row is that server's nested one,
  addressable only as (environmentId, targetId). The renderer already routes
  runtime-environment creates over `worktree.create` RPC rather than this IPC
  channel, so reaching either entry point with one is a routing mistake. Matches
  `workspace-cleanup-git-route` and `runtime-git-command-target`.

Folder-workspace creation is untouched on both sides: it is a registration, not a
filesystem create, so the route is resolved after that branch on the IPC side, and
on the runtime side only the agent trust write consumes it — where a `runtime:`
host now yields `null` instead of the nested target, so the write stops going to a
same-named target in this client's table.

No wire or persistence change: the normalized row is a local value passed to the
create pipeline, never stored, and `CreateWorktreeResult` is untouched.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…connectionId (stablyai#18307)

`RuntimeGitTarget` carried `connectionId?: string` and no host id, so `undefined`
spelled three different answers at once — "runtime: host", "unresolved", and
"genuinely local". Its sole resolver read `store.getRepo(worktree.repoId)?.connectionId`
and never looked at `worktree.hostId`, which outranks every repo row, so one
arbitrarily chosen row decided the execution host for 36 downstream dispatches.

The target now carries `executionHostId: ExecutionHostId` (never null, never
optional), resolved through the shared rule that landed with stablyai#17909/stablyai#17919 and
dispatched through the host-keyed routes from stablyai#18296. Dispatch sites call
`requireRuntimeGitProvider`, where `null` means exactly one thing: the host is
`local` and the command runs here as free functions.

Four answers that used to collapse into one:

- `ssh:x` with a rival row on `ssh:y` — routes to x. Previously the first row won,
  which is the reproduced cross-host leak.
- `local` with a surviving `connectionId` — a row contradicting itself; no SSH
  connection is handed out.
- `runtime:<env>` — throws `ExecutionHostNotDispatchableError`. Its repo row's
  connection names a target in the *server's* namespace; dialling it here reaches a
  same-named target on this client.
- rival rows disagreeing with no worktree host — `worktree_execution_host_unresolved`,
  matching the launch path rather than guessing a row.

An unreachable SSH host still throws `SSH_GIT_PROVIDER_UNAVAILABLE_MESSAGE`; loss of
contact is never evidence of locality (docs/reference/ssh-execution-boundary.md).

`resolveWorktreeLaunchHost` keeps its exact signature and now delegates to
`resolveWorktreeHostRouting`, the same resolution answering "which host is this on"
rather than "what may this client dial" — the git target needs the first question
because `local` and `runtime:` are two different non-SSH answers.

No wire change: `RuntimeGitTarget` is main-process internal, and the SSH and local
model-discovery host keys are byte-identical to before.

`RuntimeFileTarget` has the same defect in ~30 filesystem dispatches and is
deliberately left for a follow-up.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
… host (stablyai#18325)

`ResolvedRuntimeFileTarget` carried `connectionId?: string` and no host id, so
`undefined` spelled three different answers at once — "runtime: host", "unresolved"
and "genuinely local". Its sole resolver read `store.getRepo(worktree.repoId)?.connectionId`
and never looked at `worktree.hostId`, which outranks every repo row, so one
arbitrarily chosen row decided the execution host for ~30 filesystem dispatches.
This is stablyai#18307's defect in the same file family; it was deliberately left out of
that PR rather than doubling an already-36-site diff.

The target now carries `executionHostId: ExecutionHostId` (never null, never
optional), resolved through `resolveWorktreeHostRouting` — the same adapter stablyai#18307
added — and dispatched through stablyai#18296's `resolveFilesystemRouteForHost`. Dispatch
sites call `requireRuntimeFileProvider`, where `null` means exactly one thing: the
host is `local` and the read happens here.

Four answers that used to collapse into one:

- `ssh:x` with a rival row on `ssh:y` — routes to x. Previously the first row won.
- `local` with a surviving `connectionId` — a row contradicting itself; no SSH
  connection is handed out.
- `runtime:<env>` — throws `ExecutionHostNotDispatchableError`. Its repo row's
  connection names a target in the *server's* namespace; reading it here reaches a
  same-named target on this client.
- rival rows disagreeing with no worktree host — `worktree_execution_host_unresolved`,
  matching the launch and Git paths rather than guessing a row.

Two further reads stop degrading. `assertRuntimeFileMutationExpectation` recomputed
the host from `connectionId`, so a client's host expectation could pass against a
host the workspace never named; it now compares the resolved host. And the
cross-workspace terminal tap coalesced `knownWorkspaceTarget?.connectionId ??
connectionId`, so a sibling workspace resolved as `local` inherited the origin
worktree's SSH target and statted a local path on the remote box; a non-optional
host id replaces rather than coalesces.

An unreachable SSH host still throws `SSH_FILESYSTEM_PROVIDER_UNAVAILABLE_MESSAGE`;
loss of contact is never evidence of locality (docs/reference/ssh-execution-boundary.md).
Quick-open listing and path search keep degrading to empty for an unreachable host —
that is a false negative, not a local answer — and now do so only for a host that
really is remote.

The whole `runtime-file-commands-*` family carries `@ts-nocheck` from a mechanical
class split, so removing the field could not raise the compile errors that made
stablyai#18307 safe. `runtime-file-command-target.ts` is deliberately checked, and a ratchet
test stands in for the errors the family cannot produce.

No wire change: `ResolvedRuntimeFileTarget` is main-process internal, and the SSH
watcher-release and grant keys are byte-identical to before.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…try points (stablyai#18545)

Two entry points create the same workspace and disagreed about how to read its
host. `orca-runtime-create-managed-worktree.ts:63` resolved through
`getRepoSshConnectionId` and then normalized the row; the `worktrees:create` IPC
handler branched on raw `repo.connectionId`
(`register-worktree-create-handlers.ts:66-69`). So a repo naming its owner only
as `executionHostId: 'ssh:<target>'` created remotely through the runtime and ran
`git worktree add` on the client against a remote path through IPC (stablyai#11163).
Same repo, two entry points, different answers.

Both now take one route, resolved through the existing layer
(`getRepoExecutionHostId` -> stablyai#18296's `resolveGitRouteForHost`). No new resolver.

The row normalization on the `ssh` variant is kept, and it is a **workaround, not
the pattern**. `createRemoteWorktree` and its callees re-read `repo.connectionId!`
at five depths in `ipc/worktree-remote.ts` (1627, 1847, 1848, 1865, 2029), so the
resolved connection has to reach them through the field they already read. It
travels only as far as that object does — anything downstream that re-reads the
row from the store still sees the unnormalized one, and it cannot express the
`runtime:` refusal on its own. Proper fix, deliberately not done here: give that
pipeline an explicit connection parameter and delete `repo.connectionId!` from it
so every reader becomes a compile error, the technique stablyai#18307/stablyai#18325 used. That
is a change inside a 2800-line module plus its callers, and it wants its own PR.

Three answers that used to collapse into one, now distinct at both entry points:

- `executionHostId: 'ssh:*'` with no `connectionId` -> that SSH host (IPC used to
  create locally);
- `executionHostId: 'local'` with a surviving `connectionId` -> local, since a
  local row cannot nest an SSH namespace. This is what `getRepoSshConnectionId`
  and therefore the runtime sibling already answered; IPC used to go remote;
- `runtime:<env>` -> refused. Its worktree is created by that environment's own
  server and the SSH target on its repo row is that server's nested one,
  addressable only as (environmentId, targetId). The renderer already routes
  runtime-environment creates over `worktree.create` RPC rather than this IPC
  channel, so reaching either entry point with one is a routing mistake. Matches
  `workspace-cleanup-git-route` and `runtime-git-command-target`.

Folder-workspace creation is untouched on both sides: it is a registration, not a
filesystem create, so the route is resolved after that branch on the IPC side, and
on the runtime side only the agent trust write consumes it — where a `runtime:`
host now yields `null` instead of the nested target, so the write stops going to a
same-named target in this client's table.

No wire or persistence change: the normalized row is a local value passed to the
create pipeline, never stored, and `CreateWorktreeResult` is untouched.
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