Skip to content

Spike: which timeout governs locator and CDP actions in the vendor browser API (3 s deadline seen regardless of js timeout) #25

Closed

Description

@SSFSKIM

Question

During the dogfood run several locator actions reported a deadline near three seconds even when a longer locator timeout had been set earlier in the session, and increasing the outer js call's timeout did not raise the locator/CDP action deadline. Which budget actually applies to locator actions and Runtime.evaluate in the vendor browser API, and how is it set?

Method

Read the vendor browser API in the readable source (create_browser_api.js and the locator helpers) for the default action timeout and any per-call override; then a minimal live reproduction against an owned slow page (a local HTTP server that delays an element's appearance) through cua serve: locator wait with default, with a per-call timeout, with a long outer js timeout. Record the observed deadlines.

Deliverable

Findings comment: the budget model, the correct way to extend it, and the host-note sentence for #23. If a vendor default cannot be raised from the API, say so.

Activity

  1. added
    status:ready-for-implementer
    priority:P2
    spike
    status:in-progress
    and removed
    status:ready-for-implementer
    on Oct 5, 2026
  2. SSFSKIM commented on Oct 5, 2026

    @SSFSKIM
    OwnerAuthor

    [board] in-progress: Spike started: static read of the installed vendor browser API, then a minimal owned live probe through cua serve

  3. SSFSKIM commented on Oct 5, 2026

    @SSFSKIM
    OwnerAuthor

    Spike findings: the locator/CDP deadline is a vendor hard cap of 3 s

    Answer. Every locator action, selector read, playwright.evaluate, waitForLoadState and waitForURL in the pinned vendor browser service (@oai/browser-desktop 0.1.1, release 26.928.40906) is bounded by the service-side deadline min(max(0, timeout_ms ?? 3000), max || 3000). Those commands pass no max, so 3000 ms is a ceiling, not a default: a per-call timeoutMs can shorten it but never raise it. There is no session-level setter, and the js tool's timeout_ms is not forwarded to browser commands. The vendor default cannot be raised from the API.

    Budget model (installed runtime, ~/Library/Application Support/cua/runtimes/26.928.40906-darwin-arm64/cua_node/lib/node_modules/@oai/browser-desktop/scripts/, minified; readable line in brackets is ~/codex-app-src/readable/chatgpt-26.928.40906/cua_node/@oai/browser-desktop/scripts/)

    what deadline where
    clamp function qe timeout_ms ?? 3000, clamped to max || 3000 browser-service.mjs:6432 [18546]
    click/dblclick (clickLocator), fill/type/press (focusLocator, prepareLocatorFill, press Date.now()+qe(t)), check/selectOption, waitFor, textContent/innerText/getAttribute/count (selector resolution and evaluate helpers) 3000 cap :6511 press [43844], :6681 waitFor [49968], :6700 selector resolution + "Playwright selector deadline exceeded" [54705, 54861], :6718/:6741 selector evaluate [55077, 55128], :6755 click/focus [55214, 55258]
    tab.playwright.evaluate (read-only scope) 3000 cap :7119 [56931]
    waitForLoadState, waitForURL 3000 cap :6681 [50195, 50237]
    pressSequentially cap 5000 :6681 ($O=5e3) [49778]
    downloadMedia, waitForEvent("download"/"filechooser") default and cap 120000 :6681 (max:12e4) [49625, 50018, 50036]
    raw CDP capability capabilities.get("cdp").send(..., {timeoutMs}) default 3000, not clamped :6686 [54223]; needs full CDP enabled and an extension/IAB tab
    CDP commands issued inside an action (Runtime.evaluate, input dispatch) the action's remaining deadline :6674 af() [48772]
    client per-call timeoutMs sent both as timeout_ms (clamped above) and as transport client_timeout_ms; the service never reads the latter browser-client.mjs:7 locator methods, :9 FunctionAgentTransport.send [7246-7440, 10428]
    js timeout_ms (default 30 s; docs/evidence/m3-mcp-lifecycle.md:70) bounds the whole cell only; on expiry the reply is js execution timed out; kernel reset, rerun your request and REPL globals (tab handles) are lost measured below

    There is no setDefaultTimeout or equivalent in either the client or the service. The vendor option is timeoutMs; a Playwright-style {timeout: N} is ignored, though the cap means it would not help anyway. So the dogfood observations follow directly: "a longer locator timeout set earlier in the session" cannot exist, a longer outer js timeout changes nothing below the cell, and the confirmation click's Runtime.evaluate timeout matches the 3 s action deadline on that click's internal CDP evaluate. The nested-frame press timeout may be the same cap; that was not reproduced here.

    Correct way to wait longer from a js cell

    Loop short waits inside the cell up to your own deadline, and give the js call a timeout_ms above that deadline plus a margin. Keep the margin generous, because an outer timeout resets the kernel and loses the tab handle:

    const end = Date.now() + 20000;
    for (;;) {
      try { await loc.waitFor({state: "visible", timeoutMs: 3000}); break; }
      catch (e) { if (Date.now() >= end || !/deadline|Timed out/.test(String(e?.message))) throw e; }
    }

    For evaluate, the page script itself must finish within 3 s. Poll from the cell instead of awaiting a long promise in the page.

    Measured (2026-10-05, live, cua serve with CUA_SHIM_SURFACES=computer,browser, default CUA_HOME, profile personal ready)

    The setup was one owned tab on a loopback page whose #late button appears N ms after load. Each test was a fresh goto. The timing is around the action itself.

    call element at result action ms
    waitFor({state:"visible"}) 8000 Playwright selector deadline exceeded 3056
    waitFor({..., timeoutMs: 1000}) 8000 deadline exceeded 1041
    waitFor({..., timeoutMs: 20000}) 8000 deadline exceeded 3050
    same, js timeout_ms: 90000 8000 Timed out after 3000ms waiting for selector #late 3034
    waitFor({..., timeout: 20000}) (Playwright spelling) 8000 deadline exceeded 3039
    click() 8000 deadline exceeded 3042
    click({timeoutMs: 20000}) 8000 deadline exceeded 3036
    textContent({timeoutMs: 20000}) 8000 deadline exceeded 3008
    press("Enter", {timeoutMs: 20000}) 8000 deadline exceeded 3046
    waitFor({..., timeoutMs: 20000}) 2500 ok 2488
    playwright.evaluate(async 6 s, undefined, {timeoutMs: 20000}) n/a Timed out after 2997ms waiting for CDP command Runtime.evaluate. 3018
    playwright.evaluate(async 1 s) n/a ok 1037
    the loop above (3 s chunks, 20 s own deadline) 8000 ok after 3 tries 8047
    browser-free cell sleeping 10 s, js timeout_ms: 3000 n/a js execution timed out; kernel reset, rerun your request wall 3018

    Cleanup. The created tab was closed and confirmed absent from listTabs. There was 1 elicitation, the own-origin access, accepted for the session; no other elicitations. end_task returned ended and the server exited 0. No other tab was touched.

    Incidental. The first browser command after getBrowser once failed after about 24 s with Unable to load browser request-header policy. Retry the browser command.; the next command worked. An earlier attempt from a sandboxed shell failed createBrowserTab after 19 s with nodeRepl.fetch request failed. The service reads this policy before sending each session request to the extension (sendSessionRequest, readable 68061), so no tab should have been created, but that was not confirmed by listing.

    Host-note sentence for #23

    - Browser locator actions, waits and playwright.evaluate stop at 3 s whatever timeoutMs or the js timeout_ms say (timeoutMs can only shorten it); to wait longer, loop short waits in the cell up to your own deadline and give the js call a timeout_ms above it.

  4. removed
    status:in-progress
    on Oct 5, 2026
  5. SSFSKIM commented on Oct 5, 2026

    @SSFSKIM
    OwnerAuthor

    [board] done: Findings posted: 3 s is a fixed vendor cap (browser-service.mjs helper, timeout_ms ?? 3000 capped at 3000); only shortening possible; loop short waits in the cell. Host-note sentence handed to #23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:P2spike

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions