fix: add model resolution warnings to start warnings

This commit is contained in:
mingholy.lmh 2026-02-25 15:32:08 +08:00
parent 740f4e0949
commit 42a5b4d1e0
8 changed files with 29 additions and 13 deletions

View file

@ -506,7 +506,7 @@ describe('modelConfigUtils', () => {
);
});
it('should log warnings from resolveModelConfig', () => {
it('should return warnings from resolveModelConfig', () => {
const argv = {};
const settings = makeMockSettings();
const selectedAuthType = AuthType.USE_OPENAI;
@ -521,14 +521,13 @@ describe('modelConfigUtils', () => {
warnings: ['Warning 1', 'Warning 2'],
});
resolveCliGenerationConfig({
const result = resolveCliGenerationConfig({
argv,
settings,
selectedAuthType,
});
expect(mockWriteStderrLine).toHaveBeenCalledWith('Warning 1');
expect(mockWriteStderrLine).toHaveBeenCalledWith('Warning 2');
expect(result.warnings).toEqual(['Warning 1', 'Warning 2']);
});
it('should use custom env when provided', () => {

View file

@ -13,7 +13,6 @@ import {
type ProviderModelConfig,
} from '@qwen-code/qwen-code-core';
import type { Settings } from '../config/settings.js';
import { writeStderrLine } from './stdioHelpers.js';
export interface CliGenerationConfigInputs {
argv: {
@ -42,6 +41,8 @@ export interface ResolvedCliGenerationConfig {
generationConfig: Partial<ContentGeneratorConfig>;
/** Source attribution for each resolved field */
sources: ContentGeneratorConfigSources;
/** Warnings generated during resolution */
warnings: string[];
}
export function getAuthTypeFromEnv(): AuthType | undefined {
@ -130,11 +131,6 @@ export function resolveCliGenerationConfig(
const resolved = resolveModelConfig(configSources);
// Log warnings if any
for (const warning of resolved.warnings) {
writeStderrLine(warning);
}
// Resolve OpenAI logging config (CLI-specific, not part of core resolver)
const enableOpenAILogging =
(typeof argv.openaiLogging === 'undefined'
@ -158,5 +154,6 @@ export function resolveCliGenerationConfig(
baseUrl: resolved.config.baseUrl || '',
generationConfig,
sources: resolved.sources,
warnings: resolved.warnings,
};
}