Skip to content

chat: preserve conversation ID for BYOK Responses - #332059

Merged
Vritant Bhardwaj (vritant24) merged 1 commit into
mainfrom
agents/vscode-issue-332031-investigation
Aug 21, 2026
Merged

chat: preserve conversation ID for BYOK Responses#332059
Vritant Bhardwaj (vritant24) merged 1 commit into
mainfrom
agents/vscode-issue-332031-investigation

Conversation

@vritant24

Copy link
Copy Markdown
Member

Summary

  • Preserves the active chat conversation ID when BYOK requests cross the extension-contributed language model boundary.
  • Lets Responses custom endpoints include the configured stable prompt_cache_key.
  • Keeps prompt cache behavior unchanged when the setting is disabled or a request has no conversation ID.

Fixes #332031

Technical context for AI-assisted review

Intent and previous behavior

Agent requests provide a conversation ID, and the Responses serializer uses it to generate prompt_cache_key. Extension-contributed models rebuild the request on both sides of the vscode.lm boundary, but that bridge did not preserve the conversation ID. BYOK Responses requests therefore reached serialization without the value.

Implementation

The typed internal model-options contract now carries the conversation ID across the extension-contributed language model boundary. ExtensionContributedChatEndpoint encodes the value before invoking vscode.lm, and CopilotLanguageModelWrapper restores it when invoking the underlying BYOK endpoint.

Behavior and constraints

  • The existing prompt-cache setting remains authoritative.
  • Requests without a conversation ID still omit prompt_cache_key.
  • The value is forwarded explicitly rather than derived from CapturingToken.chatSessionId, whose subagent semantics can differ from the originating conversation ID.
  • Other request metadata omitted by this bridge remains outside this change.

Forward the conversation identifier through extension-contributed model options so Responses endpoints can generate prompt_cache_key.\n\nFixes #332031\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 21, 2026 22:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Preserves conversation IDs across the extension language-model boundary so BYOK Responses endpoints can generate stable prompt cache keys.

Changes:

  • Adds conversation ID to internal model options.
  • Restores it in the BYOK endpoint request.
  • Adds coverage for enabled, disabled, and missing-ID cases.
Show a summary per file
File Description
extChatEndpoint.ts Forwards conversation IDs through model options.
languageModelAccess.ts Restores conversation IDs for endpoint requests.
customEndpointProvider.spec.ts Tests prompt cache key behavior end to end.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@vritant24
Vritant Bhardwaj (vritant24) merged commit c955978 into main Aug 21, 2026
45 of 46 checks passed
@vritant24
Vritant Bhardwaj (vritant24) deleted the agents/vscode-issue-332031-investigation branch August 21, 2026 23:44
@vs-code-engineering vs-code-engineering Bot added this to the 1.135.0 milestone Aug 21, 2026
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.

BYOK Responses custom endpoints drop conversationId, preventing prompt_cache_key from being sent

3 participants