agentHost: revert reserved integration id change; tag Codex proxy with vscode_codex UA#322600
Merged
Conversation
The 'code-oss' integration id is reserved and rejected by @vscode/copilot-api's CAPIClient constructor. Stop passing it in and drop the now-unnecessary getIntegrationId() test overrides; the Copilot-Integration-Id header still defaults via the library and the per-request suppressIntegrationId opt-in is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Mirror the Claude proxy and oaiLanguageModelServer.ts by transforming the inbound codex user-agent (replacing the client-name portion with the vscode_codex prefix) and forwarding it to CAPI on /v1/responses requests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adjusts the agent host’s Copilot/CAPI plumbing by removing the explicit (reserved) integration-id passed into @vscode/copilot-api’s CAPIClient, while keeping the per-request suppressIntegrationId escape hatch and tagging Codex proxy traffic with a vscode_codex user-agent for server-side identification.
Changes:
- Stop passing the reserved
code-ossintegration id intoCAPIClientconstruction; rely on the library’s derived default behavior instead. - Re-introduce / preserve per-request
suppressIntegrationIdthreading through the agent host’s Copilot API wrapper and call sites (Claude/Codex agents + proxies). - Add Codex proxy user-agent transformation/forwarding plus focused unit tests.
Show a summary per file
| File | Description |
|---|---|
| src/vs/platform/agentHost/node/shared/copilotApiService.ts | Reintroduces suppressIntegrationId request option and threads it through CAPI requests (models/messages/responses). |
| src/typings/copilot-api.d.ts | Extends ambient @vscode/copilot-api typings to include suppressIntegrationId on fetch options. |
| src/vs/platform/agentHost/node/codex/codexProxyService.ts | Builds/forwards a transformed User-Agent (vscode_codex/...) to CAPI for /v1/responses proxying. |
| src/vs/platform/agentHost/test/node/codex/codexProxyService.test.ts | Adds unit tests asserting Codex proxy user-agent transformation/forwarding behavior. |
| src/vs/platform/agentHost/node/codex/codexAgent.ts | Opts Codex model refresh into suppressIntegrationId. |
| src/vs/platform/agentHost/node/claude/claudeProxyService.ts | Opts Claude proxy model/messages calls into suppressIntegrationId. |
| src/vs/platform/agentHost/node/claude/claudeAgent.ts | Opts Claude agent model refresh into suppressIntegrationId. |
| src/vs/platform/agentHost/test/node/shared/copilotApiService.test.ts | Updates tests to validate suppressIntegrationId behavior for integration-id header emission. |
| src/vs/platform/agentHost/test/node/shared/copilotApiService.integrationTest.ts | Updates integration test harness construction pattern for CopilotApiService. |
Copilot's findings
- Files reviewed: 8/9 changed files
- Comments generated: 2
…agent The Codex agent's _refreshModels() call to ICopilotApiService.models() did not set a User-Agent, unlike the Claude agent (which sends vscode_claude_code/<version>). Add a matching vscode_codex/<version> header so the model-list fetch is identifiable server-side, consistent with the Codex proxy's responses requests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address PR review: the anonymous CopilotApiService subclasses no longer override anything after the getIntegrationId() removal, so replace them with direct construction for readability and cleaner stack traces. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dmitrivMS
approved these changes
Jun 23, 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.
Summary
Reverts #321964 ("agentHost: stop sending an explicit Copilot integration id to CAPI"), then re-applies the part we want to keep and adds a
vscode_codexuser-agent to the Codex proxy.Commits
suppressIntegrationIdmechanism onCopilotApiService(Claude/Codex/Copilot agent-host surfaces).agentHost: do not pass an integration id into CAPIClient— stops passing the reservedcode-ossintegration id into@vscode/copilot-api'sCAPIClientconstructor (it throws on the reserved id). TheCopilot-Integration-Idheader still defaults via the library, and the per-requestsuppressIntegrationIdopt-in is unchanged. Drops the now-unnecessarygetIntegrationId()test overrides.agentHost: tag Codex proxy requests with a vscode_codex user-agent— mirrors the Claude proxy andoaiLanguageModelServer.ts: transforms the inbound codexuser-agent(replacing the client-name portion with thevscode_codexprefix) and forwards it to CAPI on/v1/responsesrequests. Adds focused tests.Validation
npm run typecheck-client: cleanCodexProxyServiceuser-agent tests