fix(core): deduplicate project memory when JIT context is enabled (#22234)

This commit is contained in:
Sandy Tao
2026-03-13 21:34:53 -07:00
committed by GitHub
parent ac59d20b9f
commit 4d4b287348
2 changed files with 29 additions and 1 deletions
@@ -165,6 +165,29 @@ describe('getEnvironmentContext', () => {
expect(getFolderStructure).not.toHaveBeenCalled();
});
it('should exclude environment memory when JIT context is enabled', async () => {
(mockConfig as Record<string, unknown>)['isJitContextEnabled'] = vi
.fn()
.mockReturnValue(true);
const parts = await getEnvironmentContext(mockConfig as Config);
const context = parts[0].text;
expect(context).not.toContain('Mock Environment Memory');
expect(mockConfig.getEnvironmentMemory).not.toHaveBeenCalled();
});
it('should include environment memory when JIT context is disabled', async () => {
(mockConfig as Record<string, unknown>)['isJitContextEnabled'] = vi
.fn()
.mockReturnValue(false);
const parts = await getEnvironmentContext(mockConfig as Config);
const context = parts[0].text;
expect(context).toContain('Mock Environment Memory');
});
it('should handle read_many_files returning no content', async () => {
const mockReadManyFilesTool = {
build: vi.fn().mockReturnValue({