From db3d23d49635b7da7ed55f55b277eb69aa9c79ba Mon Sep 17 00:00:00 2001 From: Iddo Gino Date: Wed, 11 Mar 2026 20:08:31 -0700 Subject: [PATCH] fix: use getDefaultTimeout() in CDP connect paths instead of hardcoded 10s (#704) The connectViaCDP and connectToBrowserbase methods hardcoded context.setDefaultTimeout(10000), ignoring the AGENT_BROWSER_DEFAULT_TIMEOUT env var. This made page.goto time out after 10s on CDP connections even when the env var was set to a higher value. Now both paths use getDefaultTimeout() like all other connection modes. Fixes #703 --- src/browser.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/browser.ts b/src/browser.ts index 0d2ab4d..584d886 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -34,7 +34,7 @@ import { * Can be overridden via the AGENT_BROWSER_DEFAULT_TIMEOUT environment variable. * Default is 25s, which is below the CLI's 30s IPC read timeout to ensure * Playwright errors are returned before the CLI gives up with EAGAIN. - * CDP and recording contexts use a shorter fixed timeout (10s) and are not affected. + * Recording contexts use a shorter fixed timeout (10s) and are not affected. */ export function getDefaultTimeout(): number { const envValue = process.env.AGENT_BROWSER_DEFAULT_TIMEOUT; @@ -954,7 +954,7 @@ export class BrowserManager { this.browserbaseSessionId = session.id; this.browserbaseApiKey = browserbaseApiKey; this.browser = browser; - context.setDefaultTimeout(10000); + context.setDefaultTimeout(getDefaultTimeout()); this.contexts.push(context); this.setupContextTracking(context); await this.ensureDomainFilter(context); @@ -1559,7 +1559,7 @@ export class BrowserManager { this.cdpEndpoint = cdpEndpoint; for (const context of contexts) { - context.setDefaultTimeout(10000); + context.setDefaultTimeout(getDefaultTimeout()); this.contexts.push(context); this.setupContextTracking(context); await this.ensureDomainFilter(context);