The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(desktop): coalesced Linux GPU-child death path, disable-gpu override, silent-retry check
Brooklyn Nicholsonb3e072587307
diff --git a/apps/desktop/electron/linux-gpu-fallback.test.ts b/apps/desktop/electron/linux-gpu-fallback.test.tsindex 13e448c5200..79426f63523 100644--- a/apps/desktop/electron/linux-gpu-fallback.test.ts+++ b/apps/desktop/electron/linux-gpu-fallback.test.ts@@ -2,9 +2,12 @@ import { describe, expect, it } from 'vitest'import {decideLinuxGpuLaunch,+ disableGpuSwitchNeededForReason,+ linuxGpuChildDeathPath,linuxGpuFallbackMarker,linuxGpuMarkerAfterSuccessfulBoot,parseLinuxGpuMarker,+ shouldEngageSilentGpuRetryFallback,shouldRelaunchForLinuxGpuCrash} from './linux-gpu-fallback'@@ -208,3 +211,119 @@ describe('linuxGpuMarkerAfterSuccessfulBoot', () => {})})})++describe('linuxGpuChildDeathPath', () => {+ const SIGTERM_DEATH = { type: 'GPU', reason: 'crashed', exitCode: 143, signalName: 'SIGTERM' }++ it('prefers the sandbox ladder on the #121954 SIGTERM signature', () => {+ expect(linuxGpuChildDeathPath({ platform: 'linux', details: SIGTERM_DEATH })).toBe('no-sandbox')+ })++ it('falls to software when the sandbox relaunch was already spent (relapse)', () => {+ expect(+ linuxGpuChildDeathPath({+ platform: 'linux',+ details: SIGTERM_DEATH,+ sandboxRelaunchAttempted: true+ })+ ).toBe('disable-gpu')+ expect(+ linuxGpuChildDeathPath({+ platform: 'linux',+ details: SIGTERM_DEATH,+ alreadyNoSandbox: true+ })+ ).toBe('disable-gpu')+ })++ it('sends non-signature GPU failures straight to software', () => {+ expect(+ linuxGpuChildDeathPath({+ platform: 'linux',+ details: { type: 'GPU', reason: 'launch-failure', exitCode: 1002 }+ })+ ).toBe('disable-gpu')+ expect(+ linuxGpuChildDeathPath({ platform: 'linux', details: { type: 'GPU', reason: 'crashed', exitCode: 139 } })+ ).toBe('disable-gpu')+ })++ it('produces at most one decision: both ladders spent or already on means none', () => {+ expect(+ linuxGpuChildDeathPath({+ platform: 'linux',+ details: SIGTERM_DEATH,+ sandboxRelaunchAttempted: true,+ softwareRelaunchAttempted: true+ })+ ).toBeNull()+ expect(+ linuxGpuChildDeathPath({+ platform: 'linux',+ details: { type: 'GPU', reason: 'crashed' },+ alreadySoftware: true+ })+ ).toBeNull()+ })++ it('ignores non-GPU deaths and other platforms', () => {+ expect(+ linuxGpuChildDeathPath({ platform: 'linux', details: { type: 'Renderer', reason: 'crashed' } })+ ).toBeNull()+ expect(linuxGpuChildDeathPath({ platform: 'darwin', details: SIGTERM_DEATH })).toBeNull()+ expect(linuxGpuChildDeathPath({ platform: 'linux' })).toBeNull()+ })++ it('requires the full SIGTERM signature for the sandbox path, not just exit 143', () => {+ expect(+ linuxGpuChildDeathPath({+ platform: 'linux',+ details: { type: 'GPU', reason: 'crashed', exitCode: 143, signalName: 'SIGKILL' }+ })+ ).toBe('disable-gpu')+ // #121954's contract (shouldRelaunchForGpuSandboxCrash) checks the+ // signal signature only: a GPU child SIGTERMed by Chromium is its own+ // "never became usable" shutdown — the reason string carries no extra+ // signal (an OOM would arrive as SIGKILL, above).+ expect(+ linuxGpuChildDeathPath({+ platform: 'linux',+ details: { type: 'GPU', reason: 'oom', exitCode: 143, signalName: 'SIGTERM' }+ })+ ).toBe('no-sandbox')+ })+})++describe('disableGpuSwitchNeededForReason', () => {+ it('spawn-blocks the GPU process only for the explicit env override', () => {+ expect(disableGpuSwitchNeededForReason('override (HERMES_DESKTOP_DISABLE_GPU)')).toBe(true)+ expect(disableGpuSwitchNeededForReason('ssh-session')).toBe(false)+ expect(disableGpuSwitchNeededForReason('vnc-session')).toBe(false)+ expect(disableGpuSwitchNeededForReason(null)).toBe(false)+ })+})++describe('shouldEngageSilentGpuRetryFallback', () => {+ it('engages only on Linux, after the grace window, with no GPU child, not already software', () => {+ expect(+ shouldEngageSilentGpuRetryFallback({ platform: 'linux', gpuChildPresent: false, graceElapsed: true })+ ).toBe(true)+ expect(+ shouldEngageSilentGpuRetryFallback({ platform: 'linux', gpuChildPresent: true, graceElapsed: true })+ ).toBe(false)+ expect(+ shouldEngageSilentGpuRetryFallback({ platform: 'linux', gpuChildPresent: false, graceElapsed: false })+ ).toBe(false)+ expect(+ shouldEngageSilentGpuRetryFallback({+ platform: 'linux',+ gpuChildPresent: false,+ graceElapsed: true,+ alreadySoftware: true+ })+ ).toBe(false)+ expect(+ shouldEngageSilentGpuRetryFallback({ platform: 'darwin', gpuChildPresent: false, graceElapsed: true })+ ).toBe(false)+ })+})