Skip to content

fix(browser): a popup a click opens runs at once, and the recording's video stays on it - #722

Merged
earakely-scale merged 2 commits into
mainfrom
edgararakelyan/fd-5973-m822-follow-up-a-click-that-opens-a
Nov 16, 2026
Merged

earakely-scale merged 2 commits into
mainfrom
edgararakelyan/fd-5973-m822-follow-up-a-click-that-opens-a

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

FD-5973, a follow-up of M8.22 (FD-4970). Two bugs on the path a popup takes, both found through flakes of test_each_context_is_recorded_alone_its_video_following_its_agent_while_agents_act_on_all_at_once.

  1. A popup a click opens doesn't run for 30 s. BrowserControl holds each page it attaches to until it has enabled it and set its viewport, and only then tells it to run. Chromium answers Page.enable on a popup a click opened, paused before its first navigation, only once it runs. So the control waited out the call's 30 s timeout before letting the popup run. This applies to a browser with a viewport, which a chromium computer is. Unless another CDP client resumed the popup first, the agent waited 30 s for it too. That's likely why the test usually passed: the agent's Playwright connection resumes the popup itself.
  2. The recording's video could leave the popup. The browser log tells a recording about an action when the browser answers it (BrowserLog.finish), and the popup opens before the click is answered. So the click's answer could take the video back to the opener.

The CI runs show both. On #717 the video followed red, orange, red, orange, red, with the agent's next popup action 30 s later. On this PR's first commit, the video stayed on the popup but was blank for 30 s, because the popup hadn't run.

What changes

  • website_browser/control.py, _let_run: Page.enable, the viewport and file-chooser calls, and Runtime.runIfWaitingForDebugger now go together, in order, and the control waits for them all. The browser handles a session's commands in order, so the viewport still applies before the page runs. A call that fails is still raised after the page is told to run, as before.
  • website_browser/stream.py: when the video follows a popup, it notes the log's next sequence number for the opener. An action on the opener numbered below that began before the popup opened, and leaves the video on the popup. One begun after it still takes the video back. recording.py passes the numbers.
  • The protocol README says so where it describes what the video follows.

How it was tested

  • Real Chromium, on an agent-environments-admin VM (amd64), using the Chromium in v0.9.1546's released agentenv-chromium image, pulled anonymously. It ran headful on Xvfb with agentenv's flags over --remote-debugging-pipe, with a 1280×800 viewport:

    Control Click → the popup shows its page (3 trials)
    Released (v0.9.1546) 30.06 s, 30.08 s, 30.07 s
    This branch 0.05 s, 0.08 s, 0.08 s

    A CDP-level run showed the cause. Awaiting Page.enable before resuming, the popup's Page.enable never answered within 10 s, and nothing navigated or painted. Sending the three calls together, all answered in about 3 ms, the popup loaded in about 6 ms, and a screencast started at 0 or 100 ms sent orange frames.

  • Unit:

    • test_a_popup_that_answers_page_enable_only_once_it_runs_is_told_to_run_at_once_held_to_its_window_first models that browser and times out on main.
    • test_a_click_that_opens_a_popup_leaves_the_video_on_it_though_the_click_is_answered_after fails on main with ['T3', 'T4', 'T3'].
    • Five setup tests that checked the calls after a single event-loop turn now give the calls a moment to start.
    • The protocol suite: 1638 passed, 1 skipped.
  • Integration: integration-local-slow in CI.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no blocking issues were found.

Summary

This PR removes the popup startup wait and keeps its recording from jumping back to the opener.

  • Click-opened popup pages start without waiting for setup replies.
  • A popup’s opening click no longer pulls its video back to the opener.

No actionable new issues were found in the changes since the previous review. The full PR also passed the repository-rule check. Tests were inspected, not run.

Reviews (5) · Last reviewed commit: "fix(browser): a popup a click opens runs..." · Reviewed by Greptile

… on it

The browser log tells a recording of an action when the browser answers it, and the browser opens the popup a
click makes before it answers the click, so the click could take the video back to its opener, where it stayed
until the agent's next action in the popup. An action begun on a tab before a tab it opened, which the video has
followed since, now leaves the video there; one begun on the opener after that still takes it back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BrowserControl held each page it attached to until it had enabled it and set its viewport, and only then told it
to run. Chromium answers Page.enable on a popup a click opened, paused before its first navigation, only once it
runs, so the control waited out Page.enable's 30 s timeout first: on the released Chromium with a viewport, every
popup showed its page 30 s after the click, unless another client let it run. The calls now go together, in the
order the browser handles them, so the viewport still applies before the page runs: 0.05-0.08 s on the same
Chromium. A browser recording followed the popup blank meanwhile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale earakely-scale changed the title fix(browser): a click that opens a popup leaves the recording's video on it fix(browser): a popup a click opens runs at once, and the recording's video stays on it Nov 16, 2026
@earakely-scale
earakely-scale merged commit 8544962 into main Nov 16, 2026
37 of 38 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/fd-5973-m822-follow-up-a-click-that-opens-a branch November 16, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant