fix: ensure folderTrust returns true in headless mode

This commit is contained in:
galz10
2026-02-11 14:48:20 -08:00
parent ba2b133476
commit 08b1d89c62
2 changed files with 11 additions and 0 deletions

View File

@@ -449,6 +449,14 @@ describe('Trusted Folders', () => {
false,
);
});
it('should return true for isPathTrusted when isHeadlessMode is true', async () => {
const geminiCore = await import('@google/gemini-cli-core');
vi.spyOn(geminiCore, 'isHeadlessMode').mockReturnValue(true);
const folders = loadTrustedFolders();
expect(folders.isPathTrusted('/any-untrusted-path')).toBe(true);
});
});
describe('Trusted Folders Caching', () => {

View File

@@ -128,6 +128,9 @@ export class LoadedTrustedFolders {
location: string,
config?: Record<string, TrustLevel>,
): boolean | undefined {
if (isHeadlessMode()) {
return true;
}
const configToUse = config ?? this.user.config;
// Resolve location to its realpath for canonical comparison