Fix WSL orchestration CLI preambles (#8561)

This commit is contained in:
Jinjing
2026-07-13 05:39:52 -07:00
committed by GitHub
parent 6eda9cdb27
commit 17f032dbd5
13 changed files with 228 additions and 19 deletions
+41 -2
View File
@@ -469,7 +469,9 @@ import {
resolveLocalProjectRuntimeForRepo,
resolveLocalProjectRuntimesForRepos
} from '../project-runtime-git-options'
import { resolveLocalProjectRuntimeForWorktreeId } from '../local-project-runtime-resolution'
import type { ProjectExecutionRuntimeResolution } from '../../shared/project-execution-runtime'
import { resolveTerminalOrchestrationCliCommand } from './orchestration/cli-command'
import {
getLocalWorktreePathAccess,
removeLocalWorktreePath,
@@ -976,6 +978,9 @@ type RuntimePtyWorktreeRecord = {
ptyId: string
worktreeId: string
connectionId: string | null
// Why: a Windows host can own both native and WSL panes; preamble command
// selection must follow the pane that executes it, not process.platform.
isWsl: boolean | null
// Why: background CLI PTYs can outlive a failed renderer reveal. Preserve the
// spawn-time tab/pane identity so later reveals can adopt under the env key.
tabId: string | null
@@ -5529,7 +5534,8 @@ export class OrcaRuntimeService {
ptyId: string,
worktreeId: string,
connectionId: string | null = null,
binding?: { tabId: string; leafId: string }
binding?: { tabId: string; leafId: string },
isWsl?: boolean
): void {
// Why: record the renderer pane identity at spawn time so a stalled graph
// sync can't hide that a live PTY already backs a pending mobile create.
@@ -5540,6 +5546,7 @@ export class OrcaRuntimeService {
this.recordPtyWorktree(ptyId, worktreeId, {
connected: true,
connectionId,
...(isWsl !== undefined ? { isWsl } : {}),
...(binding && paneKey ? { tabId: binding.tabId, paneKey } : {})
})
// Why: the renderer's own PTY spawn is the reliable signal that the pending
@@ -7234,6 +7241,27 @@ export class OrcaRuntimeService {
return pty ? { worktreeId: pty.worktreeId, connectionId: pty.connectionId } : null
}
getTerminalOrchestrationCliCommand(handle: string): 'orca' | 'orca-ide' {
let pty: RuntimePtyWorktreeRecord | null = null
try {
const ptyId = this.resolveLeafForHandle(handle)?.ptyId
pty = ptyId ? (this.ptysById.get(ptyId) ?? null) : null
} catch {
return 'orca'
}
if (!pty) {
return 'orca'
}
return resolveTerminalOrchestrationCliCommand({
connectionId: pty.connectionId,
isWsl: pty.isWsl,
worktreeId: pty.worktreeId,
projectRuntime: this.store
? resolveLocalProjectRuntimeForWorktreeId(this.requireStore(), pty.worktreeId)
: undefined
})
}
hasRecentTerminalOutputPath(handle: string, pathText: string, absolutePath: string): boolean {
const ptyId = this.resolveLeafForHandle(handle)?.ptyId
const recentOutput = ptyId ? this.recentPtyOutputById.get(ptyId) : null
@@ -20057,7 +20085,14 @@ export class OrcaRuntimeService {
state: Partial<
Pick<
RuntimePtyWorktreeRecord,
'connected' | 'lastOutputAt' | 'preview' | 'tabId' | 'paneKey' | 'title' | 'connectionId'
| 'connected'
| 'lastOutputAt'
| 'preview'
| 'tabId'
| 'paneKey'
| 'title'
| 'connectionId'
| 'isWsl'
>
> = {}
): RuntimePtyWorktreeRecord {
@@ -20068,6 +20103,7 @@ export class OrcaRuntimeService {
ptyId,
worktreeId,
connectionId: state.connectionId ?? parseAppSshPtyId(ptyId)?.connectionId ?? null,
isWsl: state.isWsl ?? null,
tabId: state.tabId ?? null,
paneKey: state.paneKey ?? null,
launchConfig: null,
@@ -20109,6 +20145,9 @@ export class OrcaRuntimeService {
if (state.connectionId !== undefined) {
pty.connectionId = state.connectionId
}
if (state.isWsl !== undefined) {
pty.isWsl = state.isWsl
}
if (state.tabId !== undefined) {
pty.tabId = state.tabId
}