Skip to content

fix(acp): edit/write permission requests don't include diff content block #31781

Description

@ReeSilva

Reopening #11653, which was closed due to inactivity without a fix.

Description

When OpenCode runs in ACP mode (opencode acp), the session/request_permission call for edit tool operations does not include a content: [{ type: "diff" }] block in the toolCall payload.

The ACP SDK's RequestPermissionRequest accepts toolCall.content?: Array<ToolCallContent>, where a { type: "diff", path, oldText, newText } entry signals to the client that a diff view should be shown before the user approves. Without it, ACP clients that check for this block fall back to a plain approval prompt with no diff.

Observed behavior

When using OpenCode via ACP in CodeCompanion, the permission prompt is shown but no diff view is presented. Other ACP agents (e.g. claude-agent-acp) correctly include the diff content block and trigger the diff UI in the client.

Expected behavior

The permission request for edit operations should include the diff content block, allowing ACP clients to present a diff view alongside the approval prompt.

Relevant files

  • packages/opencode/src/acp/permission.ts
  • packages/opencode/src/tool/edit.ts
  • packages/opencode/src/tool/write.ts

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions