豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Refactor enableThinking/reasoningEffort into IModelCapabilityOptions#308387

Merged
bhavyaus merged 3 commits intomainfrom
dev/bhavyau/model-capabilities-refactor-v2
Apr 8, 2026
Merged

Refactor enableThinking/reasoningEffort into IModelCapabilityOptions#308387
bhavyaus merged 3 commits intomainfrom
dev/bhavyau/model-capabilities-refactor-v2

Conversation

@bhavyaus
Copy link
Copy Markdown
Collaborator

@bhavyaus bhavyaus commented Apr 7, 2026

Summary

Refactors how tool search, context editing, thinking, and reasoning effort are controlled in chat requests. Instead of checking ChatLocation to decide whether to enable these features, callers now explicitly opt in via modelCapabilities on IMakeChatRequestOptions.

This should prevent issues such as #298471 where the claude agent is opted into TST because messagesAPI enables it but was not adding in the required headers since it wasn't aware it was opting into TST enablement.

Port of microsoft/vscode-copilot-chat#5026.

Key Changes

New IModelCapabilityOptions interface

Groups per-request model capability opt-ins:

  • enableThinking - opt-in flag for thinking
  • reasoningEffort - effort level from model picker
  • enableToolSearch - opt-in for tool search tool
  • enableContextEditing - opt-in for context editing

Centralized model support checks

  • Added modelSupportsToolSearch() and modelSupportsContextEditing() to chatModelCapabilities.ts
  • Added supportsToolSearch/supportsContextEditing properties to IChatEndpoint
  • Extended IChatModelCapabilities.supports with tool_search and context_editing

Request body gating

  • messagesApi.ts reads options.modelCapabilities instead of location-based checks
  • Removed isAllowedConversationAgent and isSubagent computations

Test Rubric

Capability Agent mode Ask agent Subagent (runSubagent) Search subagent Execution subagent Claude agent
enableThinking
reasoningEffort
enableToolSearch ✅ (config + model) ✅ (config + model)
enableContextEditing ✅ (config + model) ✅ (config + model)

Copilot AI review requested due to automatic review settings April 7, 2026 22:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors per-request model capability controls by replacing the flat enableThinking / reasoningEffort fields on IMakeChatRequestOptions with a consolidated modelCapabilities?: IModelCapabilityOptions object, and centralizes model capability checks (tool search/context editing) so endpoints can use server-provided metadata.

Changes:

  • Introduces IModelCapabilityOptions and plumbs modelCapabilities through request creation paths (Messages API + Responses API).
  • Moves tool-search/context-editing model support helpers into chatModelCapabilities.ts and exposes supportsToolSearch / supportsContextEditing on IChatEndpoint.
  • Prevents reasoningEffort from flowing into search/execution subagent loops.
Show a summary per file
File Description
extensions/copilot/src/platform/networking/common/networking.ts Adds IModelCapabilityOptions and replaces request-level thinking fields with modelCapabilities.
extensions/copilot/src/platform/networking/common/anthropic.ts Switches capability checks to use endpoint metadata + shared helpers.
extensions/copilot/src/platform/endpoint/test/node/messagesApi.spec.ts Updates reasoning-effort tests to use modelCapabilities.
extensions/copilot/src/platform/endpoint/node/responsesApi.ts Reads reasoning effort from options.modelCapabilities.
extensions/copilot/src/platform/endpoint/node/messagesApi.ts Gates tool search/context editing/thinking off modelCapabilities instead of flat options.
extensions/copilot/src/platform/endpoint/node/chatEndpoint.ts Populates endpoint capability booleans from server metadata; adjusts Anthropic beta header construction.
extensions/copilot/src/platform/endpoint/common/endpointProvider.ts Extends metadata schema with tool_search / context_editing capability booleans.
extensions/copilot/src/platform/endpoint/common/chatModelCapabilities.ts Becomes the central home for tool-search/context-editing model support checks.
extensions/copilot/src/extension/tools/node/toolSearchTool.ts Imports tool-search supported model prefixes from chatModelCapabilities.
extensions/copilot/src/extension/prompt/node/searchSubagentToolCallingLoop.ts Strips reasoningEffort from subagent requests via modelCapabilities.
extensions/copilot/src/extension/prompt/node/executionSubagentToolCallingLoop.ts Strips reasoningEffort from subagent requests via modelCapabilities.
extensions/copilot/src/extension/prompt/node/defaultIntentRequestHandler.ts Sets per-request capability opt-ins (thinking/tool search/context editing) on outbound requests.
extensions/copilot/src/extension/intents/node/toolCallingLoop.ts Updates loop fetch options shape to pass modelCapabilities.
extensions/copilot/src/extension/externalAgents/node/oaiLanguageModelServer.ts Updates internal proxy requests to use modelCapabilities.enableThinking.
extensions/copilot/src/extension/conversation/vscode-node/languageModelAccess.ts Plumbs reasoning effort into modelCapabilities for extension-language-model requests.
extensions/copilot/src/extension/chatSessions/claude/node/claudeLanguageModelServer.ts Updates internal proxy requests to use modelCapabilities.enableThinking.

Copilot's findings

  • Files reviewed: 16/16 changed files
  • Comments generated: 4

Comment thread extensions/copilot/src/platform/endpoint/node/chatEndpoint.ts
Comment thread extensions/copilot/src/platform/endpoint/node/messagesApi.ts
Comment thread extensions/copilot/src/platform/endpoint/node/messagesApi.ts Outdated
@bhavyaus bhavyaus marked this pull request as ready for review April 7, 2026 23:45
@bhavyaus bhavyaus enabled auto-merge (squash) April 7, 2026 23:46
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Screenshot Changes

Base: 0ee18249 Current: 962c95e1

Added (2)

chat/aiCustomizations/aiCustomizationManagementEditor/WelcomePage/Dark

current

chat/aiCustomizations/aiCustomizationManagementEditor/WelcomePage/Light

current

@bhavyaus bhavyaus merged commit 80cb675 into main Apr 8, 2026
23 checks passed
@bhavyaus bhavyaus deleted the dev/bhavyau/model-capabilities-refactor-v2 branch April 8, 2026 00:08
@vs-code-engineering vs-code-engineering bot added this to the 1.116.0 milestone Apr 8, 2026
bhavyaus added a commit that referenced this pull request Apr 17, 2026
Callers can now opt into Anthropic features (context editing, tool
search, etc.) by setting modelCapabilities on the request itself,
as introduced in #308387. The base endpoint no longer needs to inject
beta headers — the Claude agent controls its own headers.

Reverts the merge logic from microsoft/vscode-copilot-chat#4945.
bhavyaus added a commit that referenced this pull request Apr 17, 2026
…nt (#310908)

Callers can now opt into Anthropic features (context editing, tool
search, etc.) by setting modelCapabilities on the request itself,
as introduced in #308387. The base endpoint no longer needs to inject
beta headers — the Claude agent controls its own headers.

Reverts the merge logic from microsoft/vscode-copilot-chat#4945.
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.

3 participants