fix(gemini-web): respect explicit profile config over auto-discovery

Skip existing Chrome auto-discovery when GEMINI_WEB_CHROME_PROFILE_DIR
is explicitly set, to avoid binding to the wrong browser profile/account.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alec Jiang 2026-03-16 18:39:53 +08:00
parent b7bcc8c094
commit bd01c370c9
1 changed files with 2 additions and 1 deletions

View File

@ -265,7 +265,8 @@ export async function load_browser_cookies(domain_name: string = '', verbose: bo
if (cached) return { chrome: cached };
}
const existingCookies = await fetch_cookies_from_existing_chrome(30_000, verbose);
const hasExplicitProfile = !!process.env.GEMINI_WEB_CHROME_PROFILE_DIR?.trim();
const existingCookies = hasExplicitProfile ? null : await fetch_cookies_from_existing_chrome(30_000, verbose);
if (existingCookies) {
const filtered: CookieMap = {};
for (const [key, value] of Object.entries(existingCookies)) {