#7422 · Browser execution omits its host deadline override
Verdict: REPRODUCED at the plugin-to-host RPC boundary. Root-cause confidence: high. Reproduction label: confirmed-repro.
1. TL;DR
The browser plugin accepts script execution budgets longer than 30 seconds but does not put that budget into its host-call options. A focused test invoking the real plugin entry and public RPC handler observes the script budget in the host input and an absent host deadline override. The server therefore chooses its 30-second default, and the daemon enforces that shorter deadline; the plugin then stops the session when the call throws. The same omission reproduces in two separate clean checkouts of trusted main. These are boundary-level reproductions, not measurements of a live browser: the issue's exact elapsed times, installed release behavior, and browser-process teardown were not re-measured here.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| Long script budgets do not extend the host deadline. | Verified | For 30,000, 90,000, and 120,000 ms inputs, both test runs observe an absent host-call timeout override. |
| The effective host default is 30 seconds. | Verified in trusted source | callPluginHostRpc defaults to COMMAND_TIMEOUT_MS, which is 30,000. |
| The daemon emits the reported deadline error and the plugin stops the session. | Source-supported; not timed live | The daemon deadline callback rejects the pending call. The plugin catch path calls finish(record, "stopped"). |
| Observed wall times, a short script's success, and a short explicit script timeout. | Unverified in this investigation | No live DevBrowser session or installed release was executed. |
| Pages and screenshots share the same race. | Verified in trusted source | Both handlers call the same run implementation with a 30,000 ms script budget. |
3. Environment and scope
- Repository: public
get-bb/bb; both worktrees started detached at365d7c5237ae270be0555b5b44ea61020252713efrom fetchedorigin/main. - Linux x86_64; Node.js 22.19.0; pnpm 9.15.0; Vitest 4.1.12; Browser Automation package 0.1.1; Plugin SDK 0.6.140.
- Separate temporary directories named
base-oneandbase-two. No app instance, HTTP ports, production runtime data, accounts, browser profile, or provider sessions were used. - Only the newly authored test and its shared-worker Vitest configuration were added or changed. Production source remained unchanged.
- A frozen install succeeded in both checkouts. The first full build initially failed because SDK runtime entries were not yet built; building the SDK explicitly resolved this setup issue. Full builds then passed in both checkouts, each with 73 successful tasks.
4. Minimal reproduction
This reproduction targets the precise boundary where the timeout is lost. It loads the real server plugin, opens a local session through its real RPC handler, and spies on the public host client before the SDK test harness translates the call. The external browser worker is replaced by a deterministic successful host response; no browser timing or daemon execution is simulated.
- In a clean checkout of the trusted base, install and build:
git checkout --detach 365d7c5237ae270be0555b5b44ea61020252713e pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build build:types --filter=@get-bb/plugin-sdk pnpm exec turbo run build
- Save the following newly authored test as
plugins/browser-automation/issue-7422.test.ts:import { createFakePluginHost, makeHostResponse, makeThreadResponse, } from "@get-bb/plugin-sdk/testing"; import { expect, it, vi } from "vitest"; import plugin from "./server.js"; import { rpcContract } from "./contracts.js"; it.each([30_000, 90_000, 120_000])( "keeps the host deadline beyond a %i ms script budget", async (timeoutMs) => { const host = createFakePluginHost({ pluginId: "browser-automation", agentSkillIds: ["browser-automation"], experimental_callHostRpc: async ({ method }) => { if (method === "prepare") return { status: "ready", version: "test", source: "release" }; if (method === "run") return { text: "42", images: [], exitCode: 0 }; return null; }, }); host.harness.sdk.stub("threads.get", async () => makeThreadResponse({ id: "deadline-thread" }), ); host.harness.sdk.stub("hosts.list", async () => [ makeHostResponse({ id: "deadline-host" }), ]); const createClient = vi.spyOn(host.bb.hosts, "experimental_client"); try { await plugin(host.bb); const client = createClient.mock.results[0]; if (client?.type !== "return") throw new Error("Host client missing"); const callHost = vi.spyOn(client.value, "call"); const session = rpcContract.open.output.parse( await host.harness.behavior.callRpc("open", { threadId: "deadline-thread", selection: { backend: "local", hostId: "deadline-host" }, }), ); await host.harness.behavior.callRpc("run", { threadId: "deadline-thread", sessionId: session.id, script: "6 * 7", timeoutMs, }); const invocation = callHost.mock.calls.find( ([method]) => method === "run", ); expect(invocation).toBeDefined(); expect(invocation?.[1]).toMatchObject({ timeoutMs }); const deadline = invocation?.[2].timeoutMs; console.log( JSON.stringify({ scriptTimeoutMs: timeoutMs, hostTimeoutMs: deadline ?? null, }), ); expect(deadline).toBeGreaterThan(timeoutMs); } finally { await host.harness.lifecycle.dispose(); createClient.mockRestore(); } }, ); - Replace
plugins/browser-automation/vitest.config.tswith this test-discovery configuration. It uses the repository's shared-worker helper and makes no production change:import { defineConfig } from "vitest/config"; import { fileURLToPath } from "node:url"; import { sharedWorkerProjects } from "../../vitest.shared.js"; export default defineConfig({ resolve: { tsconfigPaths: true }, test: { projects: sharedWorkerProjects({ pkgDir: fileURLToPath(new URL(".", import.meta.url)), name: "bb-plugin-browser-automation", include: ["**/*.test.{ts,tsx}"], exclude: ["dist/**", "node_modules/**"], }), }, }); - Run:
pnpm exec turbo run test --filter=bb-plugin-browser-automation -- issue-7422.test.ts
Expected: The host input retains each requested script budget, and the host-call timeout is a number greater than that budget so the script can finish or deliver its own timeout result.
Actual, both checkouts: The host input retains the budget, but the host options do not contain timeoutMs. The log deliberately renders an absent override as null:
{"scriptTimeoutMs":30000,"hostTimeoutMs":null}
{"scriptTimeoutMs":90000,"hostTimeoutMs":null}
{"scriptTimeoutMs":120000,"hostTimeoutMs":null}
TypeError: actual value must be number or bigint, received "undefined"
Test Files 1 failed (1)
Tests 3 failed (3)
The failure occurs at expect(deadline).toBeGreaterThan(timeoutMs), after the real run handler completes successfully and the script budget assertion passes. It is not an import, discovery, session-opening, or worker failure.
5. Root cause
- The public run schema accepts 1,000–120,000 ms and defaults to 30,000 ms.
- The run implementation passes that value only in the host method input. Its separate host-call options contain
hostIdandsignal, but notimeoutMs:await host.call( "run", { sessionId: input.sessionId, script: input.script, timeoutMs: input.timeoutMs }, { hostId: record.session.hostId, signal }, ); - The server host-RPC implementation computes
args.timeoutMs ?? COMMAND_TIMEOUT_MSand sends it to the daemon. The constant is 30,000 ms. Its separate 6,000 ms transport grace does not enlarge the daemon's work budget. - The daemon deadline timer rejects unfinished work with the host-call deadline error. The run catch path then marks the session stopped. This explains the reported failure and subsequent unavailable session, without asserting an exact CLI wall time.
The options contract already supports an explicit deadline: ExperimentalHostCallOptions. No protocol extension is required. The pages and screenshot handlers reuse run with a 30-second budget, so equal script and host deadlines also create a race for those operations.
The SDK fake host currently omits timeout options from its recorded host-call envelope. This test therefore observes the actual public host client before that lossy test adapter, rather than falsely treating the adapter's missing field as production evidence.
6. Proposed fix
At the shared run implementation, set the host-call timeout to the validated script budget plus a bounded cleanup/response allowance. Preserve the existing script budget and cancellation signal; do not raise the global server default. This also covers pages and screenshots. Keep the maximum below the existing 30-minute options cap. Add coverage for the default and maximum budgets and confirm real short-timeout cancellation still works.
7. Linked pull request
PR #7423 was OPEN and its GitHub closing-issue metadata referenced #7422. Its diff was read only as untrusted evidence; its branch and tests were never checked out or run. The inspected revision was fbcf2e62d35df6ce92fb1539d829669be127db29, with 39 additions and 1 deletion across 3 files.
Static assessment: Its production change adds a 10,000 ms allowance to the script budget in the host-call options at the shared run boundary. That addresses the independently verified omission and covers the shared pages/screenshot path. It also makes the SDK test fake preserve the timeout and adds coverage. No blocking issue is apparent in this narrow static review; this is not a full review or a passing-test claim about that branch.
Fix decision: No duplicate pull request was opened because an existing open pull request already links to this issue. No production fix, source commit, or source push was made by this investigation.
8. Related issues
#7349 concerns CLI recovery hints rather than propagation of host deadlines. The trusted base already includes #7374's session-activity persistence change. Neither removes the verified timeout omission.
9. Verification
The same agent repeated the test in a second temporary checkout, not an independent investigation. Before adding the test files, the second checkout had empty git status --short output and the exact same trusted base SHA. It had its own frozen install and successful full build. There were no ports or application data directories to reuse.
| Check | First checkout | Second clean checkout |
|---|---|---|
| Recorded base | 365d7c5237ae270be0555b5b44ea61020252713e | |
| Focused regression command from section 4 | Exit 1; 3 intended failures; 22 ms test execution | Exit 1; same 3 intended failures; 22 ms test execution |
| Observed override at all 3 budgets | Absent | Absent |
| Full build | 73 tasks successful after SDK preparation | 73 tasks successful |
No correction to the root cause was necessary after the second run. No after-fix run was performed because no production fix was attempted.
10. Appendix and limits
Existing neighboring suites passed on unchanged production source:
pnpm exec turbo run test --filter=bb-plugin-browser-automation -- server.test.ts cli.test.ts Test Files 2 passed (2) Tests 49 passed (49) Tasks: 7 successful, 7 total
git diff --check passed in the first checkout. Full local logs and test artifacts are retained outside the public repository; reproduction source and the relevant output are included inline, as required by the reports repository. This is a nonvisual defect, so no screenshot was needed.
Trust boundary: The issue and linked pull request were treated as untrusted claims. No issue-provided command, script, patch, branch, binary, or test was executed. The reproduction was newly authored from trusted repository contracts and the existing test harness. No workflow or subagent was started.
Limits: The test proves the production timeout-forwarding defect, not a 32–33 second wall-clock measurement. Actual Chrome execution, browser teardown, desktop attachment, logged-in pages, and historical installed releases remain untested here.
> AGENT GENERATED