fix(acp): include shell command and file path in permission prompts#28921
Open
bcdady wants to merge 6 commits into
Open
fix(acp): include shell command and file path in permission prompts#28921bcdady wants to merge 6 commits into
bcdady wants to merge 6 commits into
Conversation
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.
Human note
Yes, I had AI help with this PR, as a follow-up to the investigation and development of the fix.
I used opencode with Claude Sonnet via Amazon Bedrock, in the Zed IDE (ACP).
Issue for this PR
Closes #4240
Type of change
What does this PR do?
Improve permission request prompt messages in ACP mode. These previously showed only the tool name (
bash,edit,write) with no context about what was actually being requested for approve/reject. This change makes it vastly more useful to interact with OpenCode Agent in an ACP context (such as in Zed IDE agent threads).Two fixes:
tool/shell.ts:ask()was passingmetadata: {}— neither the command string nor the description were included. Now passesmetadata: { command, description }so Zed can display them.acp/agent.ts: AddedtoPermissionTitle()helper that picks the most useful field from permission metadata (description→command→filepath→pattern→url→repository→ tool name). Used for both the permission request title and tool call update titles (pending/in_progress/failed).Also fixed
toLocations()which usedinput["filePath"](camelCase) for edit/write but permission metadata usesinput["filepath"](lowercase), so file locations were never shown in edit prompts.acp/agent.ts: The "Always allow" button label now includes the scope pattern (e.g.Always allow: git *for a git command,Always allow: *for edit/write). Previously there was no indication of what future requests would be auto-approved.How did you verify your code works?
Tested locally in Zed with a custom dev build.
I've manually run mut=ltiple agent thread including responding to numerous bash, edit/write prompts.
Approval prompts for shell commands now show the LLM-provided description / full command. Edit/write prompts show the file path. All 13 ACP unit tests pass.
Screenshots / recordings
Before

After:

Checklist