Repository navigation
agentHost: use Responses API for BYOK models - #328146
Vritant Bhardwaj (vritant24) merged 10 commits into
Conversation
Preserve structured reasoning, tool calls, continuation metadata, and usage across the Agent Host renderer bridge while replacing the Chat Completions proxy contract. Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull request overview
Replaces the Agent Host BYOK Chat Completions proxy with OpenAI Responses, preserving structured outputs and continuation state.
Changes:
- Adds Responses request, response, and SSE translation.
- Bridges reasoning, tools, usage, and continuation metadata.
- Expands unit and SDK integration coverage.
Show a summary per file
| File | Description |
|---|---|
agentHostByokLmHandler.test.ts |
Tests Responses bridge mapping. |
agentHostByokLmHandler.ts |
Translates Responses DTOs to the LM API. |
copilotByokResponses.integrationTest.ts |
Adds SDK multi-turn integration coverage. |
copilotSessionLauncher.test.ts |
Updates provider expectations. |
byokResponsesTranslation.test.ts |
Tests Responses translation and SSE. |
byokOpenAiTranslation.test.ts |
Removes Chat Completions tests. |
byokLmProxyService.test.ts |
Tests Responses proxy routes. |
byokLmBridgeRegistry.test.ts |
Updates result fixtures. |
agentHostClientByokLmChannel.test.ts |
Tests structured DTO round-tripping. |
copilotSessionLauncher.ts |
Selects the Responses wire API. |
byokResponsesTranslation.ts |
Implements Responses translation. |
byokOpenAiTranslation.ts |
Removes Chat Completions translation. |
byokLmProxyService.ts |
Serves JSON and SSE Responses requests. |
agentHostByokLm.ts |
Defines structured bridge DTOs. |
languageModelAccessPrompt.tsx |
Aggregates reasoning parts and metadata. |
languageModelAccess.ts |
Exposes encrypted reasoning parts. |
Review details
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostByokLmHandler.ts:267
- Metadata-only reasoning callbacks become blank summary entries. The Responses processor emits a
thinkingcallback without text for everyresponse.reasoning_summary_part.doneand again for the encrypted item completion;languageModelAccess.tsconverts each missing text to''. Appending those values produces summaries such as['first', '', 'second', '', '']and the proxy emits spurious empty reasoning parts. Filter empty callback values while still merging their metadata.
const summary = Array.isArray(part.value) ? part.value : [part.value];
- Files reviewed: 16/16 changed files
- Comments generated: 3
- Review effort level: Medium
Carry encrypted reasoning through a private data part only for Agent Host BYOK requests, preserving existing vscode.lm behavior for other consumers. Co-authored-by: Copilot <[email protected]>
Replace the Agent Host BYOK model-options sentinel and private MIME payload with a typed provider request option while retaining encrypted thinking metadata only for opted-in requests. Co-authored-by: Copilot <[email protected]>
Keep assistant text complete, group reasoning chunks by ID, and round-trip provider-specific continuation metadata through Responses encrypted content. Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Note
This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (2)
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostByokLmHandler.ts:300
- This branch cannot currently preserve Anthropic
redacted_thinkingas claimed.anthropicProvider.ts:638-642captures the redacted blob, butanthropicProvider.ts:772-774only clears it and never reports aLanguageModelThinkingPartcontainingmetadata.redactedData; a repository-wide search shows no producer of that metadata. ConsequentlyredactedDatacan never reach this encoder or be replayed byanthropicMessageConverter.ts:18-22. Emit the captured blob as reasoning metadata before clearing it and cover the round trip.
...(this._stringMetadata(metadata, 'redactedData') ? { redactedData: this._stringMetadata(metadata, 'redactedData') } : {}),
extensions/copilot/src/extension/conversation/vscode-node/languageModelAccess.ts:849
- Please add direct coverage for this opt-in privacy gate. The existing
CopilotLanguageModelWrappertests exercise emitted response parts, but none feeds an encrypted thinking delta and verifies both required cases: the default options suppress it, whileincludeEncryptedThinking: trueemits it. The new proxy/integration tests fake the bridge result, so they do not execute this branch and would not catch encrypted state leaking to ordinaryvscode.lmconsumers.
if (options.includeEncryptedThinking) {
progress.report(new vscode.LanguageModelThinkingPart(
delta.thinking.text ?? '',
delta.thinking.id,
{ encrypted_content: delta.thinking.encrypted },
));
- Files reviewed: 19/20 changed files
- Comments generated: 0 new
- Review effort level: Medium
Summary
stream: trueSSEvscode.lmconsumers retain their existing behaviorWhy
The Chat Completions translation loses fidelity for thinking-capable models and tool continuations. Responses provides first-class reasoning and output items that match the Copilot SDK agent loop more closely. Some providers also require opaque reasoning state on later turns; this change carries that state only for the Agent Host BYOK path.
Testing
npm run typecheck-clientnpm --prefix extensions/copilot run typecheck./scripts/test-integration.sh --run src/vs/platform/agentHost/test/node/providerIntegration/copilotByokResponses.integrationTest.ts