opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Fix ACP permission rawInput empty bug

Open opencode-agent[bot] opened this issue 6 days ago • 0 comments

The fix looks correct. Let me summarize what the fix does:

Summary

Problem: When a permission request is made in ACP, the rawInput field was being set to permission.metadata, which is typically empty ({}) because tools pass empty metadata when asking for permissions. This caused ACP clients to receive permission requests without the actual tool input parameters, making it impossible for users to make informed decisions about granting permissions.

Root Cause: The ctx.ask() calls in tools (like bash, edit, etc.) pass metadata: {}. The permission request was using this empty metadata instead of the actual tool call input.

Fix: When a permission.asked event is received, the fix now fetches the actual message containing the tool call and extracts the tool's input from part.state.input. This ensures that the rawInput in the permission request contains the actual tool parameters (e.g., command and description for bash).

The fix:

  1. Checks if permission.tool exists (contains messageID and callID)
  2. Fetches the message using the SDK
  3. Finds the matching tool part by callID
  4. Uses part.state.input for the rawInput instead of permission.metadata
  5. Falls back to permission.metadata if any step fails

Closes #7370

New%20session%20-%202026-01-08T20%3A15%3A04.016Z opencode session  |  github run

opencode-agent[bot] avatar Jan 08 '26 20:01 opencode-agent[bot]