Repository navigation
Grant the base tool for scoped agent tools, and warn about a rejection once - #420
Merged
ilovepixelart merged 6 commits intoNov 4, 2026
Merged
Conversation
…ejected agent once
…ne the new variable in tests
A scope in an agent's tools: does not limit the agent in Claude Code 2.1.318: the agent has the base tool and each call goes through the permission flow. Rejecting these agents, and the variable that opted out of the rejection, have no counterpart there. - Load scoped entries with the base tool, including Bash() and Agent() - Remove PI_CODE_SUBAGENT_SCOPED_TOOLS and the empty-scope rejection - Treat an entry whose scope does not close as unrecognized: dropped beside a valid entry, launch refused and named when nothing else resolves - Keep rejecting a tools: field that does not parse
ilovepixelart
approved these changes
Nov 4, 2026
A Read inside the working directory ran with no prompt on Claude Code 2.1.318, so "prompts for each call" overstated it.
…-grants # Conflicts: # docs/subagents.md # tests/agents.test.ts
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.
An agent whose
tools:carries an argument scope such asBash(pnpm tsx tools/ff/fetch-flags.ts --name:*)is rejected at discovery today. Claude Code loads the same file. This aligns the grant with Claude Code and prints each discovery warning once per process.Scoped entries in
tools:Measured on Claude Code 2.1.318 in default permission mode. The subagent docs cover the
Agent(...)case, where the type list "is ignored" in a subagent definition, and do not cover the others.tools:Bash(touch a.txt),Bash(*)bashBash()bashRead(src/**)readWebFetch(domain:example.com)web_fetchAgent(worker),Task(worker),Agent()subagentRead(),Grep(),WebSearch(foo)Read, Bash(fooreadBash(,Bash(foo, Read--tools.tools:field that does not parse is still rejected. A scopeddisallowedToolsentry still denies the whole tool.README.md,SECURITY.mdanddocs/subagents.mddescribe the new behavior.Warnings
Discovery runs on every subagent call and every
/agents, so a rejected file repeated the same warning.warnOnceprints each distinct message once per process. The set lives in asharedSlot, so/reloadand new sessions do not reset it.Behavior change
Agents rejected before now load with the whole tool after upgrading. Nothing else changes for agents that already loaded.
Verification
tsc, knip and vitest with coverage pass on macOS: 3351 passed, 5 skipped.Bash(touch a.txt)agent rantouch b.txt, and aBash(agent failed withno entry in [Bash(] resolves to a tool.