Skip to content

UI freezes indefinitely when patching large Python files in large projects #16115

@JayZenith

Description

@JayZenith

Description

Opencode hangs on "Preparing patch..." indefinitely when editing large Python files inside large projects (reproduced with server_args.py ~255KB in the sglang repo).

pyright cold-starts and scans the entire project on every session, running at 100+ CPU. During that scan it stops draining its stdin socket. textDocument/didOpen sends the full file -- at 255KB this overflows the ~213KB kernel socket buffer. Both sides stall. No timeout, no recovery.

Confirmed with ss -xp: Recv-Q 219KB, Send-Q 224KB simultaneously. Doesn't reproduce when the file is isolated -- no pyproject.toml means no project scan, pyright drains the socket instantly.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)perfIndicates a performance issue or need for optimization

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions