From f7eb6f26656f333d4ef68a610fb53e2f6176fcbb Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Wed, 12 Aug 2026 03:09:03 -0700 Subject: [PATCH] fix(terminal): suppress the whole saved startup set, not field by field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Round 4 self-check on my own round-3 fix. `suppressSavedStartup` guarded four of the six values `connect` falls back to — `launchAgent` and `startupCommandDelivery` still inherited from the transport's constructor. Adding the guard per field is precisely how those two were missed, and the guarded expressions had become unreadable. The saved values are now one object that `suppressSavedStartup` drops wholesale. A field added later is covered by construction rather than by remembering. Found by asking the question the review lens was given rather than waiting for its answer: does the suppression cover EVERY channel, or only the ones I noticed? It did not. --- .../components/terminal-pane/pty-transport.ts | 47 ++++++++++++++----- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/src/renderer/src/components/terminal-pane/pty-transport.ts b/src/renderer/src/components/terminal-pane/pty-transport.ts index 4acdeb2890a..6ce782258eb 100644 --- a/src/renderer/src/components/terminal-pane/pty-transport.ts +++ b/src/renderer/src/components/terminal-pane/pty-transport.ts @@ -809,6 +809,26 @@ export function createIpcPtyTransport(opts: IpcPtyTransportOptions = {}): PtyTra // Why: cwd fallback is only for fresh local spawns — reattach keeps the session's cwd and SSH transports resolve cwd on the remote host. const shouldSendLocalCwdFallback = cwdFallback === 'worktree' && !connectionId && !admittedSessionId + // Every startup value this transport was CONSTRUCTED with. `suppressSavedStartup` drops the + // whole set at once: a "fresh" shell that inherits any of them can resume the agent session + // it was meant to leave alone, and suppressing them field by field is how two were missed. + const saved = options.suppressSavedStartup + ? ({} as Partial<{ + command: typeof command + launchConfig: typeof launchConfig + resumeProviderSession: typeof resumeProviderSession + launchToken: typeof launchToken + launchAgent: typeof launchAgent + startupCommandDelivery: typeof startupCommandDelivery + }>) + : { + command, + launchConfig, + resumeProviderSession, + launchToken, + launchAgent, + startupCommandDelivery + } const result = await window.api.pty.spawn({ cols: options.cols ?? 80, rows: options.rows ?? 24, @@ -818,26 +838,27 @@ export function createIpcPtyTransport(opts: IpcPtyTransportOptions = {}): PtyTra ...((options.envToDelete ?? envToDelete) ? { envToDelete: options.envToDelete ?? envToDelete } : {}), - command: options.suppressSavedStartup ? options.command : (options.command ?? command), - ...((options.suppressSavedStartup ? options.launchConfig : (options.launchConfig ?? launchConfig)) - ? { launchConfig: options.launchConfig ?? launchConfig } + command: options.command ?? saved.command, + ...((options.launchConfig ?? saved.launchConfig) + ? { launchConfig: options.launchConfig ?? saved.launchConfig } : {}), - ...((options.suppressSavedStartup - ? options.resumeProviderSession - : (options.resumeProviderSession ?? resumeProviderSession)) + ...((options.resumeProviderSession ?? saved.resumeProviderSession) ? { resumeProviderSession: - options.resumeProviderSession ?? resumeProviderSession + options.resumeProviderSession ?? saved.resumeProviderSession } : {}), - ...((options.suppressSavedStartup ? options.launchToken : (options.launchToken ?? launchToken)) - ? { launchToken: options.launchToken ?? launchToken } + ...((options.launchToken ?? saved.launchToken) + ? { launchToken: options.launchToken ?? saved.launchToken } : {}), - ...((options.launchAgent ?? launchAgent) - ? { launchAgent: options.launchAgent ?? launchAgent } + ...((options.launchAgent ?? saved.launchAgent) + ? { launchAgent: options.launchAgent ?? saved.launchAgent } : {}), - ...((options.startupCommandDelivery ?? startupCommandDelivery) - ? { startupCommandDelivery: options.startupCommandDelivery ?? startupCommandDelivery } + ...((options.startupCommandDelivery ?? saved.startupCommandDelivery) + ? { + startupCommandDelivery: + options.startupCommandDelivery ?? saved.startupCommandDelivery + } : {}), ...(connectionId ? { connectionId } : {}), ...(admittedSessionId ? { sessionId: admittedSessionId } : {}),