fix(wsl): a missing host gh or glab never boots a stopped default distro (#35709)

Cwd-less gh/glab calls whose host CLI is missing fell back to the default
WSL distro with no running check, so background work (rate limits, auth
status, Settings, task-source probes) booted a stopped distro. The
fallback now asks the background exec gate first: stopped or
unverifiable refuses with the distro-stopped error, running and user
acts fall back as before.
This commit is contained in:
Neil
2026-10-28 22:39:49 -07:00
committed by GitHub
parent 300b241fc6
commit b9996755b3
7 changed files with 162 additions and 8 deletions
@@ -1,4 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type * as BackgroundDistroGate from '../../../wsl-background-distro-gate'
import {
fakeSpawnDispatch,
createFakeSpawnedChild
@@ -9,6 +10,12 @@ import { startCheckJobLogDownload } from './check-job-log-download'
import { prCheckLogTailCache } from './check-job-log-tails'
import { setDefaultWslDistroOverride } from '../../../git/runner'
const { spawnMock, distroMock } = vi.hoisted(() => ({ spawnMock: vi.fn(), distroMock: vi.fn() }))
// The default-distro fallback asks whether the distro runs before it may start it (E9).
vi.mock('../../../wsl-background-distro-gate', async (importOriginal) => ({
...(await importOriginal<typeof BackgroundDistroGate>()),
readWslDistroRunningState: vi.fn(async () => 'running')
}))
vi.mock('node:child_process', async (original) => ({ ...(await original()), spawn: spawnMock }))
vi.mock('../../../wsl', async (original) => ({
...(await original<typeof WslModule>()),