Fix ACP permission rawInput empty bug
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:
- Checks if
permission.toolexists (containsmessageIDandcallID) - Fetches the message using the SDK
- Finds the matching tool part by
callID - Uses
part.state.inputfor therawInputinstead ofpermission.metadata - Falls back to
permission.metadataif any step fails
Closes #7370
opencode session | github run