From 81fc894b2ea41a04d9d61c9334e022fbb94faeea Mon Sep 17 00:00:00 2001 From: OrcaWin <293788423+OrcaWin@users.noreply.github.com> Date: Tue, 4 Aug 2026 02:39:25 -0400 Subject: [PATCH] test(daemon): pin the getSize probe timeout, and reattach an orphaned comment Review proved a coverage gap by mutation: removing LIVENESS_PROBE_TIMEOUT_MS from the getSize request left the whole suite green, so nothing stopped that leg regressing to the client's 30s default. Only the listSessions leg was pinned. The assertion now fails under exactly that mutation. Also moves isUnknownRequestTypeError below isDaemonGoneError. It had been inserted between isDaemonGoneError and the comment describing it, so that comment read as documenting the wrong function. --- src/main/daemon/daemon-pty-adapter.test.ts | 7 +++++++ src/main/daemon/daemon-pty-adapter.ts | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/daemon/daemon-pty-adapter.test.ts b/src/main/daemon/daemon-pty-adapter.test.ts index 3c8604a22c3..7a5b5210a1b 100644 --- a/src/main/daemon/daemon-pty-adapter.test.ts +++ b/src/main/daemon/daemon-pty-adapter.test.ts @@ -1273,6 +1273,13 @@ describe('DaemonPtyAdapter (IPtyProvider)', () => { // The rejection is remembered, so later probes skip the round trip that cannot work. expect(request.mock.calls.filter(([type]) => type === 'getSize')).toHaveLength(1) + // Why pinned here: a wedged daemon holds its socket open, so an unbounded getSize would + // stall a pane mount for the client's 30s default instead of answering "unknown" in 2s. + expect(request).toHaveBeenCalledWith( + 'getSize', + { sessionId: 'ambiguous-live' }, + LIVENESS_PROBE_TIMEOUT_MS + ) ambiguous.dispose() }) diff --git a/src/main/daemon/daemon-pty-adapter.ts b/src/main/daemon/daemon-pty-adapter.ts index 2617272110b..1a8e7ce5576 100644 --- a/src/main/daemon/daemon-pty-adapter.ts +++ b/src/main/daemon/daemon-pty-adapter.ts @@ -2442,8 +2442,6 @@ function notifyAuditListeners(listeners: readonly ((value: T) => void)[], val } } -// Why: syscall='connect' distinguishes a dead-socket ENOENT/ECONNREFUSED from token-file ENOENT (no syscall); -// message strings incl. wedged-daemon "Hello response timed out" (#8689) also warrant a respawn. /** * Narrow on purpose: only the daemon's own reply for a request type it does not implement. * A transient failure must stay unproven rather than be mistaken for a missing capability. @@ -2454,6 +2452,8 @@ function isUnknownRequestTypeError(err: unknown): boolean { return err instanceof Error && err.message.includes('Unknown request type') } +// Why: syscall='connect' distinguishes a dead-socket ENOENT/ECONNREFUSED from token-file ENOENT (no syscall); +// message strings incl. wedged-daemon "Hello response timed out" (#8689) also warrant a respawn. function isDaemonGoneError(err: unknown): boolean { if (!(err instanceof Error)) { return false