fix(host-routing): keep nested SSH connections resolvable under a runtime host

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.
This commit is contained in:
Neil
2026-09-02 16:06:54 -07:00
parent 7da15c973b
commit 7eac51fccb
+8 -1
View File
@@ -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:<target>`, 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<Repo, 'connectionId' | 'executionHostId'>
): 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(