Skip to content

Conversation

zhichli
Copy link
Member

@zhichli zhichli commented Oct 3, 2025

No description provided.

@Copilot Copilot AI review requested due to automatic review settings October 3, 2025 19:32
@zhichli zhichli self-assigned this Oct 3, 2025
Copy link
Contributor

@Copilot 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

This PR adds support for custom HTTP headers in BYOK (Bring Your Own Key) configurations for both Azure and custom OpenAI models. Users can now specify additional request headers that will be sent with API requests to their custom model endpoints.

  • Extends the model configuration interfaces to include optional requestHeaders field
  • Implements header sanitization logic to prevent overriding reserved system headers
  • Updates the OpenAI endpoint to merge custom headers with default request headers

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/platform/endpoint/common/endpointProvider.ts Adds requestHeaders field to IChatModelInformation interface
src/platform/configuration/common/configurationService.ts Updates CustomOAIModels type definition to include requestHeaders
src/extension/byok/vscode-node/customOAIProvider.ts Integrates requestHeaders throughout the custom OAI provider implementation
src/extension/byok/vscode-node/customOAIModelConfigurator.ts Adds requestHeaders to the ModelConfig interface
src/extension/byok/node/openAIEndpoint.ts Implements header sanitization and merging logic for custom headers
src/extension/byok/common/byokProvider.ts Updates BYOK interfaces and resolveModelInfo to handle custom headers
package.json Adds schema definitions for the new requestHeaders configuration options

Copy link
Contributor

@Copilot 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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

@zhichli zhichli requested a review from Copilot October 6, 2025 23:47
Copy link
Contributor

@Copilot 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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

}

private _sanitizeHeaderValue(value: string, key: string): string | undefined {
private _sanitizeHeaderValue(value: unknown): string | undefined {
Copy link
Member

Choose a reason for hiding this comment

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

Are we not sanitzing twice here? Both above and with this function

Copy link
Member Author

Choose a reason for hiding this comment

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

So _sanitizeHeaderValue() is a helper function called by _sanitizeCustomHeaders() during initialization, not a separate sanitization step. The headers are sanitized once during object construction and then reused safely throughout the object's lifetime.

The separation is: _sanitizeCustomHeaders() handles the overall header collection logic (limits, reserved headers, key validation) while _sanitizeHeaderValue() focuses specifically on value sanitization (control characters, length limits, etc.)."

@zhichli zhichli requested a review from lramos15 October 8, 2025 18:40
lramos15
lramos15 previously approved these changes Oct 8, 2025
@vs-code-engineering vs-code-engineering bot added this to the October 2025 milestone Oct 8, 2025
@zhichli zhichli added this pull request to the merge queue Oct 8, 2025
@zhichli zhichli removed this pull request from the merge queue due to a manual request Oct 8, 2025
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.

2 participants