fix: Show experiment values in settings UI for compressionThreshold (#16267)

Co-authored-by: Vedant Mahajan <vedant.04.mahajan@gmail.com>
This commit is contained in:
Ishaan Gupta
2026-01-17 08:48:34 +05:30
committed by GitHub
parent a76946189a
commit 86dbf2013e
4 changed files with 34 additions and 5 deletions
+24
View File
@@ -16,6 +16,8 @@ import type {
SettingsValue,
} from '../config/settingsSchema.js';
import { getSettingsSchema } from '../config/settingsSchema.js';
import type { Config } from '@google/gemini-cli-core';
import { ExperimentFlags } from '@google/gemini-cli-core';
// The schema is now nested, but many parts of the UI and logic work better
// with a flattened structure and dot-notation keys. This section flattens the
@@ -96,6 +98,28 @@ export function getDefaultValue(key: string): SettingsValue {
return getFlattenedSchema()[key]?.default;
}
/**
* Get the effective default value for a setting, checking experiment values when available.
* For settings like compressionThreshold, this will return the experiment value if set,
* otherwise falls back to the schema default.
*/
export function getEffectiveDefaultValue(
key: string,
config?: Config,
): SettingsValue {
if (key === 'model.compressionThreshold' && config) {
const experiments = config.getExperiments();
const experimentValue =
experiments?.flags[ExperimentFlags.CONTEXT_COMPRESSION_THRESHOLD]
?.floatValue;
if (experimentValue !== undefined && experimentValue !== 0) {
return experimentValue;
}
}
return getDefaultValue(key);
}
/**
* Get all setting keys that require restart
*/