Skip to content

fix(tui): enable threaded rendering to prevent UI freezing#6

Merged
brettheap merged 0 commit intodevfrom
fix-tui-threaded-rendering
Dec 30, 2025
Merged

fix(tui): enable threaded rendering to prevent UI freezing#6
brettheap merged 0 commit intodevfrom
fix-tui-threaded-rendering

Conversation

@brettheap
Copy link

@brettheap brettheap commented Dec 29, 2025

Summary

Enable useThread: true in @OpenTui render config to fix TUI freezing during normal typing.

Problem Statement

Full proposal: https://github.com/opensoft/opencode/blob/fix-tui-threaded-rendering/openspec/changes/fix-tui-threaded-rendering/proposal.md

Root Cause: Bun FFI calls are synchronous and block the JS event loop. The @OpenTui native library was making rendering calls that blocked for ~6.5 seconds every ~5 seconds, causing periodic complete freezes.

Solution

Add useThread: true to the render configuration, which moves native FFI rendering to a separate thread.

Changes

  • packages/opencode/src/cli/cmd/tui/app.tsx - Add useThread: true to render config (1 line)
  • openspec/changes/fix-tui-threaded-rendering/ - Proposal documentation

Test Plan

  • Run opencode TUI and type normally - no freezing
  • Verified with perf diagnostics showing zero [BLOCKED] messages

🤖 Generated with Claude Code

@brettheap brettheap merged this pull request into dev Dec 30, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant