You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Windows] Pressing Ctrl+C to exit opencode unexpectedly closes the current window / quits Warp application #10051
This may overlap with #8670, but I only found one strong in-repo match, so I am not marking it as a duplicate. OpenCode's upstream Ctrl+C handling was changed after anomalyco/opencode#6189, so the current OpenCode version will help determine whether this is still a Warp-specific regression.
I have a few follow-up questions before I can narrow this down:
Which Warp version/channel and OpenCode version reproduce the window close on Windows?
Which shell is running inside Warp when this happens, for example PowerShell, cmd, Git Bash/MSYS2, or WSL?
Reply in-thread with those details and the triage workflow will automatically re-evaluate the issue and update the diagnosis, labels, and next steps.
Maintainer details
I concluded that windows OpenCode Ctrl+C appears to be a Warp terminal-input/PTY lifecycle bug where Ctrl+C intended for the running TUI can lead to the terminal session/window closing instead of only interrupting OpenCode..
Initial triage
This appears to be a Windows-specific bug involving Ctrl+C handling while opencode is running. The expected behavior is that Ctrl+C is delivered to the running OpenCode process/TUI; the reported behavior is that the active Warp window closes, and if it is the only window the app quits.
A very similar existing Warp issue is #8670, which includes reproduction steps and a video for Windows 11 / Warp v0.2026.02.11.08.23.stable_01. However, only one strong in-repo duplicate candidate was found, so this triage is not marking the issue as a duplicate under the workflow's duplicate threshold.
The referenced upstream OpenCode issue anomalyco/opencode#6189 was closed after OpenCode added Ctrl+C handling in 1.1.60, with later comments suggesting additional fixes by 1.3.3. That makes the exact current OpenCode version important before assigning full ownership to Warp.
Maintainer notes:
app/src/terminal/view/init.rs registers terminal:cancel_command on ctrl-c for terminal focus.
app/src/terminal/view.rs routes Ctrl+C through TerminalAction::CtrlC; on Windows it copies only when a block/alt-screen selection exists, otherwise ctrl_c_to_active_block writes ETX (0x03) to the active long-running PTY.
app/src/terminal/writeable_pty/pty_controller.rs forwards those bytes to the PTY event loop.
app/src/terminal/local_tty/windows/mod.rs / app/src/terminal/local_tty/event_loop.rs cover ConPTY lifecycle. If the shell/PTY exits, TerminalModel::exit emits an exit event; app/src/terminal/view.rs emits Event::Exited, and app/src/pane_group/pane/terminal_pane.rs closes the pane, which can cascade through tab/window close behavior when this is the last pane/tab.
Code inspection did not find evidence that Windows Ctrl+C is directly bound to CloseWindow; CloseWindow's default shortcut is mac-only (cmd-shift-W).
Suggested next step is to reproduce on Windows with a current Warp build and current OpenCode, capturing whether the shell process exits or only the opencode child exits after Ctrl+C.
Question reasoning
Which Warp version/channel and OpenCode version reproduce the window close on Windows? — The current report does not include versions, and the referenced upstream OpenCode issue was reportedly fixed in newer OpenCode versions, so version data determines whether this is a stale upstream behavior or a current Warp regression.
Which shell is running inside Warp when this happens, for example PowerShell, cmd, Git Bash/MSYS2, or WSL? — Windows Ctrl+C and process-exit behavior can differ by shell/ConPTY host path, and the report does not specify which shell owns the OpenCode process when the Warp window closes.
This is my automated analysis and may be incorrect. A maintainer will verify the details.
Adding host-side root-cause data — hopefully enough to flip repro:unknown → confirmed and unblock the fix.
Reproduces 100% on
Warp on Windows 11 (build 26200)
PowerShell 7 (also reproduces in cmd /k opencode and powershell -NoExit -Command "opencode")
opencode 1.0.x in default (server + TUI) mode
Exiting via /exitor Ctrl+C × 2 — both trigger it
Captured close chain
I instrumented the Windows PTY path with log::info! calls around: the ChildExitWatcher callback, the PTY event loop's Message::ChildExited branch, TerminalModel::exit, Pty::drop, TerminalView's ModelEvent::Exit handling, and TerminalPane's Event::Exited handler. After exiting OpenCode the log shows, in order:
The first line is the load-bearing one. ChildExitWatcher is registered via RegisterWaitForSingleObject against process_information.hProcess in app/src/terminal/local_tty/windowshosted shell's** handle, notOpenCode's. So the parent PowerShelg* the moment OpenCode tears down.Everything after that (ShellProcessExited→Event::Exited→close_pane`) is Warp correctly reacting to its child shell dying. The pane-close is a symptom, not the bug.
Why this isn't "PowerShell choo
Setup
Hosted shell dies?
Native conhost.exe + opencode
No
Warp ConPTY + opencode (default server+TUI)
Yes
Warp ConPTY + `powershell -NoExit**
Warp ConPTY + cmd /k opencode
Yes
Warp ConPTY + opencode serve … then opencode attach …
No
-NoExit / cmd /k ruling out a bpencode attach(no server child) not reproducing, both point at Openraising a Windows console controlevent that propagates to the entire console process group. Underconhost.exe` the parent shell happens to survive; under a ConPTY it doesn't, because the hosted shell isn't isolated into its own process group.
Looking at app/src/terminal/local_tty/windows/mod.rs::spawn, the shell is currently created with:
No CREATE_NEW_PROCESS_GROUP. Addinghat interactive Ctrl+C still reaches
the shell) should make Warp robustprocess generating CTRL_C_EVENT /CTRL_BREAK_EVENT toward group 0, regardless of whether OpenCode also fixes its side.
Cross-ref upstream
Same root behaviour is tracked in O/anomalyco/opencode/issues/6189(closed, but only the /exit path was addressed; Ctrl+C×2 in default mode still kills the parent shell). Even if OpenCode patches it, hardening the Warp side prevents any future TUI agent from being able to take down the hosted shell the same way.
@Zyl0812 Thanks for providing the information. I have added repro:high.
Have you tried adding CREATE_NEW_PROCESS_GROUP to the flags and verifying that this both fixes the issue and doesn't break ctrl-c's intended behavior in other contexts?
I checked the Windows Terminal source code and it looks like they don't use CREATE_NEW_PROCESS_GROUP. Therefore, I'm hesitant to use this flag.
I just repro'd this problem in both Alacritty and WezTerm (on Windows) and both have the same behavior. I'm starting to think this is not actually a Warp bug. I'm going to de-prioritize this work on the Warp engineers side for now. If this is affecting multiple terminals then this is probably a deeper issue. If any contributors want to push this forward, please explain why this is affecting those other terminals and why/how Warp can fix this.
I'm also moving this back to read-to-spec since it's not clear that this is even a Warp problem
Activity
warp-for-oss commentedon May 4, 2026
@peicodes
Here's what I found while triaging this issue:
This may overlap with #8670, but I only found one strong in-repo match, so I am not marking it as a duplicate. OpenCode's upstream Ctrl+C handling was changed after anomalyco/opencode#6189, so the current OpenCode version will help determine whether this is still a Warp-specific regression.
I have a few follow-up questions before I can narrow this down:
Reply in-thread with those details and the triage workflow will automatically re-evaluate the issue and update the diagnosis, labels, and next steps.
Maintainer details
I concluded that windows OpenCode Ctrl+C appears to be a Warp terminal-input/PTY lifecycle bug where Ctrl+C intended for the running TUI can lead to the terminal session/window closing instead of only interrupting OpenCode..
Initial triage
This appears to be a Windows-specific bug involving Ctrl+C handling while
opencodeis running. The expected behavior is that Ctrl+C is delivered to the running OpenCode process/TUI; the reported behavior is that the active Warp window closes, and if it is the only window the app quits.A very similar existing Warp issue is #8670, which includes reproduction steps and a video for Windows 11 / Warp
v0.2026.02.11.08.23.stable_01. However, only one strong in-repo duplicate candidate was found, so this triage is not marking the issue as a duplicate under the workflow's duplicate threshold.The referenced upstream OpenCode issue anomalyco/opencode#6189 was closed after OpenCode added Ctrl+C handling in
1.1.60, with later comments suggesting additional fixes by1.3.3. That makes the exact current OpenCode version important before assigning full ownership to Warp.Maintainer notes:
app/src/terminal/view/init.rsregistersterminal:cancel_commandonctrl-cfor terminal focus.app/src/terminal/view.rsroutes Ctrl+C throughTerminalAction::CtrlC; on Windows it copies only when a block/alt-screen selection exists, otherwisectrl_c_to_active_blockwrites ETX (0x03) to the active long-running PTY.app/src/terminal/writeable_pty/pty_controller.rsforwards those bytes to the PTY event loop.app/src/terminal/local_tty/windows/mod.rs/app/src/terminal/local_tty/event_loop.rscover ConPTY lifecycle. If the shell/PTY exits,TerminalModel::exitemits an exit event;app/src/terminal/view.rsemitsEvent::Exited, andapp/src/pane_group/pane/terminal_pane.rscloses the pane, which can cascade through tab/window close behavior when this is the last pane/tab.CloseWindow;CloseWindow's default shortcut is mac-only (cmd-shift-W).Suggested next step is to reproduce on Windows with a current Warp build and current OpenCode, capturing whether the shell process exits or only the
opencodechild exits after Ctrl+C.Question reasoning
This is my automated analysis and may be incorrect. A maintainer will verify the details.
Powered by Oz
Zyl0812 commentedon May 9, 2026
Adding host-side root-cause data — hopefully enough to flip
repro:unknown→ confirmed and unblock the fix.Reproduces 100% on
cmd /k opencodeandpowershell -NoExit -Command "opencode")opencode1.0.x in default (server + TUI) mode/exitor Ctrl+C × 2 — both trigger itCaptured close chain
I instrumented the Windows PTY path with
log::info!calls around: theChildExitWatchercallback, the PTY event loop'sMessage::ChildExitedbranch,TerminalModel::exit,Pty::drop,TerminalView'sModelEvent::Exithandling, andTerminalPane'sEvent::Exitedhandler. After exiting OpenCode the log shows, in order:ChildExitWatcher: shell process handle signaled, sending Message::ChildExited
[1778298010.572] PTY event loop: child_exited=true, calling exit(ShellProcessExited)
[1778298010.572] TerminalModel::exit(reason=ShellProcessExited), handled_exit=false, alt_screen_active=false
Windows Pty::drop: closing ConPTY handle
[1778298010.575] TerminalView: ModelEvent::Exit reason=ShellProcessExited, manual_shutdown=false, pty_spawn_failed=false, is_bootstrapped=true
[1778298010.575] TerminalView: emitting Event::Exited to pane_group
[1778298010.575] TerminalPane: Event::Exited, pane_id=PaneId(IPaneId { pane_type: Terminal, pane_view_id: EntityId(1810) }), is_bootstrapped=true
[1778298010.575] TerminalPane: calling close_pane for pane_id=...
The first line is the load-bearing one.
ChildExitWatcheris registered viaRegisterWaitForSingleObjectagainstprocess_information.hProcessinapp/src/terminal/local_tty/windowshosted shell's** handle, notOpenCode's. So the parent PowerShelg* the moment OpenCode tears down.Everything after that (ShellProcessExited→Event::Exited→close_pane`) is Warp correctly reacting to its child shell dying. The pane-close is a symptom, not the bug.Why this isn't "PowerShell choo
opencodeopencode(default server+TUI)cmd /k opencodeopencode serve …thenopencode attach …-NoExit/cmd /kruling out a bpencode attach(no server child) not reproducing, both point at Openraising a Windows console controlevent that propagates to the entire console process group. Underconhost.exe` the parent shell happens to survive; under a ConPTY it doesn't, because the hosted shell isn't isolated into its own process group.Looking at
app/src/terminal/local_tty/windows/mod.rs::spawn, the shell is currently created with:No CREATE_NEW_PROCESS_GROUP. Addinghat interactive Ctrl+C still reaches
the shell) should make Warp robustprocess generating CTRL_C_EVENT /CTRL_BREAK_EVENT toward group 0, regardless of whether OpenCode also fixes its side.
Cross-ref upstream
Same root behaviour is tracked in O/anomalyco/opencode/issues/6189(closed, but only the /exit path was addressed; Ctrl+C×2 in default mode still kills the parent shell). Even if OpenCode patches it, hardening the Warp side prevents any future TUI agent from being able to take down the hosted shell the same way.
acarl005 commentedon May 11, 2026
@Zyl0812 Thanks for providing the information. I have added
repro:high.Have you tried adding
CREATE_NEW_PROCESS_GROUPto the flags and verifying that this both fixes the issue and doesn't break ctrl-c's intended behavior in other contexts?I checked the Windows Terminal source code and it looks like they don't use
CREATE_NEW_PROCESS_GROUP. Therefore, I'm hesitant to use this flag.https://github.com/microsoft/terminal/blob/3e3b3ad883d134bdab26850d42e2a8308da40086/src/cascadia/TerminalConnection/ConptyConnection.cpp#L172
acarl005 commentedon May 11, 2026
I just repro'd this problem in both Alacritty and WezTerm (on Windows) and both have the same behavior. I'm starting to think this is not actually a Warp bug. I'm going to de-prioritize this work on the Warp engineers side for now. If this is affecting multiple terminals then this is probably a deeper issue. If any contributors want to push this forward, please explain why this is affecting those other terminals and why/how Warp can fix this.
I'm also moving this back to
read-to-specsince it's not clear that this is even a Warp problem