Repository navigation
Description
Summary
On Windows, resizing the terminal window while the full-screen TUI is running terminates the opencode session. It reproduces both in a plain Windows PowerShell console (classic conhost) and in IntelliJ IDEA's integrated terminal, so it is not specific to one terminal emulator or to ConPTY. The exit is silent: nothing is printed, and nothing is written to opencode's log.
Environment
- opencode version: 2.0.16
- OS: Windows 10 Pro 1909, build 10.0.18363.418 (win32 x64)
- Terminal: classic Windows console (conhost) via Windows PowerShell; also reproduces in IntelliJ IDEA 2026.2.3 integrated terminal (pty4j
WinConPtyProcess). Windows Terminal is not installed on this machine (wt.exeabsent, noWindowsTerminalAppX package,WT_SESSIONunset). - Shell: Windows PowerShell 5.1 (
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe);ComSpec=C:\Windows\system32\cmd.exe - Install/channel: standalone Windows x64 binary (
https://opencode.ai/files/bin/2.0.16/opencode-windows-x64.zip), channellatest - Active plugins: none configured. No
opencode.json/opencode.jsoncexists in~/.config/opencode, the project root, or.opencode/. The log'splugins=12refers to built-in plugins.
Reproduction
- On Windows 10 1909, open Windows PowerShell (a plain conhost window).
cdinto a project and runopencode.- While the TUI is running, drag the console window border to change its width or height.
- The opencode session terminates and control returns to the shell.
The same steps inside IntelliJ IDEA 2026.2.3's integrated terminal also terminate the session.
Expected Behavior
The TUI should handle the resize and keep running, reflowing or redrawing the layout.
Actual Behavior
The session exits immediately on resize. No error text is printed, and ~/.local/share/opencode/log/opencode.log contains no exit or error record for the CLI process — the last entries for that run are ordinary startup and plugin-reconciliation lines. Windows Error Reporting has no crash event for opencode.exe. This looks like the process is being terminated from the console layer rather than exiting on its own.
Additional Context
- Frequency: consistent — every resize terminates the session.
- Reproduced on v2.0.16; observed on earlier installs as well.
- On the server side, the matching client disconnect shows up only as an interrupted event stream:
cause="InterruptError: All fibers interrupted without error at ServerProcess.start (B:/~BUN/root/chunk-*.js) ... http.url=/api/event http.status=200 - In the IntelliJ case, the IDE log shows the console layer failing at the same moment:
WARN LocalTerminalTtyConnector - Failed to send Ctrl+C to WinConPtyProcess, alive:true com.pty4j.windows.conpty.LastErrorExceptionEx: WriteFile stdout failed: GetLastError() returned 232 (the pipe is being closed) SEVERE com.jediterm.terminal.model.TerminalTextBuffer - Attempt to get line out of bounds: 13 >= 13 - Possibly related existing reports: TUI crashes when resizing terminal window (Windows / CMD) #7943 (resize crash on Windows/CMD, closed as not planned), Change window size doesn't work in 1.0.7 + windows terminals #3676 (resize does not update the UI on Windows, works in WSL), bug: TUI exit closes terminal window on Windows #22003 (root-caused to console detachment on Windows — notes no
CTRL_CLOSE_EVENTis fired andGetConsoleWindow()becomes0x0), [FEATURE]: Add safe TUI rendering mode for old Windows conhost terminals #28324 (request for a safe rendering mode on classic conhost, closed as not planned). - The environment uses an old console stack: Windows 10 1909 (build 18363) predates the current ConPTY/conhost work. On the same machine the AppX/MSIX subsystem is also broken — a PowerShell 7.6 MSIX package installs but cannot activate, and winget's
msstoresource fails with a certificate mismatch — which suggests outdated system components. - Workarounds being evaluated:
opencode mini,OTUI_USE_ALTERNATE_SCREEN=0,OTUI_NO_NATIVE_RENDER=1. - The resize exit code could not be captured: the process is terminated and no
exit status is surfaced back to the shell.
Activity
opencodejr commentedon Oct 28, 2026
Thanks for the detailed report. I couldn't reproduce this here: it happens only in Windows consoles (classic conhost and IntelliJ's ConPTY terminal), and the sandbox I run in is Linux, so it needs a maintainer with a Windows machine.
Things that would help whoever picks this up:
opencode mini,OTUI_USE_ALTERNATE_SCREEN=0,OTUI_NO_NATIVE_RENDER=1) stops the exit.opencodefromcmd.exe, resize, then runecho %ERRORLEVEL%. Or run it in another ConPTY host and look for abun.reportURL.Related: #54258 reports the same resize crash on v1. It includes a ConPTY harness, and its decoded stack traces point to OpenTUI's native resize call.