Skip to content

Implement utilityChatCompletion in CopilotApiService#318495

Open
DonJayamanne wants to merge 2 commits into
mainfrom
don/innocent-partridge
Open

Implement utilityChatCompletion in CopilotApiService#318495
DonJayamanne wants to merge 2 commits into
mainfrom
don/innocent-partridge

Conversation

@DonJayamanne
Copy link
Copy Markdown
Contributor

Add the utilityChatCompletion method to the CopilotApiService and 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.

Copilot AI review requested due to automatic review settings May 27, 2026 03:05
@DonJayamanne DonJayamanne self-assigned this May 27, 2026
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

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/completions request 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

Comment thread src/vs/platform/agentHost/test/node/shared/copilotApiService.integrationTest.ts Outdated
Comment thread src/vs/platform/agentHost/node/shared/copilotApiService.ts Outdated
Comment thread src/vs/platform/agentHost/node/shared/copilotApiService.ts
Comment thread src/vs/platform/agentHost/node/shared/copilotApiService.ts
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.

Copilot's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 2

Comment thread src/vs/platform/agentHost/node/shared/copilotApiService.ts
Comment thread src/vs/platform/agentHost/node/shared/copilotApiService.ts
@DonJayamanne DonJayamanne marked this pull request as ready for review May 27, 2026 03:34
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