Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

fix(wsl): name the stopped distro, in the user's language, when main holds a terminal start (#36228)

Neil0b2158a39438
diff --git a/src/main/ipc/pty/runtime/spawn-options.ts b/src/main/ipc/pty/runtime/spawn-options.ts
index 1ceaa5a386a..c9e5688fc9e 100644
--- a/src/main/ipc/pty/runtime/spawn-options.ts
+++ b/src/main/ipc/pty/runtime/spawn-options.ts
@@ -12,7 +12,7 @@ import {
assemblePtySpawnLaunchOptions,
seedPtySpawnSize
} from '../spawn-options-assembly'
-import type { RuntimePtySpawnState } from './spawn-state'
+import { isRuntimeWslBackgroundStart, type RuntimePtySpawnState } from './spawn-state'
import { prepareAntigravityAccountForLaunch } from '../../../antigravity/native-account-launch'
export async function buildRuntimePtySpawnOptions(
@@ -124,8 +124,7 @@ export async function buildRuntimePtySpawnOptions(
if (args.signal) {
ctx.spawnOptions.signal = args.signal
}
- // Default-deny (E9): a main-side start is background work unless its caller names the user's act.
- if (!ctx.preAdoptedStablePane && args.wslUserAct !== true) {
+ if (isRuntimeWslBackgroundStart(ctx)) {
ctx.spawnOptions.wslBackgroundStart = true
}
if (ctx.wslHoldReadAnchor !== undefined) {
diff --git a/src/main/ipc/pty/runtime/spawn-preflight.ts b/src/main/ipc/pty/runtime/spawn-preflight.ts
index 4eb8b07cf56..25375057e30 100644
--- a/src/main/ipc/pty/runtime/spawn-preflight.ts
+++ b/src/main/ipc/pty/runtime/spawn-preflight.ts
@@ -14,7 +14,7 @@ import {
ptySessionIdForAgentCreateOperation
} from '../../../daemon/pty-session-id'
import { resolvePathEnvKey } from '../../../pty/windows-environment-path'
-import type { RuntimePtySpawnState } from './spawn-state'
+import { isRuntimeWslBackgroundStart, type RuntimePtySpawnState } from './spawn-state'
import { localPtySpawnCwd } from '../host-env/spawn-cwd'
import { resolvePtySpawnStartupTarget } from '../spawn-startup-target'
import { resolvePtySpawnHostEnv } from '../spawn-host-env'
@@ -77,10 +77,10 @@ export async function prepareRuntimePtySpawn(
preAdopted: ctx.preAdoptedStablePane !== null,
getSettings: ctx.deps.getSettings,
resolveStartupCwd: ctx.deps.resolvePtySpawnStartupCwd,
- // Default-deny, as spawn-options' `wslBackgroundStart`: held before the cwd probe and any provider.
- ...(args.wslUserAct === true
- ? {}
- : { wslStartHold: { wslBackgroundStart: true, sessionId: ctx.sessionId } })
+ // The same verdict as spawn-options' `wslBackgroundStart`, held before the cwd probe and any provider.
+ ...(isRuntimeWslBackgroundStart(ctx)
+ ? { wslStartHold: { wslBackgroundStart: true, sessionId: ctx.sessionId } }
+ : {})
})
ctx.cwd = target.cwd
ctx.requestedCwd = target.requestedCwd
diff --git a/src/main/ipc/pty/runtime/spawn-state.ts b/src/main/ipc/pty/runtime/spawn-state.ts
index bb60bf77261..5fc203b2156 100644
--- a/src/main/ipc/pty/runtime/spawn-state.ts
+++ b/src/main/ipc/pty/runtime/spawn-state.ts
@@ -244,3 +244,8 @@ export function createRuntimePtySpawnState(
preSpawnHiddenMarkId: null
}
}
+
+/** Default-deny (E9): a main-side start is background unless its caller names the user's act; an adopted pane starts nothing. */
+export function isRuntimeWslBackgroundStart(ctx: RuntimePtySpawnState): boolean {
+ return !ctx.preAdoptedStablePane && ctx.args.wslUserAct !== true
+}
diff --git a/src/main/ipc/worktree-remote.ts b/src/main/ipc/worktree-remote.ts
index 7c3c6291fda..9afb65c3a99 100644
--- a/src/main/ipc/worktree-remote.ts
+++ b/src/main/ipc/worktree-remote.ts
@@ -1,3 +1,4 @@
+import { readableWslDistroHoldText } from '../../shared/wsl-distro-stopped-hold'
import { canCheckoutExistingLocalBranch } from '../runtime/runtime-worktree-create-git'
/* eslint-disable max-lines */
@@ -381,7 +382,9 @@ async function spawnLocalStartupAndSetupTerminals(args: {
surface: terminal.surface
}
} catch (error) {
- const message = error instanceof Error ? error.message : String(error)
+ const message = readableWslDistroHoldText(
+ error instanceof Error ? error.message : String(error)
+ )
warning = `Failed to create the startup terminal for ${worktree.path}: ${message}`
console.warn(`[worktree-create] ${warning}`)
return { didSpawnSetup: false, warning }
@@ -414,7 +417,9 @@ async function spawnLocalStartupAndSetupTerminals(args: {
)
didSpawnSetup = true
} catch (error) {
- const message = error instanceof Error ? error.message : String(error)
+ const message = readableWslDistroHoldText(
+ error instanceof Error ? error.message : String(error)
+ )
const nextWarning = `failed to create the setup terminal for ${worktree.path}: ${message}`
warning = appendWorktreeCreateWarning(warning, nextWarning)
console.warn(`[worktree-create] ${warning}`)
diff --git a/src/main/runtime/runtime-folder-worktree-create.ts b/src/main/runtime/runtime-folder-worktree-create.ts
index 8045861ee74..b49bff80828 100644
--- a/src/main/runtime/runtime-folder-worktree-create.ts
+++ b/src/main/runtime/runtime-folder-worktree-create.ts
@@ -1,3 +1,4 @@
+import { readableWslDistroHoldText } from '../../shared/wsl-distro-stopped-hold'
import { paneIdentity } from './runtime-terminal-pane-identity'
import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../shared/layout-owner-switch'
import { shouldSeedWorktreePrimaryTerminal } from '../../shared/worktree-first-surface'
@@ -182,7 +183,9 @@ export async function createRuntimeFolderWorktree(args: {
surface: 'background'
}
} catch (error) {
- const message = error instanceof Error ? error.message : String(error)
+ const message = readableWslDistroHoldText(
+ error instanceof Error ? error.message : String(error)
+ )
warning = `Failed to create the startup terminal for ${worktree.path}: ${message}`
console.warn(`[worktree-create] ${warning}`)
}
@@ -214,7 +217,9 @@ export async function createRuntimeFolderWorktree(args: {
try {
await deps.createTerminal(`id:${worktree.id}`, { surfaceOwner: false })
} catch (error) {
- const message = error instanceof Error ? error.message : String(error)
+ const message = readableWslDistroHoldText(
+ error instanceof Error ? error.message : String(error)
+ )
const initialWarning = `Failed to create the initial terminal for ${worktree.path}: ${message}`
warning = warning
? `${warning} Also failed to create the initial terminal for ${worktree.path}: ${message}`
diff --git a/src/main/runtime/runtime-local-worktree-terminal-startup.test.ts b/src/main/runtime/runtime-local-worktree-terminal-startup.test.ts
index 53b68cb7403..a53ee352271 100644
--- a/src/main/runtime/runtime-local-worktree-terminal-startup.test.ts
+++ b/src/main/runtime/runtime-local-worktree-terminal-startup.test.ts
@@ -241,3 +241,23 @@ describe('startRuntimeLocalWorktreeTerminals default shell seeding', () => {
)
})
})
+
+describe('startRuntimeLocalWorktreeTerminals held startup terminal (E9)', () => {
+ it('names the stopped WSL distro in the warning, not the raw hold code', async () => {
+ const { createTerminal, ports } = createPorts()
+ createTerminal.mockRejectedValueOnce(new Error('terminal_held_wsl_distro_stopped:Ubuntu'))
+
+ const result = await startRuntimeLocalWorktreeTerminals({
+ request: { repoSelector: `id:${repo.id}`, name: worktree.displayName },
+ repo,
+ worktree,
+ startup: { command: 'codex' },
+ ports
+ })
+
+ expect(result.warning).toBe(
+ "Failed to create the startup terminal for /worktree: The WSL distro Ubuntu is stopped, so Orca didn't start this terminal. Start the distro, then try again."
+ )
+ expect(result.warning).not.toContain('terminal_held_wsl_distro')
+ })
+})
diff --git a/src/main/runtime/runtime-local-worktree-terminal-startup.ts b/src/main/runtime/runtime-local-worktree-terminal-startup.ts
index 5a7cfe7bbc9..6e2c2a89441 100644
--- a/src/main/runtime/runtime-local-worktree-terminal-startup.ts
+++ b/src/main/runtime/runtime-local-worktree-terminal-startup.ts
@@ -1,3 +1,4 @@
+import { readableWslDistroHoldText } from '../../shared/wsl-distro-stopped-hold'
import { paneIdentity } from './runtime-terminal-pane-identity'
import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../shared/layout-owner-switch'
import { shouldSeedWorktreePrimaryTerminal } from '../../shared/worktree-first-surface'
@@ -299,7 +300,7 @@ function appendFailure(
kind: 'startup' | 'initial',
error: unknown
): string {
- const message = error instanceof Error ? error.message : String(error)
+ const message = readableWslDistroHoldText(error instanceof Error ? error.message : String(error))
const failure = `failed to create the ${kind} terminal for ${path}: ${message}`
const combined = warning
? `${warning} Also ${failure}`
diff --git a/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-expired-pane-recovery.test.ts b/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-expired-pane-recovery.test.ts
index f13d41231e3..067d18fd590 100644
--- a/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-expired-pane-recovery.test.ts
+++ b/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-expired-pane-recovery.test.ts
@@ -223,6 +223,44 @@ describe('createRemoteRuntimePtyTransport', () => {
expect(transport.isConnected()).toBe(false)
})
+ it("names a held recovery's stopped WSL distro in readable copy, not the raw hold code", async () => {
+ const onError = vi.fn()
+ resolvedPaneHandle = 'terminal-expired'
+ const { createRemoteRuntimePtyTransport } = await import('./remote-runtime-pty-transport')
+ createRemoteRuntimePtyTransport('older-hub', {
+ worktreeId: 'wt-1',
+ tabId: 'web-terminal-host-tab-1',
+ leafId: 'pane:1'
+ }).attach({
+ existingPtyId: 'remote:older-hub@@terminal-expired',
+ callbacks: { onError }
+ })
+ await vi.waitFor(() => expect(subscriptionSendBinary).toHaveBeenCalled())
+ runtimeCall.mockImplementation(async (args: { method: string }) =>
+ args.method === 'terminal.recoverPane'
+ ? {
+ ok: false,
+ error: { code: 'runtime_error', message: 'terminal_held_wsl_distro_stopped:Ubuntu' }
+ }
+ : { ok: true, result: {} }
+ )
+
+ subscriptionCallbacks?.onResponse({
+ ok: true,
+ result: {
+ type: 'error',
+ streamId: latestSubscribePayload().streamId,
+ message: 'SSH_SESSION_EXPIRED: relay identity changed'
+ }
+ })
+
+ await vi.waitFor(() =>
+ expect(onError).toHaveBeenCalledWith(
+ "The WSL distro Ubuntu is stopped, so Orca didn't start this terminal. Start the distro, then try again."
+ )
+ )
+ })
+
it('ignores stale stream end after reattaching a newer remote terminal', async () => {
const { createRemoteRuntimePtyTransport } = await import('./remote-runtime-pty-transport')
const onPtyExit = vi.fn()
diff --git a/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts b/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
index 4ed4f5f454e..6bef5f1a4b0 100644
--- a/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
+++ b/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
@@ -59,6 +59,7 @@ import type {
PtyTransportRecoveryState
} from './pty-transport-types'
import { createPtyOutputProcessor } from './pty-output-processor'
+import { localizeWslDistroHoldText } from '@/lib/wsl-distro-hold-copy'
import { isSshSessionGoneError } from './pty-connection/pty-connect-limits'
import { RuntimeRpcCallError, unwrapRuntimeRpcResult } from '../../runtime/runtime-rpc-result'
import {
@@ -700,7 +701,7 @@ export function createRemoteRuntimePtyTransport(
surfacedErrorMessages.delete(oldest)
}
surfacedErrorMessages.add(message)
- storedCallbacks.onError?.(message)
+ storedCallbacks.onError?.(localizeWslDistroHoldText(message))
}
function markRecoveryHealthy(result?: PtyConnectResult): void {
diff --git a/src/renderer/src/i18n/locales/de.json b/src/renderer/src/i18n/locales/de.json
index 82c37a211c0..31ae812273b 100644
--- a/src/renderer/src/i18n/locales/de.json
+++ b/src/renderer/src/i18n/locales/de.json
@@ -22761,5 +22761,9 @@
"needsPermission": "Agent benötigt eine Genehmigung",
"statusStale": "Agentenstatus ist veraltet"
}
+ },
+ "wslDistroHold": {
+ "terminalStopped": "Die WSL-Distribution {{distro}} ist gestoppt, daher hat Orca dieses Terminal nicht gestartet. Starte die Distribution und versuche es dann erneut.",
+ "terminalUnverifiable": "Orca konnte nicht prüfen, ob die WSL-Distribution {{distro}} läuft, und hat dieses Terminal daher nicht gestartet. Starte die Distribution und versuche es dann erneut."
}
}
diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json
index 169975dc4bc..380b8f83318 100644
--- a/src/renderer/src/i18n/locales/en.json
+++ b/src/renderer/src/i18n/locales/en.json
@@ -23162,5 +23162,9 @@
"needsPermission": "Agent needs permission",
"statusStale": "Agent status is stale"
}
+ },
+ "wslDistroHold": {
+ "terminalStopped": "The WSL distro {{distro}} is stopped, so Orca didn't start this terminal. Start the distro, then try again.",
+ "terminalUnverifiable": "Orca couldn't check whether the WSL distro {{distro}} is running, so it didn't start this terminal. Start the distro, then try again."
}
}
diff --git a/src/renderer/src/i18n/locales/es.json b/src/renderer/src/i18n/locales/es.json
index 1c89ae9fe02..5ec0c4d6f24 100644
--- a/src/renderer/src/i18n/locales/es.json
+++ b/src/renderer/src/i18n/locales/es.json
@@ -23300,5 +23300,9 @@
"needsPermission": "El agente necesita permiso",
"statusStale": "El estado del agente está desactualizado"
}
+ },
+ "wslDistroHold": {
+ "terminalStopped": "La distribución WSL {{distro}} está detenida, así que Orca no inició esta terminal. Inicia la distribución y vuelve a intentarlo.",
+ "terminalUnverifiable": "Orca no pudo comprobar si la distribución WSL {{distro}} está en ejecución, así que no inició esta terminal. Inicia la distribución y vuelve a intentarlo."
}
}
diff --git a/src/renderer/src/i18n/locales/fr.json b/src/renderer/src/i18n/locales/fr.json
index b880aaf5cde..b47502e61eb 100644
--- a/src/renderer/src/i18n/locales/fr.json
+++ b/src/renderer/src/i18n/locales/fr.json
@@ -23300,5 +23300,9 @@
"needsPermission": "L’agent a besoin d’une autorisation",
"statusStale": "Le statut de l’agent est obsolète"
}
+ },
+ "wslDistroHold": {
+ "terminalStopped": "La distribution WSL {{distro}} est arrêtée, donc Orca n'a pas démarré ce terminal. Démarrez la distribution, puis réessayez.",
+ "terminalUnverifiable": "Orca n'a pas pu vérifier si la distribution WSL {{distro}} est en cours d'exécution, donc il n'a pas démarré ce terminal. Démarrez la distribution, puis réessayez."
}
}
diff --git a/src/renderer/src/i18n/locales/ja.json b/src/renderer/src/i18n/locales/ja.json
index 4ad47deb335..3bc4958d1d2 100644
--- a/src/renderer/src/i18n/locales/ja.json
+++ b/src/renderer/src/i18n/locales/ja.json
@@ -22612,5 +22612,9 @@
"needsPermission": "Agent に許可が必要です",
"statusStale": "Agent のステータスが古くなっています"
}
+ },
+ "wslDistroHold": {
+ "terminalStopped": "WSL ディストリビューション {{distro}} が停止しているため、Orca はこのターミナルを起動しませんでした。ディストリビューションを起動してから、もう一度お試しください。",
+ "terminalUnverifiable": "WSL ディストリビューション {{distro}} が実行中か確認できなかったため、Orca はこのターミナルを起動しませんでした。ディストリビューションを起動してから、もう一度お試しください。"
}
}
diff --git a/src/renderer/src/i18n/locales/ko.json b/src/renderer/src/i18n/locales/ko.json
index 16e511288d0..0025fa48bc5 100644
--- a/src/renderer/src/i18n/locales/ko.json
+++ b/src/renderer/src/i18n/locales/ko.json
@@ -22612,5 +22612,9 @@
"needsPermission": "에이전트에 권한이 필요합니다",
"statusStale": "에이전트 상태 정보가 오래되었습니다"
}
+ },
+ "wslDistroHold": {
+ "terminalStopped": "WSL 배포판 {{distro}}이(가) 중지되어 Orca가 이 터미널을 시작하지 않았습니다. 배포판을 시작한 후 다시 시도하세요.",
+ "terminalUnverifiable": "WSL 배포판 {{distro}}이(가) 실행 중인지 확인할 수 없어 Orca가 이 터미널을 시작하지 않았습니다. 배포판을 시작한 후 다시 시도하세요."
}
}
diff --git a/src/renderer/src/i18n/locales/pt.json b/src/renderer/src/i18n/locales/pt.json
index f0cff0fdf17..83ed503edf9 100644
--- a/src/renderer/src/i18n/locales/pt.json
+++ b/src/renderer/src/i18n/locales/pt.json
@@ -23203,5 +23203,9 @@
"needsPermission": "O agente precisa de permissão",
"statusStale": "O status do agente está desatualizado"
}
+ },
+ "wslDistroHold": {
+ "terminalStopped": "A distribuição WSL {{distro}} está parada, então o Orca não iniciou este terminal. Inicie a distribuição e tente novamente.",
+ "terminalUnverifiable": "O Orca não conseguiu verificar se a distribuição WSL {{distro}} está em execução, então não iniciou este terminal. Inicie a distribuição e tente novamente."
}
}
diff --git a/src/renderer/src/i18n/locales/ru.json b/src/renderer/src/i18n/locales/ru.json
index 84abbf2ced0..0cc114c95a1 100644
--- a/src/renderer/src/i18n/locales/ru.json
+++ b/src/renderer/src/i18n/locales/ru.json
@@ -23510,5 +23510,9 @@
"needsPermission": "Агенту требуется разрешение",
"statusStale": "Статус агента устарел"
}
+ },
+ "wslDistroHold": {
+ "terminalStopped": "Дистрибутив WSL {{distro}} остановлен, поэтому Orca не запустила этот терминал. Запустите дистрибутив и повторите попытку.",
+ "terminalUnverifiable": "Orca не удалось проверить, запущен ли дистрибутив WSL {{distro}}, поэтому этот терминал не запущен. Запустите дистрибутив и повторите попытку."
}
}
diff --git a/src/renderer/src/i18n/locales/tr.json b/src/renderer/src/i18n/locales/tr.json
index 78daf2fad58..aa6d85497e6 100644
--- a/src/renderer/src/i18n/locales/tr.json
+++ b/src/renderer/src/i18n/locales/tr.json
@@ -22744,5 +22744,9 @@
"needsPermission": "Ajan için izin gerekiyor",
"statusStale": "Ajan durumu güncel değil"
}
+ },
+ "wslDistroHold": {
+ "terminalStopped": "WSL dağıtımı {{distro}} durdurulduğu için Orca bu terminali başlatmadı. Dağıtımı başlatıp yeniden deneyin.",
+ "terminalUnverifiable": "Orca, WSL dağıtımı {{distro}} öğesinin çalışıp çalışmadığını denetleyemediği için bu terminali başlatmadı. Dağıtımı başlatıp yeniden deneyin."
}
}
diff --git a/src/renderer/src/i18n/locales/zh-Hant.json b/src/renderer/src/i18n/locales/zh-Hant.json
index 9a38e520efc..32bb85f82b6 100644
--- a/src/renderer/src/i18n/locales/zh-Hant.json
+++ b/src/renderer/src/i18n/locales/zh-Hant.json
@@ -22429,5 +22429,9 @@
"needsPermission": "代理程式需要權限",
"statusStale": "代理程式狀態資訊已過期"
}
+ },
+ "wslDistroHold": {
+ "terminalStopped": "WSL 發行版 {{distro}} 已停止,因此 Orca 沒有啟動此終端機。請啟動該發行版後重試。",
+ "terminalUnverifiable": "Orca 無法確認 WSL 發行版 {{distro}} 是否正在執行,因此沒有啟動此終端機。請啟動該發行版後重試。"
}
}
diff --git a/src/renderer/src/i18n/locales/zh.json b/src/renderer/src/i18n/locales/zh.json
index ae7b62d5a56..146c7dec7cc 100644
--- a/src/renderer/src/i18n/locales/zh.json
+++ b/src/renderer/src/i18n/locales/zh.json
@@ -22613,5 +22613,9 @@
"needsPermission": "智能体需要授权",
"statusStale": "智能体状态信息已过期"
}
+ },
+ "wslDistroHold": {
+ "terminalStopped": "WSL 发行版 {{distro}} 已停止,因此 Orca 没有启动此终端。请启动该发行版后重试。",
+ "terminalUnverifiable": "Orca 无法确认 WSL 发行版 {{distro}} 是否正在运行,因此没有启动此终端。请启动该发行版后重试。"
}
}
diff --git a/src/renderer/src/lib/wsl-distro-hold-copy.test.ts b/src/renderer/src/lib/wsl-distro-hold-copy.test.ts
new file mode 100644
index 00000000000..e3f92108583
--- /dev/null
+++ b/src/renderer/src/lib/wsl-distro-hold-copy.test.ts
@@ -0,0 +1,39 @@
+import { describe, expect, it, vi } from 'vitest'
+
+vi.mock('@/i18n/i18n', () => ({
+ translate: (key: string, _fallback: string, values: { distro: string }) =>
+ `[${key}] ${values.distro}`
+}))
+
+const { localizeWslDistroHoldText } = await import('./wsl-distro-hold-copy')
+
+describe('localizeWslDistroHoldText', () => {
+ it("swaps an older host's code for the user's language, naming the distro", () => {
+ expect(
+ localizeWslDistroHoldText(
+ 'Failed to create the startup terminal for /wt: terminal_held_wsl_distro_stopped:Ubuntu'
+ )
+ ).toBe('Failed to create the startup terminal for /wt: [wslDistroHold.terminalStopped] Ubuntu')
+ })
+
+ it("swaps a newer host's English sentence the same way", () => {
+ expect(
+ localizeWslDistroHoldText(
+ "Orca couldn't check whether the WSL distro Debian is running, so it didn't start this terminal. Start the distro, then try again."
+ )
+ ).toBe('[wslDistroHold.terminalUnverifiable] Debian')
+ })
+
+ it('swaps every mention of the same hold in a combined warning', () => {
+ const code = 'terminal_held_wsl_distro_stopped:Ubuntu'
+ expect(localizeWslDistroHoldText(`A: ${code} Also B: ${code}`)).toBe(
+ 'A: [wslDistroHold.terminalStopped] Ubuntu Also B: [wslDistroHold.terminalStopped] Ubuntu'
+ )
+ })
+
+ it('leaves other messages alone', () => {
+ expect(localizeWslDistroHoldText('Remote terminal was closed.')).toBe(
+ 'Remote terminal was closed.'
+ )
+ })
+})
diff --git a/src/renderer/src/lib/wsl-distro-hold-copy.ts b/src/renderer/src/lib/wsl-distro-hold-copy.ts
new file mode 100644
index 00000000000..41669f11f8f
--- /dev/null
+++ b/src/renderer/src/lib/wsl-distro-hold-copy.ts
@@ -0,0 +1,28 @@
+import { translate } from '@/i18n/i18n'
+import {
+ findWslDistroHoldInText,
+ type WslDistroHoldState
+} from '../../../shared/wsl-distro-stopped-hold'
+
+export function localizedWslDistroHoldMessage(hold: {
+ distro: string
+ state: WslDistroHoldState
+}): string {
+ return hold.state === 'stopped'
+ ? translate(
+ 'wslDistroHold.terminalStopped',
+ "The WSL distro {{distro}} is stopped, so Orca didn't start this terminal. Start the distro, then try again.",
+ { distro: hold.distro }
+ )
+ : translate(
+ 'wslDistroHold.terminalUnverifiable',
+ "Orca couldn't check whether the WSL distro {{distro}} is running, so it didn't start this terminal. Start the distro, then try again.",
+ { distro: hold.distro }
+ )
+}
+
+/** Host text naming a held terminal (its code from older hosts, its English sentence from newer) in the user's language. */
+export function localizeWslDistroHoldText(text: string): string {
+ const found = findWslDistroHoldInText(text)
+ return found ? text.split(found.matched).join(localizedWslDistroHoldMessage(found.hold)) : text
+}
diff --git a/src/renderer/src/store/slices/worktrees/create/create-worktree.ts b/src/renderer/src/store/slices/worktrees/create/create-worktree.ts
index 1322ea92b31..368c47e982c 100644
--- a/src/renderer/src/store/slices/worktrees/create/create-worktree.ts
+++ b/src/renderer/src/store/slices/worktrees/create/create-worktree.ts
@@ -1,5 +1,5 @@
+import { showWorktreeCreateWarningToast } from './worktree-create-warning-toast'
import { createWorktreeOnRuntimeHost } from './host-planned-agent-launch'
-import { toast } from 'sonner'
import { runtimeRpcTargetForAuthorityKey } from '@/runtime/runtime-client-target'
import { repoHostId } from '../listing/worktree-host-ownership'
import {
@@ -278,9 +278,7 @@ export function createCreateWorktree(
holdCreatedSidebarWorkspace({ worktree: created })
}
const { result } = outcome
- if (result.warning) {
- toast.warning(result.warning)
- }
+ showWorktreeCreateWarningToast(result.warning)
showLocalBaseRefRefreshToast(result.localBaseRefRefresh, result.worktree, {
updateSettings: get().updateSettings,
executionHostId: creationHostId
diff --git a/src/renderer/src/store/slices/worktrees/create/worktree-create-warning-toast.test.ts b/src/renderer/src/store/slices/worktrees/create/worktree-create-warning-toast.test.ts
new file mode 100644
index 00000000000..b042cde826c
--- /dev/null
+++ b/src/renderer/src/store/slices/worktrees/create/worktree-create-warning-toast.test.ts
@@ -0,0 +1,25 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+
+const warning = vi.hoisted(() => vi.fn())
+vi.mock('sonner', () => ({ toast: { warning } }))
+
+const { showWorktreeCreateWarningToast } = await import('./worktree-create-warning-toast')
+
+describe('showWorktreeCreateWarningToast', () => {
+ beforeEach(() => warning.mockReset())
+
+ it('names the stopped WSL distro instead of the raw hold code', () => {
+ showWorktreeCreateWarningToast(
+ 'Failed to create the startup terminal for /wt: terminal_held_wsl_distro_stopped:Ubuntu'
+ )
+
+ expect(warning).toHaveBeenCalledWith(
+ "Failed to create the startup terminal for /wt: The WSL distro Ubuntu is stopped, so Orca didn't start this terminal. Start the distro, then try again."
+ )
+ })
+
+ it('shows nothing without a warning', () => {
+ showWorktreeCreateWarningToast(undefined)
+ expect(warning).not.toHaveBeenCalled()
+ })
+})
diff --git a/src/renderer/src/store/slices/worktrees/create/worktree-create-warning-toast.ts b/src/renderer/src/store/slices/worktrees/create/worktree-create-warning-toast.ts
new file mode 100644
index 00000000000..9428613d232
--- /dev/null
+++ b/src/renderer/src/store/slices/worktrees/create/worktree-create-warning-toast.ts
@@ -0,0 +1,9 @@
+import { toast } from 'sonner'
+import { localizeWslDistroHoldText } from '@/lib/wsl-distro-hold-copy'
+
+/** The host's create warning; a held terminal reads in the user's language, naming its distro. */
+export function showWorktreeCreateWarningToast(warning: string | undefined): void {
+ if (warning) {
+ toast.warning(localizeWslDistroHoldText(warning))
+ }
+}
diff --git a/src/shared/wsl-distro-stopped-hold.test.ts b/src/shared/wsl-distro-stopped-hold.test.ts
new file mode 100644
index 00000000000..6f4d617dece
--- /dev/null
+++ b/src/shared/wsl-distro-stopped-hold.test.ts
@@ -0,0 +1,45 @@
+import { describe, expect, it } from 'vitest'
+import {
+ findWslDistroHoldInText,
+ readableWslDistroHoldText,
+ wslDistroHoldMessage,
+ wslDistroHoldUserMessage
+} from './wsl-distro-stopped-hold'
+
+describe('a WSL hold named in text', () => {
+ it.each(['stopped', 'unverifiable'] as const)(
+ 'finds a %s hold by its code or its sentence, with the exact text to swap',
+ (state) => {
+ const hold = { distro: 'Ubuntu-24.04', state }
+ const code = wslDistroHoldMessage(hold.distro, state)
+ const sentence = wslDistroHoldUserMessage(hold)
+
+ expect(findWslDistroHoldInText(`Failed to start: ${code}`)).toEqual({
+ hold,
+ matched: code,
+ form: 'code'
+ })
+ expect(findWslDistroHoldInText(`Failed to start: ${sentence} Also more.`)).toEqual({
+ hold,
+ matched: sentence,
+ form: 'sentence'
+ })
+ }
+ )
+
+ it('finds nothing in unrelated text', () => {
+ expect(findWslDistroHoldInText('spawn failed: ENOENT')).toBeNull()
+ expect(findWslDistroHoldInText('The WSL distro is stopped')).toBeNull()
+ })
+
+ it('makes a code readable and leaves the rest of the text', () => {
+ expect(
+ readableWslDistroHoldText(
+ 'Failed to create the startup terminal for /wt: terminal_held_wsl_distro_unverifiable:Debian'
+ )
+ ).toBe(
+ "Failed to create the startup terminal for /wt: Orca couldn't check whether the WSL distro Debian is running, so it didn't start this terminal. Start the distro, then try again."
+ )
+ expect(readableWslDistroHoldText('spawn failed')).toBe('spawn failed')
+ })
+})
diff --git a/src/shared/wsl-distro-stopped-hold.ts b/src/shared/wsl-distro-stopped-hold.ts
index 709099d02ed..028302f3270 100644
--- a/src/shared/wsl-distro-stopped-hold.ts
+++ b/src/shared/wsl-distro-stopped-hold.ts
@@ -46,3 +46,37 @@ export function wslDistroHoldRpcFailure(message: string): {
const hold = parseWslDistroHold(message)
return hold ? { message: wslDistroHoldUserMessage(hold), data: { wslDistroHold: hold } } : null
}
+
+/** Text with any hold code inside made readable: hosts that build warnings from errors keep the cause. */
+export function readableWslDistroHoldText(text: string): string {
+ const found = findWslDistroHoldInText(text)
+ return found?.form === 'code'
+ ? text.split(found.matched).join(wslDistroHoldUserMessage(found.hold))
+ : text
+}
+
+/**
+ * A hold named in text, as its code or its readable sentence (which RPC failures and warnings
+ * carry), with the exact substring, so a client can swap in its own language.
+ */
+export function findWslDistroHoldInText(text: string): {
+ hold: { distro: string; state: WslDistroHoldState }
+ matched: string
+ form: 'code' | 'sentence'
+} | null {
+ const hold = parseWslDistroHold(text)
+ if (hold) {
+ return { hold, matched: wslDistroHoldMessage(hold.distro, hold.state), form: 'code' }
+ }
+ for (const state of ['stopped', 'unverifiable'] as const) {
+ // The sentence is built here, so its fixed parts locate the distro between them.
+ const [before, after] = wslDistroHoldUserMessage({ distro: '\0', state }).split('\0')
+ const start = text.indexOf(before)
+ const end = start === -1 ? -1 : text.indexOf(after, start + before.length)
+ const distro = end === -1 ? '' : text.slice(start + before.length, end)
+ if (distro && !/\s/.test(distro)) {
+ return { hold: { distro, state }, matched: `${before}${distro}${after}`, form: 'sentence' }
+ }
+ }
+ return null
+}