fix(acp): include diff content block in edit permission requests#31783
Closed
ReeSilva wants to merge 6 commits into
Closed
fix(acp): include diff content block in edit permission requests#31783ReeSilva wants to merge 6 commits into
ReeSilva wants to merge 6 commits into
Conversation
Author
|
Added a commit to fix issue with formatting of the message when overwriting a file and having |
Author
|
@jlongster Please, can you take a look when you have some time? Tks :D |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Fixes #31781
Type of change
What does this PR do?
When OpenCode calls

requestPermissionforeditoperations, thetoolCallpayload was missing thecontent: [{ type: "diff" }]block. ACP clients use this block to show a diff view alongside the approval prompt. Without it, clients receive the permission request but have no diff to display.Root cause
permission.tsbuilds thetoolCallforrequestPermissionmanually, but never populates thecontentfield. On top of that, themetadataforwarded byedit.tsandwrite.tsviactx.askonly carriedfilepathanddiff(a unified patch string) — not theoldString/newStringvalues needed to build an ACP diff content block.Changes
tool/edit.tsoldStringandnewStringtoctx.askmetadata (both call sites)tool/write.tsacp/permission.tseditDiffContent()helper and wired its output intotoolCall.contentThe
editDiffContenthelper returns[{ type: "diff", path, oldText, newText }]foreditpermissions, andundefinedotherwise — consistent with the shape already used bycompletedToolContentinacp/tool.ts.How did you verify your code works?
Tested via CodeCompanion's ACP integration against
opencode acp. Withpermissions.edit: "ask"set, edit operations now trigger the client's diff view before approval, matching the behaviour ofclaude-agent-acp.Checklist