fix(acp): align permission flow across clients#2690
Conversation
- glob: compute relativePaths relative to projectRoot (config.getTargetDir())
instead of searchDir so that FileDiscoveryService evaluates .gitignore /
.qwenignore rules against the correct paths when path option is used or
when searching across multiple workspace directories
- grep: deduplicate rawMatches by filePath:lineNumber key when searching
multiple workspace directories to prevent duplicate results from
overlapping search roots (e.g. parent dir + child dir in workspace)
- ripGrep: deduplicate output lines by filepath:linenum prefix when
searching multiple workspace paths to handle the same edge case
- tests: add regression tests covering
- glob ignores files matching .gitignore/.qwenignore when path option
points to a subdirectory
- grep deduplication with parent+child overlapping workspace dirs
- ripgrep deduplication when raw output contains duplicate lines
📋 Review SummaryThis PR aligns ACP (Agent Client Protocol) permission handling across the CLI and VS Code extension by consolidating permission decisions into the shared core permission flow. The implementation removes VS Code webview-side auto-approval behavior, fixes shell permission UX for compound commands and always-allow labels, and introduces shared permission helpers to ensure consistent L3→L4→L5 permission evaluation across all clients. 🔍 General Feedback
🎯 Specific Feedback🟡 High
🟢 Medium
🔵 Low
✅ Highlights
|
PermissionManager.isToolEnabled was changed to async in this PR but the call site in Session.runTool was not updated, causing the Promise to be evaluated as a truthy value and the L1 tool-enablement check to always pass — effectively disabling permission denial in the ACP session path.
Verify that when PermissionManager.isToolEnabled resolves to false the tool is never executed and no permission dialog is opened. This guards against the async-await regression fixed in the previous commit.
When building diff content for edit-type permission requests, use confirmation.filePath (full path) when available, falling back to confirmation.fileName. This aligns with the test expectation and ensures SubAgentTracker sends the correct file path in ACP permission dialogs.
TLDR
Align ACP permission handling across CLI and VS Code by moving auto-approval decisions fully into the shared core permission flow, removing VS Code-side auto-allow behavior, and fixing shell permission UX for compound commands and always-allow labels.
Screenshots / Video Demo
N/A — this PR is mainly a permission-flow and prompt-option correctness fix. The user-facing changes are in approval behavior and option labels rather than a new visual feature.
Dive Deeper
This PR consolidates ACP permission behavior around the same L3→L4→L5 flow already used by the core scheduler:
PermissionManageroverrideKey changes:
PermissionManagershell evaluation async so shell defaults resolve from AST analysis instead of leaking unresolveddefaultdecisionsauto-edit/yolo, leaving permission policy to the backend instead of the UI layerBash(git add *)instead of only showing the root binarypmForcedAskbehavior so only explicit ask rules suppress always-allow optionsReviewer Test Plan
auto-editand trigger an ask-required shell command such asgit add file.Bash(git add *)rule is silently persisted just because the frontend chose an allow-always option.git add file && git commit -m "msg"with an existing allow rule forBash(git add *).git commitscope.auto-editandyolodo not open IDE diffs.Testing Matrix
Additional validation:
npm run build -w packages/vscode-ide-companion158passed,0failed)Linked issues / bugs
#2640
#2673
#2700