From 35ff897cdb4a2f5f9b2690433028ad27d14c2278 Mon Sep 17 00:00:00 2001 From: AULORBE <18585860+aulorbe@users.noreply.github.com> Date: Wed, 20 May 2026 22:31:16 -0700 Subject: [PATCH] fix(cli): eliminate extra Ctrl+C needed to exit local spawn session After the agent exits via Ctrl+C (exit 130), two things added delay that forced the user to press Ctrl+C a third time: 1. spawnInteractive ran `stty sane` (a synchronous child spawn) after the agent exited, blocking during the exact moment the user expects the process to be dying. 2. runOrchestration continued through post-session cleanup (reconnect logic, history pull, tunnel teardown) before calling process.exit. Fix: on exit code 130, skip terminal cleanup in spawnInteractive and fast-path to process.exit(130) in runOrchestration. --- packages/cli/src/shared/orchestrate.ts | 7 +++++++ packages/cli/src/shared/ssh.ts | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/shared/orchestrate.ts b/packages/cli/src/shared/orchestrate.ts index 7cbde6046..5252840ff 100644 --- a/packages/cli/src/shared/orchestrate.ts +++ b/packages/cli/src/shared/orchestrate.ts @@ -1012,6 +1012,13 @@ async function postInstall( } exitCode = await cloud.interactiveSession(sessionCmd); + // SIGINT — exit immediately. The user is mashing Ctrl+C to get out; + // any post-session work (reconnect logic, history pull, tunnel teardown) + // just adds delay that forces yet another Ctrl+C. + if (exitCode === 130) { + process.exit(130); + } + if (!isConnectionDrop(exitCode)) { break; } diff --git a/packages/cli/src/shared/ssh.ts b/packages/cli/src/shared/ssh.ts index c3f9dee63..945aba794 100644 --- a/packages/cli/src/shared/ssh.ts +++ b/packages/cli/src/shared/ssh.ts @@ -146,6 +146,15 @@ export function spawnInteractive(args: string[], env?: Record