Description
When writing or editing files with a large number of lines, the TUI freezes on "Preparing write..." / "Preparing patch..." for several seconds before the permission prompt appears.
Root cause: createTwoFilesPatch (Myers diff, O(N²) in line count) runs synchronously on the main thread before ctx.ask(), blocking the Node.js event loop when content has many lines.
Also observed on Windows: apply_patch throws EEXIST from fs.mkdir when the target directory already exists (Bun 1.3.x bug with recursive:true).
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Description
When writing or editing files with a large number of lines, the TUI freezes on "Preparing write..." / "Preparing patch..." for several seconds before the permission prompt appears.
Root cause: createTwoFilesPatch (Myers diff, O(N²) in line count) runs synchronously on the main thread before ctx.ask(), blocking the Node.js event loop when content has many lines.
Also observed on Windows: apply_patch throws EEXIST from fs.mkdir when the target directory already exists (Bun 1.3.x bug with recursive:true).
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response