From 7eac51fccbb8a463f84dcc966e267145e9a7300c Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Tue, 1 Sep 2026 03:39:33 -0700 Subject: [PATCH] fix(host-routing): keep nested SSH connections resolvable under a runtime host MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit getRepoSshConnectionId read only the resolved execution host, so a repo row owned by a runtime that reaches a nested SSH target (connectionId: ssh-*, executionHostId: runtime:*) resolved to no connection — answering 'local' for a remote worktree, the same defect #17909 fixed in the other direction. --- src/shared/execution-host.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/shared/execution-host.ts b/src/shared/execution-host.ts index 2533327dada..2032bd9a511 100644 --- a/src/shared/execution-host.ts +++ b/src/shared/execution-host.ts @@ -170,11 +170,18 @@ export function getRepoExecutionHostId( // field and the unified `executionHostId`. Routing that reads the raw field answers // "local" for a row that only carries `ssh:`, which runs a remote operation // on the client. Resolve the host first, then read the connection off it. +// +// Why the fallback: a row whose execution host is a *runtime* can still reach a nested +// SSH target, and that target only ever appears in `connectionId`. Returning null for +// those rows answers "local" for a nested-SSH worktree — the same defect in reverse. export function getRepoSshConnectionId( repo: Pick ): string | null { const parsed = parseExecutionHostId(getRepoExecutionHostId(repo)) - return parsed?.kind === 'ssh' ? parsed.targetId : null + if (parsed?.kind === 'ssh') { + return parsed.targetId + } + return normalizeHostPart(repo.connectionId) ?? null } export function getSshTargetIdForExecutionHost(