perf: skip redundant GEMINI.md loading in partialConfig (#26443)

This commit is contained in:
Coco Sheng
2026-05-04 12:05:24 -04:00
committed by GitHub
parent 4fa2c95c59
commit ab48aad213
3 changed files with 23 additions and 2 deletions
+14
View File
@@ -1174,6 +1174,20 @@ describe('Hierarchical Memory Loading (config.ts) - Placeholder Suite', () => {
['.git'], // boundaryMarkers
);
});
it('should NOT call loadServerHierarchicalMemory when skipMemoryLoad is true', async () => {
process.argv = ['node', 'script.js'];
const settings = createTestMergedSettings({
experimental: { jitContext: false },
});
const argv = await parseArguments(settings);
await loadCliConfig(settings, 'session-id', argv, {
skipMemoryLoad: true,
});
expect(ServerConfig.loadServerHierarchicalMemory).not.toHaveBeenCalled();
});
});
describe('mergeMcpServers', () => {
+8 -2
View File
@@ -560,6 +560,7 @@ export interface LoadCliConfigOptions {
};
worktreeSettings?: WorktreeSettings;
skipExtensions?: boolean;
skipMemoryLoad?: boolean;
}
export async function loadCliConfig(
@@ -568,7 +569,12 @@ export async function loadCliConfig(
argv: CliArgs,
options: LoadCliConfigOptions = {},
): Promise<Config> {
const { cwd = process.cwd(), projectHooks, skipExtensions = false } = options;
const {
cwd = process.cwd(),
projectHooks,
skipExtensions = false,
skipMemoryLoad = false,
} = options;
const debugMode = isDebugMode(argv);
const worktreeSettings =
@@ -681,7 +687,7 @@ export async function loadCliConfig(
const finalExtensionLoader =
extensionManager ?? new SimpleExtensionLoader([]);
if (!experimentalJitContext) {
if (!experimentalJitContext && !skipMemoryLoad) {
// Call the (now wrapper) loadHierarchicalGeminiMemory which calls the server's version
const result = await loadServerHierarchicalMemory(
cwd,
+1
View File
@@ -412,6 +412,7 @@ export async function main() {
const partialConfig = await loadCliConfig(settings.merged, sessionId, argv, {
projectHooks: settings.workspace.settings.hooks,
skipExtensions: true,
skipMemoryLoad: true,
});
adminControlsListner.setConfig(partialConfig);