Skip to content

browse: runtime handoff() never engages the Xvfb auto-spawn — headed promotion fails on display-less Linux even with Xvfb installed #2764

Closed

Description

@garrytan

Found while root-causing a local failure of browse/test/handoff.test.ts during the v1.78.0.0 ship.

The gap: Xvfb auto-spawn runs only at daemon BOOT (server.ts ~:3113, gated on BROWSE_HEADED=1 via shouldSpawnXvfb). The runtime handoff() promotion (headless daemon → headed browser mid-session, browser-manager.ts) launches launchPersistentContext headed with NO Xvfb decision. On any Linux box with no running X server, browse handoff fails with Playwright's "launched a headed browser without having a XServer running" banner — even when the Xvfb binary is installed (verified live: installing xorg-x11-server-Xvfb alone does not help; the tests only pass under xvfb-run -a, which is exactly what free-tests.yml:129 does in CI).

Why it matters beyond tests: a user on a headless Linux server who runs browse handoff (or any skill that promotes to headed for sign-in/CAPTCHA) hits the same hard failure. The pair-agent/tunnel path would render an Xvfb-backed headed browser visible remotely, so auto-spawn on handoff is useful there; for a purely local display-less box, a headed-under-Xvfb window is invisible to the human, so the right behavior may be spawn + a loud "no local display — the window is only viewable via the extension/tunnel" notice, or a clear refusal naming the fix.

Suggested shape: reuse the boot path's exact machinery (shouldSpawnXvfb / pickFreeDisplay / spawnXvfb + the xvfbPid/xvfbStartTime ownership-validated cleanup) inside handoff(), plus a test in the existing headed-xvfb family. Needs the small design call above first — deliberately NOT folded into the v1.78.0.0 wave at ship time (the PR was fully reviewed and green; this changes runtime behavior).

Activity

  1. capy-ai commented on Oct 3, 2026

    @capy-ai
    Contributor

    handoff() now calls ensureHeadedDisplay() before launching the headed context, which auto-spawns Xvfb on display-less Linux (browse/src/browser-manager.ts). browse/test/handoff.test.ts passes 24/24 on current main with DISPLAY unset and no xvfb-run wrapper.
    Fixed in v1.91.2.0 (#2959).

    If you still see this on the latest gstack, please reopen with details.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions