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
Child process exiting the alternate screen during shutdown takes down the terminal window on Windows #9077
Child process exiting the alternate screen during shutdown takes down the terminal window on Windows
Symptom
When a child process running in Alacritty on Windows leaves the alternate screen as part of its shutdown, the Alacritty window itself exits. Nothing is left to type at. Reproduced with an OpenTUI-based TUI, but I do not believe this is specific to that library: it looks like host behaviour on the exit sequence.
Reproduction
Same machine, same application build, two Windows terminals:
The control case matters: Windows Terminal is also ConPTY and is unaffected by the same build, which is why I read this as Alacritty-specific rather than a ConPTY-wide problem.
Both an orderly exit command and an interrupt trigger it, and no multiplexer is required.
Control
The application can be configured not to use the alternate screen, and the failure disappears:
OTUI_USE_ALTERNATE_SCREEN=0
3 of 3 runs survive in Alacritty with the epilogue visible. That confirms the exit sequence from the alternate screen is the trigger, without saying why the host reacts by closing.
What I have not established
I have the trigger, not the mechanism. I do not know whether it is the ?1049l sequence itself, its ordering relative to process exit, or how Alacritty's ConPTY handling deals with a mode change arriving during teardown. I did not capture the raw byte stream, because the failure needs the host to actually close and a capture harness under my control does not close.
Confirmed against the current release, not just a dev build.
@opencode/cli 2.0.30 (latest at the time of writing) reproduces it, and OTUI_USE_ALTERNATE_SCREEN=0 works on that release as well. Verified from the packaged binary rather than from source:
Build
OTUI_USE_ALTERNATE_SCREEN unset
OTUI_USE_ALTERNATE_SCREEN=0
2.0.30
host terminal exits
survives, epilogue visible, 3 of 3
2.0.28
host terminal exits
not measured
So the behaviour is reproducible in a shipped artifact, and the application-side control works as documented in OpenTUI's env-vars.mdx.
I have not determined whether Alacritty ever reaches the point of reacting to the sequence. What I can say is that the same bytes, from the same build, leave the host alive in Windows Terminal and dead in Alacritty 0.17.0. A capture of the raw stream during teardown would settle it, and I still do not have one, because the harness would have to be a real Alacritty window.
Activity
kraso commentedon Oct 15, 2026
Confirmed against the current release, not just a dev build.
@opencode/cli2.0.30 (latest at the time of writing) reproduces it, andOTUI_USE_ALTERNATE_SCREEN=0works on that release as well. Verified from the packaged binary rather than from source:OTUI_USE_ALTERNATE_SCREENunsetOTUI_USE_ALTERNATE_SCREEN=0So the behaviour is reproducible in a shipped artifact, and the application-side control works as documented in OpenTUI's
env-vars.mdx.I have not determined whether Alacritty ever reaches the point of reacting to the sequence. What I can say is that the same bytes, from the same build, leave the host alive in Windows Terminal and dead in Alacritty 0.17.0. A capture of the raw stream during teardown would settle it, and I still do not have one, because the harness would have to be a real Alacritty window.