[BUG]: UI Freezes for a few minutes if repo has binary files #2696

Closed
opened 2026-02-16 17:36:52 -05:00 by yindo · 1 comment
Owner

Originally created by @istarkov on GitHub (Nov 8, 2025).

Description

Started here
https://github.com/sst/opencode/issues/3776#issuecomment-3506638135

If the agent generates binary files (for example, images),

https://github.com/sst/opencode/blob/34ff87d504836ff71b3bb2d466842c00ee3c5ec2/packages/opencode/src/snapshot/index.ts#L143

diffFull returns the binary content encoded as strings in the before and after fields.

A 4 MB image becomes a 20 MB+ string.

Image Image

This causes the UI to freeze for minutes likely due to memory allocation/copy etc issues after new prompt. (depends on amount of binary content)

There’s also a noticeable delay (a few seconds) when switching sessions (especially child sessions).

For AI related work it can be huge non binary files, such as CSVs and others.

What to do?

Fix
https://github.com/sst/opencode/pull/4109

OpenCode version

1.0.45

Steps to reproduce

Generate images or/and binary files

Screenshot and/or share link

https://github.com/sst/opencode/issues/3776#issuecomment-3506638135

Operating System

macOs 26

Terminal

iTerm 2

Originally created by @istarkov on GitHub (Nov 8, 2025). ### Description Started here https://github.com/sst/opencode/issues/3776#issuecomment-3506638135 If the agent generates binary files (for example, images), https://github.com/sst/opencode/blob/34ff87d504836ff71b3bb2d466842c00ee3c5ec2/packages/opencode/src/snapshot/index.ts#L143 diffFull returns the binary content encoded as strings in the before and after fields. A 4 MB image becomes a 20 MB+ string. <img width="455" height="267" alt="Image" src="https://github.com/user-attachments/assets/80c332e1-1c4f-415e-a351-bd52d6fde85d" /> <img width="327" height="225" alt="Image" src="https://github.com/user-attachments/assets/7cc8092a-9324-46a0-8f34-f79cc0b2381c" /> This causes the UI to freeze for minutes likely due to memory allocation/copy etc issues after new prompt. (depends on amount of binary content) There’s also a noticeable delay (a few seconds) when switching sessions (especially child sessions). For AI related work it can be huge non binary files, such as CSVs and others. ⸻ What to do? Fix https://github.com/sst/opencode/pull/4109 ### OpenCode version 1.0.45 ### Steps to reproduce Generate images or/and binary files ### Screenshot and/or share link https://github.com/sst/opencode/issues/3776#issuecomment-3506638135 ### Operating System macOs 26 ### Terminal iTerm 2
yindo added the opentuibug labels 2026-02-16 17:36:52 -05:00
yindo closed this issue 2026-02-16 17:36:52 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 8, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #3995: Single opencode session is consuming 23+GB of memory - Similar excessive memory consumption that could be caused by the same binary file diff storage issue
  • #3798: OpenTUI causes crashes and heavy memory usage - Reports 14GB memory usage leading to crashes and lag, potentially same root cause as binary file handling
  • #4061: Session hangs after file write tool execution with massive latency spike - Similar session hanging/freezing behavior that could be related to diff/snapshot handling

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Nov 8, 2025): This issue might be a duplicate of existing issues. Please check: - #3995: Single opencode session is consuming 23+GB of memory - Similar excessive memory consumption that could be caused by the same binary file diff storage issue - #3798: OpenTUI causes crashes and heavy memory usage - Reports 14GB memory usage leading to crashes and lag, potentially same root cause as binary file handling - #4061: Session hangs after file write tool execution with massive latency spike - Similar session hanging/freezing behavior that could be related to diff/snapshot handling Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2696