From 6ab273ef362be4056c16c2caec715fe794532fbf Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Wed, 19 Aug 2026 21:54:01 -0700 Subject: [PATCH] Increase shell readiness timeout to match daemon barrier Slow interactive rc files can take longer than 1.5s to initialize. Raise the startup command readiness timeout from 1.5s to 15s to match the daemon barrier and prevent queued commands from executing mid-startup. --- .../providers/local-pty-provider-shell-readiness.test.ts | 7 +++++++ .../providers/local-pty-shell-ready-startup-command.ts | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/providers/local-pty-provider-shell-readiness.test.ts b/src/main/providers/local-pty-provider-shell-readiness.test.ts index c4621382e66..0d80fedf4a1 100644 --- a/src/main/providers/local-pty-provider-shell-readiness.test.ts +++ b/src/main/providers/local-pty-provider-shell-readiness.test.ts @@ -114,6 +114,7 @@ vi.mock('../shell-prompt-readiness-probe', () => ({ })) import { LocalPtyProvider } from './local-pty-provider' +import { STARTUP_COMMAND_READY_MAX_WAIT_MS } from './local-pty-shell-ready-startup-command' import { applyLocalPtyProviderMockDefaults, createLocalPtyMockProcess, @@ -240,6 +241,12 @@ describe('LocalPtyProvider', () => { vi.advanceTimersByTime(1500) await Promise.resolve() + expect(onData).not.toHaveBeenCalled() + expect(mockProc.write).not.toHaveBeenCalled() + + vi.advanceTimersByTime(STARTUP_COMMAND_READY_MAX_WAIT_MS - 1500) + await Promise.resolve() + expect(onData).toHaveBeenCalledWith( expect.any(String), '\x1b]777;orca-shell-ready', diff --git a/src/main/providers/local-pty-shell-ready-startup-command.ts b/src/main/providers/local-pty-shell-ready-startup-command.ts index bf7f73c19d7..39ce2c4bbc9 100644 --- a/src/main/providers/local-pty-shell-ready-startup-command.ts +++ b/src/main/providers/local-pty-shell-ready-startup-command.ts @@ -4,7 +4,8 @@ import type * as pty from 'node-pty' import { buildStartupCommandSubmission } from '../../shared/startup-command-submission' -export const STARTUP_COMMAND_READY_MAX_WAIT_MS = 1500 +// Match the daemon barrier so slow interactive rc files do not receive queued commands mid-startup. +export const STARTUP_COMMAND_READY_MAX_WAIT_MS = 15_000 const POST_SHELL_READY_STARTUP_COMMAND_DELAY_MS = 30 const POST_SHELL_READY_STARTUP_COMMAND_FALLBACK_MS = 200