fix(patch): cherry-pick aba8c5f to release/v0.28.0-preview.0-pr-17806 to patch version v0.28.0-preview.0 and create version 0.28.0-preview.1 (#18307)

This commit is contained in:
gemini-cli-robot
2026-02-04 08:07:42 -08:00
committed by GitHub
parent 9bd6ec6664
commit 8468a48bff
28 changed files with 730 additions and 304 deletions

View File

@@ -272,6 +272,27 @@ export class InteractiveRun {
}
}
function isObject(item: any): item is Record<string, any> {
return !!(item && typeof item === 'object' && !Array.isArray(item));
}
function deepMerge(target: any, source: any): any {
if (!isObject(target) || !isObject(source)) {
return source;
}
const output = { ...target };
Object.keys(source).forEach((key) => {
const targetValue = target[key];
const sourceValue = source[key];
if (isObject(targetValue) && isObject(sourceValue)) {
output[key] = deepMerge(targetValue, sourceValue);
} else {
output[key] = sourceValue;
}
});
return output;
}
export class TestRig {
testDir: string | null = null;
homeDir: string | null = null;
@@ -316,44 +337,56 @@ export class TestRig {
const projectGeminiDir = join(this.testDir!, GEMINI_DIR);
mkdirSync(projectGeminiDir, { recursive: true });
const userGeminiDir = join(this.homeDir!, GEMINI_DIR);
mkdirSync(userGeminiDir, { recursive: true });
// In sandbox mode, use an absolute path for telemetry inside the container
// The container mounts the test directory at the same path as the host
const telemetryPath = join(this.homeDir!, 'telemetry.log'); // Always use home directory for telemetry
const settings = {
general: {
// Nightly releases sometimes becomes out of sync with local code and
// triggers auto-update, which causes tests to fail.
disableAutoUpdate: true,
previewFeatures: false,
},
telemetry: {
enabled: true,
target: 'local',
otlpEndpoint: '',
outfile: telemetryPath,
},
security: {
auth: {
selectedType: 'gemini-api-key',
const settings = deepMerge(
{
general: {
// Nightly releases sometimes becomes out of sync with local code and
// triggers auto-update, which causes tests to fail.
disableAutoUpdate: true,
previewFeatures: false,
},
telemetry: {
enabled: true,
target: 'local',
otlpEndpoint: '',
outfile: telemetryPath,
},
security: {
auth: {
selectedType: 'gemini-api-key',
},
folderTrust: {
enabled: false,
},
},
ui: {
useAlternateBuffer: true,
},
model: {
name: DEFAULT_GEMINI_MODEL,
},
sandbox:
env['GEMINI_SANDBOX'] !== 'false' ? env['GEMINI_SANDBOX'] : false,
// Don't show the IDE connection dialog when running from VsCode
ide: { enabled: false, hasSeenNudge: true },
},
ui: {
useAlternateBuffer: true,
},
model: {
name: DEFAULT_GEMINI_MODEL,
},
sandbox:
env['GEMINI_SANDBOX'] !== 'false' ? env['GEMINI_SANDBOX'] : false,
// Don't show the IDE connection dialog when running from VsCode
ide: { enabled: false, hasSeenNudge: true },
...overrideSettings, // Allow tests to override/add settings
};
overrideSettings ?? {},
);
writeFileSync(
join(projectGeminiDir, 'settings.json'),
JSON.stringify(settings, null, 2),
);
writeFileSync(
join(userGeminiDir, 'settings.json'),
JSON.stringify(settings, null, 2),
);
}
createFile(fileName: string, content: string) {