claude-code-guide agent cannot use WebSearch despite being configured to

Resolved 💬 1 comment Opened Apr 10, 2026 by ojura Closed Jun 1, 2026

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 tools array includes WEB_SEARCH_TOOL_NAME (and WEB_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:

  1. 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: [...]
}
}
``

  1. src/utils/permissions/permissions.ts:1299-1304: the pipeline converts passthrough to ask.
  2. src/utils/permissions/permissions.ts:503-517: in dontAsk mode, ask is converted to deny:

``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 passthroughaskdeny 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

  1. Ask Claude Code a question that triggers the claude-code-guide subagent.
  2. Ask something the docs don't cover, so the agent follows its own instructions and tries WebSearch.
  3. WebSearch is denied with: \"Permission to use WebSearch has been denied because Claude Code is running in don't ask mode.\"

Expected behavior

Either:

  • WebSearch is 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._

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗