fix: environment loading logic for unknown folder trust

This commit is contained in:
Bryan Morgan
2026-01-31 12:57:25 -05:00
parent 4635f4250f
commit 822631e7b7
2 changed files with 13 additions and 4 deletions

View File

@@ -47,7 +47,7 @@ describe('ACP Environment and Auth', () => {
// Create a project directory with a .env file
const projectDir = join(rig.testDir!, 'project');
mkdirSync(projectDir);
mkdirSync(projectDir, { recursive: true });
writeFileSync(
join(projectDir, '.env'),
'GEMINI_API_KEY=test-key-from-env\n',
@@ -87,9 +87,18 @@ describe('ACP Environment and Auth', () => {
});
} catch (error) {
if (error instanceof Error) {
expect(error.message).not.toContain('Authentication required');
if (error.message.includes('Authentication required')) {
throw new Error(
`Expected session to be authenticated via .env, but got: ${error.message}`,
);
}
} else {
throw error;
const errorMsg = String(error);
if (errorMsg.includes('Authentication required')) {
throw new Error(
`Expected session to be authenticated via .env, but got: ${errorMsg}`,
);
}
}
}

View File

@@ -438,7 +438,7 @@ export function loadEnvironment(
): void {
const envFilePath = findEnvFile(workspaceDir);
if (!isWorkspaceTrusted(settings, workspaceDir).isTrusted) {
if (isWorkspaceTrusted(settings, workspaceDir).isTrusted === false) {
return;
}