Skip to content

fix: enable tool_search for BYOK custom Responses endpoints#319105

Open
PenguinDOOM wants to merge 7 commits into
microsoft:mainfrom
PenguinDOOM:atlas/vscode-byok-custom-endpoint-tool-search
Open

fix: enable tool_search for BYOK custom Responses endpoints#319105
PenguinDOOM wants to merge 7 commits into
microsoft:mainfrom
PenguinDOOM:atlas/vscode-byok-custom-endpoint-tool-search

Conversation

@PenguinDOOM
Copy link
Copy Markdown
Contributor

Fixes #313098

Summary

Enable tool_search for BYOK custom OpenAI-compatible endpoints on the Responses API path.

This change fixes cases where tool_search was advertised in prompts but was not included in the actual Responses request for BYOK custom endpoints.

What changed

  • update Responses API tool gating so BYOK custom endpoints can send client-executed tool_search
  • allow the actual BYOK request locations used by the custom endpoint flow
  • keep existing guards for unsupported models, first-party endpoints, and subagents
  • add focused regression coverage for BYOK Responses endpoint behavior

Testing

  • npm exec vitest run src/platform/endpoint/node/test/responsesApiToolSearch.spec.ts --pool=forks

Notes

This PR is intentionally scoped to the BYOK custom endpoint request path.
It does not address the broader prompt/request condition sync for tool_search.

PenguinDOOM and others added 6 commits May 30, 2026 07:45
- add intentional RED contracts for extension-contributed tool-search exposure
- add GREEN BYOK metadata and custom-endpoint runtime invariants
- add supportsToolSearch parity to ExtensionContributedChatEndpoint
- keep supported and unsupported non-copilot tool visibility covered by focused tests
- add a prompt/request bridge regression for endpoint tool-search capability
- revalidate downstream Responses and Messages tool-search behavior without request-body changes

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings May 30, 2026 07:03
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

Note

Copilot was unable to run its full agentic suite in this review.

Adds first-class tool-search capability support for extension-contributed and BYOK endpoints, and expands Responses request construction to enable client-side tool_search under BYOK scenarios where the tool may be filtered from the request tool list.

Changes:

  • Expose supportsToolSearch on ExtensionContributedChatEndpoint based on model capability matching.
  • Update Responses request body logic to implicitly enable client tool_search for BYOK (auth-owned) endpoints in more locations.
  • Extend and add tests covering tool search enablement/forwarding and tool filtering behavior across endpoints and locations.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
extensions/copilot/src/platform/endpoint/vscode-node/extChatEndpoint.ts Adds supportsToolSearch getter for extension-contributed endpoints.
extensions/copilot/src/platform/endpoint/node/responsesApi.ts Adjusts tool-search enablement rules for BYOK Responses endpoints and locations.
extensions/copilot/src/platform/endpoint/node/test/responsesApiToolSearch.spec.ts Adds coverage for BYOK implicit client tool_search behavior when request tools omit it.
extensions/copilot/src/extension/tools/node/test/testToolsService.ts Includes model-specific tools in enabled-tools computation for tests.
extensions/copilot/src/extension/test/vscode-node/endpoints.test.ts Tests supportsToolSearch exposure for vendor-overridden extension-contributed endpoints.
extensions/copilot/src/extension/prompt/node/test/defaultIntentRequestHandler.spec.ts Tests forwarding of tool-search support into request model capabilities.
extensions/copilot/src/extension/intents/node/test/backgroundTodoEnablement.spec.ts Tests tool_search enabled-tools presence for supported extension-contributed endpoints.
extensions/copilot/src/extension/byok/vscode-node/test/customEndpointProvider.spec.ts Tests BYOK endpoint supportsToolSearch inheritance from supported metadata.
extensions/copilot/src/extension/byok/common/test/byokProvider.spec.ts Tests preserving model ids/family for tool-search capability matching.

Comment thread extensions/copilot/src/platform/endpoint/node/responsesApi.ts Outdated
@PenguinDOOM PenguinDOOM requested a review from Copilot May 30, 2026 07:09
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

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment on lines +116 to +118
get supportsToolSearch(): boolean {
return modelSupportsToolSearch(this.languageModel);
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This call is intentional. modelSupportsToolSearch accepts LanguageModelChat | IChatEndpoint | string in chatModelCapabilities.ts, and internally normalizes object inputs via getModelId(model) plus model.family. So passing this.languageModel here is supported and does not evaluate incorrectly.

@PenguinDOOM
Copy link
Copy Markdown
Contributor Author

I have confirmed that tool_search is called and the found tools are used in local builds.
I found an issue where the prompts in tool_search and the branching conditions in the actual tool did not match, but I haven't fixed it yet because it would be too broad to include in this pull request.

@PenguinDOOM
Copy link
Copy Markdown
Contributor Author

chatmock-log-4.txt
Customized ChatMock logs
ChatMock is connected via the BYOK custom endpoint, responses.
You can see that tool_search is included in the tool.

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.

Make CustomOAIProvider compatible with tool search

3 participants