Fix ACP permission rawInput empty bug #7374
Open
+21
−2
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.
The fix looks correct. Let me summarize what the fix does:
Summary
Problem: When a permission request is made in ACP, the
rawInputfield was being set topermission.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.) passmetadata: {}. The permission request was using this empty metadata instead of the actual tool call input.Fix: When a
permission.askedevent is received, the fix now fetches the actual message containing the tool call and extracts the tool'sinputfrompart.state.input. This ensures that therawInputin the permission request contains the actual tool parameters (e.g.,commandanddescriptionfor bash).The fix:
permission.toolexists (containsmessageIDandcallID)callIDpart.state.inputfor therawInputinstead ofpermission.metadatapermission.metadataif any step failsCloses #7370
opencode session | github run