Description
OpenCode TUI crashes on Windows after a long-running session (~116 minutes). The process segfaults inside the embedded Bun runtime (v1.3.14) during an FFI call.
Stack trace points to Zig::JSFFIFunction::trampoline (JSFFIFunction.cpp:166). The only bun:ffi usage in OpenCode is the Windows console Ctrl+C guard in packages/opencode/src/cli/cmd/tui/win32.ts (win32InstallCtrlCGuard), which polls GetConsoleMode / SetConsoleMode on kernel32.dll every 100ms. That guard is installed from thread.ts and app.tsx when the TUI starts.
Crash report: https://bun.report/1.3.14/ea10d9b296m7Bz+339/DC8B.bebf9eff3affffbf-00000000.dllup1xB_is33sB___A2qaxv/jqH
This may be a Bun runtime defect, but OpenCode is the only code path exercising repeated FFI here. Consider reducing or eliminating the 100ms polling backstop if a safer workaround exists.
Plugins
None confirmed at crash time (default/global install).
OpenCode version
1.16.2
Steps to reproduce
- Windows 11 x64, OpenCode 1.16.2 installed globally (
opencode-ai npm package).
- Launch TUI with a resumed session:
opencode -s <session-id> (also reproduced with opencode -c).
- Use the TUI normally with agent activity (shell spawns, MCP tools, fetch) for 1–2 hours.
- Process segfaults; Bun crash dialog appears.
Relevant code: packages/opencode/src/cli/cmd/tui/win32.ts — win32InstallCtrlCGuard() → setInterval(enforce, 100) calling FFI symbols.
Screenshot and/or share link
https://bun.report/1.3.14/ea10d9b296m7Bz+339/DC8B.bebf9eff3affffbf-00000000.dllup1xB_is33sB___A2qaxv/jqH
Operating System
Windows 11 (build 26200)
Terminal
Windows Terminal
Description
OpenCode TUI crashes on Windows after a long-running session (~116 minutes). The process segfaults inside the embedded Bun runtime (v1.3.14) during an FFI call.
Stack trace points to
Zig::JSFFIFunction::trampoline(JSFFIFunction.cpp:166). The onlybun:ffiusage in OpenCode is the Windows console Ctrl+C guard inpackages/opencode/src/cli/cmd/tui/win32.ts(win32InstallCtrlCGuard), which pollsGetConsoleMode/SetConsoleModeonkernel32.dllevery 100ms. That guard is installed fromthread.tsandapp.tsxwhen the TUI starts.Crash report: https://bun.report/1.3.14/ea10d9b296m7Bz+339/DC8B.bebf9eff3affffbf-00000000.dllup1xB_is33sB___A2qaxv/jqH
This may be a Bun runtime defect, but OpenCode is the only code path exercising repeated FFI here. Consider reducing or eliminating the 100ms polling backstop if a safer workaround exists.
Plugins
None confirmed at crash time (default/global install).
OpenCode version
1.16.2
Steps to reproduce
opencode-ainpm package).opencode -s <session-id>(also reproduced withopencode -c).Relevant code:
packages/opencode/src/cli/cmd/tui/win32.ts—win32InstallCtrlCGuard()→setInterval(enforce, 100)calling FFI symbols.Screenshot and/or share link
https://bun.report/1.3.14/ea10d9b296m7Bz+339/DC8B.bebf9eff3affffbf-00000000.dllup1xB_is33sB___A2qaxv/jqH
Operating System
Windows 11 (build 26200)
Terminal
Windows Terminal