From 331d6210fa5cbfdb5bcb327e88b444330be3c8f8 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Thu, 6 Aug 2026 18:11:40 -0700 Subject: [PATCH] fix(terminal): wait for shell-ready before every SSH startup command Renderer-delivered SSH launches wrote the startup command after a flat 50ms, so a remote shell still reaching its prompt could drop it. Only Codex plans opted into waiting. Gate on whether a startup command exists rather than on which agent it names: an unready shell drops whatever is written to it regardless. The relay already gates its own delivery on the marker it armed; this mirrors that for the renderer path, bounded by the existing 1.5s fallback. --- .../components/terminal-pane/pty-connection.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/renderer/src/components/terminal-pane/pty-connection.ts b/src/renderer/src/components/terminal-pane/pty-connection.ts index 9b843723a2b..54138ecc625 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection.ts @@ -128,8 +128,6 @@ import { } from '../../../../shared/terminal-mode-reset-profiles' import { buildFreshShellViewportBlankingSequence } from './terminal-restored-viewport' import { createShellReadyMarkerScanState, scanForShellReadyMarker } from './shell-ready-marker-scan' -import { shouldUseShellReadyStartupDelivery } from '../../../../shared/codex-startup-delivery' -import { resolveSetupAgentSequenceLaunchCommand } from '../../../../shared/setup-agent-sequencing' import { getSystemPrefersDark } from '@/lib/terminal-theme' import { INITIAL_MODE_2031_REPLY_SCAN_STATE, @@ -4752,16 +4750,13 @@ export function connectPanePty( ? { command: paneStartup.command } : null : null - const startupShellReadyCommandHint = resolveSetupAgentSequenceLaunchCommand( - paneStartup?.env ?? {}, - paneStartup?.command - ) + // Why every startup command and not a per-agent list: a shell that has not reached its + // prompt drops whatever is written to it, whichever agent the command names. The relay + // already gates its own delivery on the marker it armed; this mirrors that for the + // renderer-delivered path, bounded by the existing fallback timer. const shouldWaitForSshShellReady = Boolean(connectionId) && - shouldUseShellReadyStartupDelivery({ - command: startupShellReadyCommandHint, - startupCommandDelivery: paneStartup?.startupCommandDelivery - }) && + Boolean(pendingStartupCommand) && !shouldDeliverStartupViaTerminalPaste const sshShellReadyMarkerScan = shouldWaitForSshShellReady ? createShellReadyMarkerScanState()