Repository navigation
Conversation
There was a problem hiding this comment.
The change works. I ran the new permission and shell-tool tests against the base, where they fail with the generic Permission denied: shell. With this PR they pass: in the real shell test, a chain containing a denied subcommand reports ["printf blocked *"], and no part of the chain runs. typecheck:tsc passes too. Denial messages from plugin hooks and from the "nobody is present to approve" case are unchanged, and nothing else reads the narrowed BlockedError.resources.
Public API: unchanged. Only the text of configured-deny error messages changes.
Two small requests to keep the change minimal: revert the formatting-only edits to existing permission.test.ts cases, and drop two tests (see inline comments).
Fixes #44521
There was a problem hiding this comment.
All three earlier points are addressed: the unrelated grants reformatting is reverted, and the BlockedError.message unit test and the session-runner scenario are removed. The source is the same as what I verified before, and the permission and shell-tool tests still pass. Public API: unchanged. Nothing further.
Issue for this PR
Closes #44521
Type of change
What does this PR do?
This PR includes the matching deny patterns in configured permission errors. For example,
echo before && awk 'BEGIN { exit 0 }' && echo afternow reportsPermission denied: shell. Blocked by configured rule patterns: ["awk *"]rather than justPermission denied: shell, which can lead the agent to conclude that shell access is unavailable.It uses the last matching rule for each resource and deduplicates the denying patterns, without repeating command arguments. Custom denial reasons and interactive rejection behavior are unchanged. No feature flag is needed for this error-reporting fix.
Related to #51083, which addressed the same issue before being closed by automated cleanup. This version reports all distinct matching deny patterns rather than only the first.
How did you verify your code works?
bun run checkand formatting checks passed.awk *and catch-all*denies. Both returned the expected pattern without executing the chain.Screenshots / recordings
Not a UI change.
Checklist
Added by the opencode bot (AI-generated).
Fixes #44521