Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/commands/validators/config-assembly.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,28 @@ describe('config-assembly', () => {
);
});

it('should allow custom COPILOT_MODEL values in BYOK mode with a provider base URL', () => {
mockBuildConfigOnce({
copilotProviderApiKey: 'byok-api-key-for-azure-foundry',
copilotProviderBaseUrl: 'https://example-resource.openai.azure.com/openai/deployments/o4-mini-aw',
additionalEnv: { COPILOT_MODEL: 'o4-mini-aw' },
});

const agentOptions = createMinimalAgentOptions();
agentOptions.additionalEnv = { COPILOT_MODEL: 'o4-mini-aw' };

const result = assembleAndValidateConfig(
{},
'echo test',
createMinimalLogAndLimits(),
createMinimalNetworkOptions(),
agentOptions,
);

expect(logger.error).not.toHaveBeenCalled();
expect(result.additionalEnv?.COPILOT_MODEL).toBe('o4-mini-aw');
});
Comment thread
zarenner marked this conversation as resolved.
Resolved

it('should log normalization when COPILOT_MODEL casing is adjusted', () => {
mockBuildConfigOnce({
copilotGithubToken: 'github_pat_testtoken',
Expand Down
11 changes: 10 additions & 1 deletion src/commands/validators/config-assembly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,16 @@ export function assembleAndValidateConfig(
logger.warn.bind(logger),
);

if (copilotModel && (config.copilotGithubToken || config.copilotProviderApiKey)) {
const hasCustomCopilotProviderBaseUrl = !!(
config.copilotProviderBaseUrl ||
config.additionalEnv?.COPILOT_PROVIDER_BASE_URL ||
(config.envAll ? process.env.COPILOT_PROVIDER_BASE_URL : undefined)
);
Comment thread
zarenner marked this conversation as resolved.
Resolved
if (
copilotModel &&
!hasCustomCopilotProviderBaseUrl &&
(config.copilotGithubToken || config.copilotProviderApiKey)
) {
const validation = validateCopilotModel(copilotModel);
if (!validation.valid) {
logger.error(validation.message);
Expand Down
Loading