anomalyco / anomalyco/opencode

Desktop app renders edit tool diffs as full-file rewrites instead of changed hunks

Open
#43,600 0 comments 0 reactions 1 assignee View on GitHub

@Hona is already working on this.

Since Aug 20, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Summary

In the desktop app, every edit tool call is rendered in the conversation as a
full-file before/after diff (+184 -184 for a 184-line file), even when the edit
only touched one line. In the CLI/TUI the same edit shows only the changed hunk.
This makes large files unreadable — a single-line change produces a diff covering the
entire file.

Repro (real case from our project)

  • File: records/views/home.py (184 lines)
  • The agent changed exactly 1 line (line 34) via the edit tool:
@@ -31,7 +31,7 @@
 def wework_verify(request):
     """企业微信域名验证文件"""
-    file_path = Path(__file__).resolve().parent.parent / "verify" / "WW_verify_JjNNFXzblKY8zlPe.txt"
+    file_path = Path(__file__).resolve().parent.parent.parent / "verify" / "WW_verify_JjNNFXzblKY8zlPe.txt"

Verified with git diff HEAD~1 -- records/views/home.py: this is the only hunk.

Desktop app (observed)

The tool result is displayed as a full-file rewrite: +184 -184 (all 184 lines
before/after), forcing the reader to visually hunt for the changed line.

CLI/TUI (expected behavior)

The same edit is displayed as just the changed hunk — only the affected line's
old/new content.

Expected behavior

Desktop app should render edit tool results the same way the TUI does: a hunk-level
diff
showing only the lines that actually changed (the oldString/newString
content), not the entire snapshotted file.

Impact

  • Minor single-line changes are indistinguishable from full rewrites.
  • Reviewing diffs in the desktop app for large files (500+ lines) is impractical;
    users must switch to VSCode/CLI to see what actually changed.
  • It surfaces the wrong "changed-lines" count (+184 -184) in the UI.

Environment

  • opencode version: 1.18.18
  • Platform: Windows (win32), desktop app GUI
  • Same project, same edit, same agent: CLI/TUI renders correctly; desktop does not.

Suggestion

Reuse the same diff computation the TUI uses for edit tool results (based on the
tool's oldString/newString), or clamp the desktop diff view to changed hunks rather
than snapshot-to-snapshot file diffing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.