From 548376a065500e3631b572d5afe2af455482eb0d Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Thu, 3 Dec 2026 10:46:36 +0100 Subject: [PATCH 1/3] Bug 2100702 - [firefox-mcp] Wait up to 30 seconds for the BiDi WebSocket to open The first BiDi command opens the WebSocket. On Windows CI, opening it after a slow Firefox startup sometimes took more than the 5 second limit, and the connection failed with "Timeout waiting for WebSocket to open". Measured on Windows CI: median 187 ms, 90% under 1.4 s, maximum over 5 s. No test: a real Firefox cannot be made to open the WebSocket slowly on demand. --- src/firefox/bidi.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/firefox/bidi.ts b/src/firefox/bidi.ts index 051d0fe..cf0e487 100644 --- a/src/firefox/bidi.ts +++ b/src/firefox/bidi.ts @@ -317,7 +317,7 @@ export class BiDiFacade extends EventEmitter { /** * Wait for WebSocket to be in OPEN state */ - private async waitForWebSocketOpen(ws: any, timeout: number = 5000): Promise { + private async waitForWebSocketOpen(ws: any, timeout: number = 30000): Promise { // Already open if (ws.readyState === 1) { return; From edd54a7e43a896c7e3761d9405e1c5efacd31ba3 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Thu, 3 Dec 2026 10:46:58 +0100 Subject: [PATCH 2/3] Bug 2100702 - [firefox-mcp] Raise the default test timeout to 30 seconds Tests without an explicit timeout used the vitest default of 5 seconds. Tests which start or restart Firefox, such as restricted-session-restart.test.ts, take 3.6 to 4.8 seconds on Windows CI when they pass, and failed when a slow startup pushed them over 5 seconds. Explicit timeouts on single tests still apply. --- vitest.config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vitest.config.ts b/vitest.config.ts index d86620d..e46a0d3 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -8,6 +8,9 @@ export default defineConfig({ setupFiles: ['./tests/setup.ts'], // Firefox startup can be slow on CI runners, especially the first launch hookTimeout: 120000, + // Tests which start or restart Firefox can take more than the 5 seconds + // default, especially on Windows CI runners + testTimeout: 30000, // Run tests sequentially to avoid Firefox port conflicts fileParallelism: false, pool: 'forks', From 185cf7aec89a169e06c590cbdb2d1ebc86b1c642 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Thu, 3 Dec 2026 11:34:44 +0100 Subject: [PATCH 3/3] Bug 2100702 - [firefox-mcp] Use the default timeout in the privileged context test The test starts Firefox with its first tool call. On Windows CI it takes 4.8 to 5.7 seconds, and sometimes went over its explicit 10 second limit. Use the default test timeout of 30 seconds instead. --- .../mcp/privileged-context-no-access.test.ts | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/integration/mcp/privileged-context-no-access.test.ts b/tests/integration/mcp/privileged-context-no-access.test.ts index 7462b2e..55a1971 100644 --- a/tests/integration/mcp/privileged-context-no-access.test.ts +++ b/tests/integration/mcp/privileged-context-no-access.test.ts @@ -8,17 +8,13 @@ import { mcpTest } from '../../helpers/mcp.js'; mcpTest.override('mcpServerArgs', ['--tools', 'privileged']); mcpTest.describe('privileged tools without system access (MCP)', () => { - mcpTest( - 'explains how to enable system access', - async ({ mcp }) => { - const result = await mcp.callTool('evaluate_privileged_script', { - function: '() => 1', - context: 'unknown', - }); + mcpTest('explains how to enable system access', async ({ mcp }) => { + const result = await mcp.callTool('evaluate_privileged_script', { + function: '() => 1', + context: 'unknown', + }); - expect(result.isError).toBe(true); - expect(result.text).toContain('MOZ_REMOTE_ALLOW_SYSTEM_ACCESS'); - }, - 10000 - ); + expect(result.isError).toBe(true); + expect(result.text).toContain('MOZ_REMOTE_ALLOW_SYSTEM_ACCESS'); + }); });