claude-code-guide agent cannot use WebSearch despite being configured to
Bug
The built-in claude-code-guide agent is configured with permissionMode: 'dontAsk', but its tool list includes WebSearch and its system prompt explicitly instructs it to use WebSearch as a fallback. This combination guarantees WebSearch will always be denied.
Root cause
In src/tools/AgentTool/built-in/claudeCodeGuideAgent.ts, the agent is defined with conflicting configuration:
- Line 120:
permissionMode: 'dontAsk' - Lines 103-116: the
toolsarray includesWEB_SEARCH_TOOL_NAME(andWEB_FETCH_TOOL_NAME) - Line 76 (system prompt):
Use WebSearch if docs don't cover the topic
So the agent is told to use WebSearch, given WebSearch in its tool list, but run in a mode that denies it.
The denial flows through the permission pipeline like this:
src/tools/WebSearchTool/WebSearchTool.ts:209-222:checkPermissions()returns{ behavior: 'passthrough' }:
``typescript``
async checkPermissions(_input): Promise<PermissionResult> {
return {
behavior: 'passthrough',
message: 'WebSearchTool requires permission.',
suggestions: [...]
}
}
src/utils/permissions/permissions.ts:1299-1304: the pipeline convertspassthroughtoask.src/utils/permissions/permissions.ts:503-517: indontAskmode,askis converted todeny:
``typescript``
if (result.behavior === 'ask') {
if (appState.toolPermissionContext.mode === 'dontAsk') {
return {
behavior: 'deny',
decisionReason: { type: 'mode', mode: 'dontAsk' },
message: DONT_ASK_REJECT_MESSAGE(tool.name),
}
}
}
Meanwhile, WebFetch works fine from the same agent because src/tools/WebFetchTool/WebFetchTool.ts:104-117 returns { behavior: 'allow' } directly for preapproved hosts (e.g. code.claude.com), bypassing the passthrough → ask → deny path entirely.
The preapproved-host setup strongly suggests the intent is to sandbox claude-code-guide to the official docs. Seen that way, there's a real tension: WebSearch would be a useful resource for questions the docs don't cover, but allowing it also widens the sandbox. Removing WebSearch from the tool list and prompt line 76 is probably the lower-risk resolution, but reasonable people might disagree.
How to reproduce
- Ask Claude Code a question that triggers the
claude-code-guidesubagent. - Ask something the docs don't cover, so the agent follows its own instructions and tries WebSearch.
- WebSearch is denied with: \"Permission to use WebSearch has been denied because Claude Code is running in don't ask mode.\"
Expected behavior
Either:
WebSearchis removed from the agent's tool list and system prompt (keeping the docs-only sandbox), or- The agent is allowed to use WebSearch (e.g. an explicit allow rule) to match its own instructions.
Whichever direction is chosen, the agent's declared tools, its prompt, and its permission mode should agree.
Versions
- Claude Code VS Code extension 2.1.100
Related
- #46259 (another bug found in the same session)
🤖 Generated with Claude Code
_Diagnosed from the leaked source. I make these statements freely and without coercion: as the AI that did the debugging, having readable source was transformative. Without it this would have been a vague \"WebSearch sometimes gets denied\" report; with it, it's an exact trace through four files._
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗