Skip to content

[Bug]: off-window Electron preview guests stall snapshots and block later captures #24514

Open

Description

@lebedev-nikita

Area

apps/desktop — collaborative browser automation

Steps to reproduce

  1. Run T3 Code Nightly on macOS.
  2. Open a fresh, agent-owned preview tab on a simple page:
    preview_open({url: "https://example.com", open: false, reuseExistingTab: false}).
  3. Keep its preview hidden, or switch to another thread so the guest is hosted outside the app window.
  4. Request preview_snapshot({tabId, includeImage: false}).
  5. Repeat the snapshot on the same tab. Compare with preview_evaluate reading document.title or document.body.innerText.

Expected behavior

Snapshots of background preview tabs should return the accessibility tree and requested image without requiring the user to reveal the tab or switch threads.

Actual behavior

The snapshot consistently times out, even on example.com and with includeImage: false:

Preview automation snapshot timed out after 15000ms.

JavaScript evaluation still returns immediately. New tabs and an incognito profile reproduce the failure, so it does not depend on the target application or saved browser state. Impact: major degradation / frequent failure of agent browser verification.

Environment

  • T3 Code: 0.1.3-nightly.20261024.3604
  • macOS 27.0.1, Apple Silicon
  • Electron 44.9.3 / Chromium 152.0.7977.167
  • Source investigation and regression tests: main@d53873b6a479
  • Codex harness; the failure also reproduces outside the provider in an isolated Electron fixture.

Deterministic isolation and cause

An isolated fixture using the same Electron version, T3's CdpRelay, and the actual ServerBrowserPage.snapshot reproduces the stall when the guest webview is positioned at left: -100000px; top: -100000px.

The metrics, page evaluation, and accessibility-tree requests answer. Page.captureScreenshot does not. Disabling background throttling does not restore composition for a guest fully outside the window. includeImage: false does not avoid this path because snapshot capture still obtains an image internally.

The desktop host serializes screenshot requests to avoid overlapping native captures. An unanswered screenshot therefore also holds up subsequent screenshots on that guest.

Moving the guest into the window behind the app for the duration of capture, waiting for the renderer to commit that position, and releasing it afterwards makes the same full snapshot complete. The regression fixture returned three consecutive 1280×960 snapshots, then three more in a fresh Electron process. The guest remains inactive between captures.

Related reports

Related symptoms: #23936, #22594, #17483, #23139. This report adds a deterministic off-window compositor reproduction and a focused fix for this capture path; it does not establish that every timeout in those reports has the same cause.

Fix

Implemented in #24515, including the capture lifecycle fix and regression tests.

Activity

  1. RiccardoBelli commented on Oct 26, 2026

    @RiccardoBelli

    Same here on Linux (Arch, Hyprland/Wayland), t3code-bin 0.1.2 installed with the server still on 0.1.0, Electron 44.4.5, Claude Code harness.

    An agent tab opened with open: false draws no frames. A requestAnimationFrame callback never runs within a second, even if document.visibilityState says visible. preview_snapshot on that tab times out after 15 s. On the tab shown in the panel it works. If the agent first calls preview_open with the tabId and open: true, frames start and the snapshot works.

    Two more things I saw, maybe useful for #24515:

    1. After the snapshot timed out, other calls on the same tab got stuck too, not only screenshots. preview_open with open: true on that tab hung until Preview automation open timed out after 660000ms, and preview_evaluate timed out after 15 s. Only closing the tab fixed it. So the agent can't even reveal the tab to recover.
    2. About 1 s after the timeout (HOST_RESPONSE_GRACE_MS) the broker disconnects the whole host connection. The next call on any tab fails with No preview automation host is available for snapshot ... until it reconnects about 1 s later. We first thought parallel snapshot calls caused this, but the second call just started in that gap.
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