From 66abb421c855be5f0f7cecdfac6e2020bfb8f671 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Fri, 28 Aug 2026 06:00:01 -0700 Subject: [PATCH] test(relay): follow isProcessAlive to pty-process-probes after the rebase #17012 landed on main spying on ptyShellUtils.isProcessAlive while this branch moved the probe into pty-process-probes. The rebase merges textually clean but breaks 6 of the file's 9 tests and the node typecheck. --- src/relay/pty-handler-retired-pane-surface.test.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/relay/pty-handler-retired-pane-surface.test.ts b/src/relay/pty-handler-retired-pane-surface.test.ts index 617cc9ce1fd..2edd98fb315 100644 --- a/src/relay/pty-handler-retired-pane-surface.test.ts +++ b/src/relay/pty-handler-retired-pane-surface.test.ts @@ -28,7 +28,7 @@ vi.mock('../main/shell-prompt-readiness-probe', () => ({ createShellPromptReadinessProbe: mockCreateShellPromptReadinessProbe })) -import * as ptyShellUtils from './pty-shell-utils' +import * as ptyProcessProbes from './pty-process-probes' import type { PtyHandler } from './pty-handler' import { IMMEDIATE_PTY_EXIT_TIMEOUT_MS, @@ -115,7 +115,7 @@ describe('PtyHandler retires a closed pane surface', () => { }) it('retires the surface even when the shell survives the kill request', async () => { - vi.spyOn(ptyShellUtils, 'isProcessAlive').mockReturnValue(true) + vi.spyOn(ptyProcessProbes, 'isProcessAlive').mockReturnValue(true) const { id } = await spawnAgentPane() await dispatcher.callRequest('pty.shutdown', { id }) @@ -131,7 +131,7 @@ describe('PtyHandler retires a closed pane surface', () => { }) it('re-issues the force kill instead of letting a detached shell outlive its tab', async () => { - vi.spyOn(ptyShellUtils, 'isProcessAlive').mockReturnValue(true) + vi.spyOn(ptyProcessProbes, 'isProcessAlive').mockReturnValue(true) const { id, term } = await spawnAgentPane() await dispatcher.callRequest('pty.shutdown', { id }) @@ -149,7 +149,7 @@ describe('PtyHandler retires a closed pane surface', () => { it('never re-closes a ConPTY handle on Windows, where the first kill is already final', async () => { Object.defineProperty(process, 'platform', { configurable: true, value: 'win32' }) - vi.spyOn(ptyShellUtils, 'isProcessAlive').mockReturnValue(true) + vi.spyOn(ptyProcessProbes, 'isProcessAlive').mockReturnValue(true) const { id, term } = await spawnAgentPane() // The immediate path is the one that reaches ConPTY's kill without setting gracefulKillSent. @@ -167,7 +167,7 @@ describe('PtyHandler retires a closed pane surface', () => { it('retires the relay session once the sweep proves the process is gone', async () => { const exits: { id: string; paneKey?: string }[] = [] handler.setExitListener((event) => exits.push(event)) - const alive = vi.spyOn(ptyShellUtils, 'isProcessAlive').mockReturnValue(true) + const alive = vi.spyOn(ptyProcessProbes, 'isProcessAlive').mockReturnValue(true) const { id } = await spawnAgentPane() expect((await listProcesses())[0]?.agentSessionOwners).toHaveLength(1) @@ -182,7 +182,7 @@ describe('PtyHandler retires a closed pane surface', () => { }) it('stops advertising an agent session whose process died without a node-pty exit', async () => { - const alive = vi.spyOn(ptyShellUtils, 'isProcessAlive').mockReturnValue(true) + const alive = vi.spyOn(ptyProcessProbes, 'isProcessAlive').mockReturnValue(true) await spawnAgentPane() expect((await listProcesses())[0]?.agentSessionOwners).toHaveLength(1) @@ -206,7 +206,7 @@ describe('PtyHandler retires a closed pane surface', () => { }) it('restores the surface when a client reattaches to a shut-down PTY that survived', async () => { - vi.spyOn(ptyShellUtils, 'isProcessAlive').mockReturnValue(true) + vi.spyOn(ptyProcessProbes, 'isProcessAlive').mockReturnValue(true) const { id } = await spawnAgentPane() await dispatcher.callRequest('pty.shutdown', { id }) expect(handler.isPaneSurfaceRetired(PANE_KEY)).toBe(true)