fix(core): pass config to supportsModernFeatures to respect model definition flags

This commit is contained in:
Akhilesh Kumar
2026-04-16 20:36:07 +00:00
parent 1d5077cf0d
commit 0a119e6ff7
4 changed files with 24 additions and 8 deletions
@@ -53,7 +53,7 @@ export const CodebaseInvestigatorAgent = (
): LocalAgentDefinition<typeof CodebaseInvestigationReportSchema> => {
// Use Preview Flash model if the main model supports modern features.
// If the main model is not a modern model, use the default pro model.
const model = supportsModernFeatures(config.getModel())
const model = supportsModernFeatures(config.getModel(), config)
? PREVIEW_GEMINI_FLASH_MODEL
: DEFAULT_GEMINI_MODEL;
@@ -97,7 +97,7 @@ export const CodebaseInvestigatorAgent = (
generateContentConfig: {
temperature: 0.1,
topP: 0.95,
thinkingConfig: supportsModernFeatures(model)
thinkingConfig: supportsModernFeatures(model, config)
? {
includeThoughts: true,
thinkingLevel: ThinkingLevel.HIGH,
+12 -2
View File
@@ -397,11 +397,21 @@ export function isCustomModel(
* This includes Gemini 3 models and any custom models.
*
* @param model The model name to check.
* @param config Optional config object for dynamic model configuration.
* @returns True if the model supports modern features like thoughts.
*/
export function supportsModernFeatures(model: string): boolean {
export function supportsModernFeatures(
model: string,
config?: ModelCapabilityContext,
): boolean {
if (config?.getExperimentalDynamicModelConfiguration?.() === true) {
const definition = config.modelConfigService.getModelDefinition(model);
if (definition?.features?.thinking !== undefined) {
return definition.features.thinking;
}
}
if (isGemini3Model(model)) return true;
return isCustomModel(model);
return isCustomModel(model, config);
}
/**
+8 -2
View File
@@ -569,7 +569,10 @@ export class GeminiChat {
abortSignal,
};
let contentsToUse: Content[] = supportsModernFeatures(modelToUse)
let contentsToUse: Content[] = supportsModernFeatures(
modelToUse,
this.context.config,
)
? [...contentsForPreviewModel]
: [...requestContents];
@@ -613,7 +616,10 @@ export class GeminiChat {
);
lastModelToUse = modelToUse;
// Re-evaluate contentsToUse based on the new model's feature support
contentsToUse = supportsModernFeatures(modelToUse)
contentsToUse = supportsModernFeatures(
modelToUse,
this.context.config,
)
? [...contentsForPreviewModel]
: [...requestContents];
}
+2 -2
View File
@@ -69,7 +69,7 @@ export class PromptProvider {
context.config.getHasAccessToPreviewModel?.() ?? true,
context.config,
);
const isModernModel = supportsModernFeatures(desiredModel);
const isModernModel = supportsModernFeatures(desiredModel, context.config);
const activeSnippets = isModernModel ? snippets : legacySnippets;
const contextFilenames = getAllGeminiMdFilenames();
@@ -280,7 +280,7 @@ export class PromptProvider {
context.config.getHasAccessToPreviewModel?.() ?? true,
context.config,
);
const isModernModel = supportsModernFeatures(desiredModel);
const isModernModel = supportsModernFeatures(desiredModel, context.config);
const activeSnippets = isModernModel ? snippets : legacySnippets;
return activeSnippets.getCompressionPrompt(
context.config.getApprovedPlanPath(),