Repository navigation
fix(claude): Open diff shows Claude edits as a diff instead of raw JSON - #26529
Conversation
Since pingdotgg#26304, Open diff opens the patch that a tool call recorded. The Claude adapter stored Claude's raw Edit and Write result there, so the panel showed JSON. The adapter now formats Claude's structuredPatch hunks as a unified patch.
commented
Oct 28, 2026
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Claude file-edit results are now formatted as unified diffs rather than raw JSON, with existing fallback behavior for unsupported results. The change affects displayed edit output, not file-edit execution or product defaults. You can add or adjust custom eligibility rules. Learn more. |
commented
Oct 28, 2026
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Add structured result formatting apps/server/package.json, apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts |
The server adds the diff dependency. The adapter formats structured edit hunks and file creations as unified diffs, and retains fallback formatting for unrecognized results. |
Use formatter for file-change output apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts, apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts |
File-change output uses the new formatter. Tests check edit diffs, nonempty creation diffs, and the absence of a diff for empty-file creation. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: juliusmarminge
Merge Risk: 
Minimal · up to 829bb
-
The change is mergeable after normal checks; no actionable risk is established in the supplied evidence.
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title "fix(claude): Open diff shows Claude edits as a diff instead of raw JSON" describes the main change. The changeset makes ClaudeAdapterV2 format structuredPatch hunks from Claude Edit and Write results into unified diff text, so Open diff shows a diff instead of raw JSON. The title is specific, uses a conventional commit prefix, and matches the objectives.
Full details: Description check
-
Explanation
The description follows the template. It has Why (Problem), What changed (Change), Scope with a justification for the small-fix exemption and a reference to the regression source, Tradeoffs, Blast Radius, and Verification. Verification gives specific results: a failing-first test, 247 passing tests, and 1,737 real-data edits with rendering counts. It also states what was not checked (live client, screenshots pending). The description does not link a triaged issue or maintainer approval, but it argues that the change qualifies for the small-fix exemption. The description also says screenshots will be added later, which the template requires for UI changes. The template does not clearly require the screenshot for this change, so the gap is minor.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Why
Since #26304, Open diff in the tool-call inspector opens the patch that the tool call recorded. The Claude adapter never recorded a patch. It stored Claude's raw Edit or Write result, which is JSON with the hunks and the whole original file. So Open diff on a Claude edit shows "Unsupported diff format. Showing raw patch." and that JSON. The bug first shipped in nightly
0.1.4-nightly.20261028.3822. Stable v0.1.3 is not affected.This qualifies as a small, focused fix for an obvious bug. It is a regression with an exact cause, and the fix makes no behavior or product decision.
What changed
ClaudeAdapterV2turns thestructuredPatchhunks in Claude's Edit and Write results into a unified patch with jsdiff, asprovider-acpalready does. A Write that creates a file gets a patch from/dev/null.apps/serveraddsdiff8.0.3, the versionprovider-acpuses.Scope
structuredPatch, such as Claude subagent edits and NotebookEdit.Tradeoffs
Restoring the checkpoint-diff fallback in the web client would also hide the JSON. The adapter fix gives every client the exact change from the tool call, and it stops storing the whole original file with each edit.
Blast Radius
The change touches only the
diffStrthat the Claude adapter stores for new Edit and Write items. Other providers, other Claude tools, and items already stored are unchanged.Verification
stores the diff panel patch for $caseinClaudeAdapterV2.test.tshas three rows: an Edit, a Write that creates a file, and a Write that creates an empty file. With the adapter change reverted, all three fail and receive Claude's JSON. With the fix, all three pass, and the full file passes (247 tests).toolCallDiffandgetRenderablePatch. On main, none render as a diff. With the fix, 1,564 do. The other 173 have nostructuredPatchand keep their old text. StoreddiffStrfor these edits drops from 22.3 MB to 10.0 MB.vp run check:changed upstream/mainpasses. I did not check a live client. Before and after screenshots will be added to this PR.Written by Claude Opus 5.5 in OpenCode.