Implement utilityChatCompletion in CopilotApiService#318495
Open
DonJayamanne wants to merge 2 commits into
Open
Implement utilityChatCompletion in CopilotApiService#318495DonJayamanne wants to merge 2 commits into
DonJayamanne wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new utility-style chat completion entry point to the agent host’s CopilotApiService, intended to mirror Copilot Chat’s “utility small” flows by minting a Copilot session token and calling CAPI /chat/completions. Also updates existing Claude agent/proxy tests to satisfy the expanded ICopilotApiService interface and introduces a live-CAPI integration test.
Changes:
- Added
ICopilotApiService.utilityChatCompletion(...)plus supporting request/message types and a per-GitHub-token Copilot session token cache. - Implemented model-family resolution (
gpt-4o-mini) for utility requests and wired the CAPI/chat/completionsrequest path. - Added live-network integration tests for
utilityChatCompletion, and updated existing Claude tests with the new interface method stub.
Show a summary per file
| File | Description |
|---|---|
| src/vs/platform/agentHost/node/shared/copilotApiService.ts | Adds the utilityChatCompletion API, Copilot session token minting/caching, and utility model resolution. |
| src/vs/platform/agentHost/test/node/shared/copilotApiService.integrationTest.ts | New live CAPI integration tests for utilityChatCompletion and token caching behavior. |
| src/vs/platform/agentHost/test/node/claudeProxyService.test.ts | Updates the fake Copilot API service and wrapped stubs to include utilityChatCompletion. |
| src/vs/platform/agentHost/test/node/claudeAgent.test.ts | Updates test fake Copilot API service to include utilityChatCompletion. |
| src/vs/platform/agentHost/test/node/claudeAgent.integrationTest.ts | Updates stub Copilot API service to include utilityChatCompletion. |
Copilot's findings
- Files reviewed: 5/5 changed files
- Comments generated: 5
roblourens
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the
utilityChatCompletionmethod to theCopilotApiServiceand include integration tests that validate its functionality with live GitHub Copilot CAPI. The tests ensure correct responses to various prompts and check caching behavior for session tokens.