fix(acp): include permission request context in ACP prompts#42
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the ACP permission-approval UX by ensuring permission prompts carry actionable, security-relevant context (tool, description/details, targets, and working directory) instead of a generic approval title.
Changes:
- Add
format_permission_titleto synthesize a more informative permission title fromPermissionRequest. - Send an ACP
ToolCallUpdatewith an explicit text content block (tool/description/details/context/target/working dir) viabuild_permission_tool_call_update/format_permission_content. - Add unit tests asserting that risky Bash commands and file targets appear in the title/content serialization.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
63
to
67
| let title = if reason.is_empty() { | ||
| format!("Approve {}", request.tool_name) | ||
| format_permission_title(&request) | ||
| } else { | ||
| reason.clone() | ||
| reason | ||
| }; |
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.
Motivation
Tool 'Bash' requires approvalwhich dropped security-critical context such as the command, target path, or detailed reason, making approval dialogs misleading.PermissionRequest.description,PermissionRequest.details, andPermissionRequest.path(and working dir) so they can make informed decisions for dangerous tools.Description
PermissionRequest(tool name + details/description + path) viaformat_permission_titleand wire it intoAcpPermissionHandler::request_permissionandforward_pending.ToolCallUpdatethat includes an explicit textual content block containingTool,Description,Details,Context,Target, andWorking directoryviabuild_permission_tool_call_update/format_permission_contentso clients receive the actionable context before approval.ToolCallUpdate.Testing
cargo test --package claurst-acp permission_and the new focused tests passed.cargo clippy --package claurst-acp --all-targets --no-deps -- -D warningsand it completed for theclaurst-acpcrate with no warnings.git diff --check(format/lint checks) with no leftover issues for the modified file.cargo check --workspacewas attempted but blocked by a missing system dependency (alsa.pc) required byalsa-sysin this environment; this is unrelated to the ACP change.Codex Task