anomalyco / anomalyco/opencode
apply_patch embeds deleted binary contents in session metadata
@jlongster is already working on this.
Since Aug 11, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 7h 2m
- Merged PRs (30d)
- 384
Description
Description
Deleting a binary or very large file with apply_patch decodes the entire file as UTF-8 and generates a full unified diff. The diff is stored in both the tool result and per-file metadata, so deleting one large archive can add hundreds of megabytes to opencode.db and terminate the Desktop sidecar.
The delete operation only needs the path; binary and oversized file contents should be omitted from metadata.
Plugins
None required.
OpenCode version
1.18.16
Steps to reproduce
- Create a large ZIP file in a project.
- Delete it through an
apply_patch*** Delete Fileoperation. - Inspect the resulting tool part/event in
opencode.db. - Observe that the deleted bytes are decoded into a full diff in both
metadata.diffandmetadata.files[].patch.
With a roughly 295 MB archive, the stored tool part and event were about 619 MB each and the Desktop sidecar exited immediately afterward.
Screenshot and/or share link
Not included because the affected session contains local file metadata. A focused regression test is available with the fix.
Operating System
Windows 11 x64
Terminal
OpenCode Desktop
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.