Skip to content

Claude agent host: keep WebSearch available on the native transport - #337887

Open
Roman Rokon (romanrokon) wants to merge 2 commits into
microsoft:mainfrom
romanrokon:claude-native-websearch
Open

Roman Rokon (romanrokon) wants to merge 2 commits into
microsoft:mainfrom
romanrokon:claude-native-websearch

Conversation

@romanrokon

Copy link
Copy Markdown

Fixes #337886

What

buildOptions passed disallowedTools: ['WebSearch'] for every Claude session. The reason, per roadmap.md, is that CAPI doesn't support WebSearch, which only applies when the SDK is routed through the Copilot proxy. Native (Anthropic-auth) sessions talk to Anthropic directly, where WebSearch works, so they were losing web search for no reason.

The block now applies only when transport.kind === 'proxy', using the isProxy flag buildOptions already computes for the other transport-specific options. The two roadmap lines describing the setting are updated to match.

How to test

  • Unit tests added in claudeSdkOptions.test.ts: the proxy transport still sets disallowedTools: ['WebSearch']; the native transport leaves it unset.
  • Manually: in a Claude session authenticated with CLAUDE_CODE_OAUTH_TOKEN or ANTHROPIC_API_KEY, ask for a web search. Before the change the model has no WebSearch tool; after it, the search runs and returns results. Copilot-routed sessions are unchanged.

I tested the native behaviour by applying the same change to the built 1.139.0 agentHostMain.js; I haven't run the unit tests locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_015wqjvswfjKqx3aDMsuMiBG

The WebSearch block exists because CAPI does not support the tool, which
only applies when the SDK is routed through the Copilot proxy. Native
(Anthropic-auth) sessions talk to Anthropic directly, where WebSearch
works, so only disallow it for the proxy transport.

Fixes microsoft#337886
Copilot AI balanced review requested due to automatic review settings September 25, 2026 04:25
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

TylerLeonhardt

Matched files:

  • src/vs/platform/agentHost/node/claude/claudeSdkOptions.ts
  • src/vs/platform/agentHost/node/claude/roadmap.md

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The behavior matches the transport capabilities and has focused regression coverage; the remaining comment-style issue is non-blocking.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Scopes Claude WebSearch blocking to Copilot-proxy sessions while preserving it for native Anthropic sessions.

Changes:

  • Applies disallowedTools only to proxy transport.
  • Adds proxy/native regression tests.
  • Updates roadmap documentation.
File Description
claudeSdkOptions.ts Makes WebSearch blocking transport-specific.
claudeSdkOptions.test.ts Tests proxy and native behavior.
roadmap.md Documents the transport distinction.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +183 to +184
// CAPI (the Copilot proxy) doesn't support the WebSearch tool, so it is
// disabled there. Native sessions talk to Anthropic directly, where it works.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Condensed to one line in 82f1ebc.

@romanrokon

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@romanrokon

Copy link
Copy Markdown
Author

TylerLeonhardt since you wrote the native transport (#323037): the WebSearch block's documented reason in roadmap.md is that CAPI doesn't support the tool, so this limits disallowedTools: ['WebSearch'] to the proxy transport and leaves native sessions able to search. Happy to adjust if there's another reason to keep it on for native.

@romanrokon

Copy link
Copy Markdown
Author

TylerLeonhardt friendly ping. This is a one-line change in claudeSdkOptions.ts that keeps WebSearch available on the native (BYO-Anthropic) transport. It fixes #337886. Copilot's review comment is addressed, and the branch still matches main in that spot.

I also checked it at runtime: with SDK 0.3.281 on native subscription auth and WebSearch not disallowed, the tool returns results and the turn ends with success. The proxy transport keeps disallowedTools: ['WebSearch'], and a unit test covers each transport. Happy to adjust if you'd prefer a different approach.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Claude agent host: native (Anthropic-auth) sessions have WebSearch disabled by the CAPI-only disallowedTools block

4 participants