Skip to content

fix(browser-recording): a recording ends complete when an action is still going, or a tab's session went away - #650

Merged
earakely-scale merged 2 commits into
mainfrom
edgararakelyan/browser-recording-ends-complete
Nov 12, 2026
Merged

earakely-scale merged 2 commits into
mainfrom
edgararakelyan/browser-recording-ends-complete

Conversation

@earakely-scale

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

Copy link
Copy Markdown
Collaborator

Summary

A follow-up to #643: a browser recording now ends complete when an agent's action is still going at the end, and a frame survives its tab's session going away.

The first batch of Online-Mind2Web's agreement runs (M8.48) lost 2 of 10 runs as infrastructure failures, both at the recording's end:

  • The log was missing 357 entries. On Qatar Airways, an action was still in flight when the run ended. Each line is written once its action ends, and a read returns lines only up to the first one still pending. The log stands a pending action in as unfinished only after STALLED_S (60 s), but an end waits only LOG_WAIT_S (10 s) for its lines, so everything after that action was withheld.
  • A frame was refused with Page.captureScreenshot: Session with given id not found. The tab's session went away between choosing the tab and capturing it. fix(browser-recording): a frame waits out a page that's busy or between documents #643 retried only refusals between documents, so this frame was missing at once.

What changes

  • BrowserLog.read(..., settle_through=n) writes each action begun at or before entry n and still going as unfinished now, as a stalled one is after STALLED_S. Its outcome still gets a line of its own once it ends.
  • A recording's end waits up to LOG_WAIT_S for its lines, as before. Then it reads once more, settling through its last entry. Its log holds every line from its start to its end, with an action still in flight marked unfinished. A line reserved and never written, such as a tab event, is still log_missing, and the run still fails.
  • A frame refused because its session is gone is asked again within the frame budget (FOR_THE_MOMENT, which replaces BETWEEN_DOCUMENTS). It's asked on the session the tab has by then, else the active tab's. While there's no tab at all, as when the only one is between sessions, it waits for one within the budget.

Test plan

  • Unit, the log (test_browser_log.py): a read settling through an entry writes the actions still going up to it as unfinished, and leaves a later one pending until it ends.
  • Unit, the recording (test_browser_recording.py):
    • An end writes an action still going as unfinished, with the line after it in the log, and lists only a line never written as missing. This replaces the test that expected the action itself to be missing.
    • A frame whose session is gone is taken on the session its tab was attached on anew, including when the only tab attaches anew only after the first retry.
  • Results: the protocol package, tst/unit/task_step and tst/unit/drivers, 4,346 passed.
  • Real runs: the other 50 agreement runs, on this branch, Claude Haiku 5.5, local Docker.

Docs

The user guide's browser recording section should say that an action still in flight at a recording's end is in its log, marked unfinished.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the session retry fix addresses the previous finding.

Summary

Browser recordings now keep in-flight actions as unfinished and retry captures after a tab loses its session.

  • Recording ends keep in-flight actions in the saved log.
  • Frame capture retries after a tab's browser session disappears.

Reviews (4) · Last reviewed commit: "fix(browser-recording): a frame waits wi..." · Reviewed by Greptile

…till going, or a tab's session went away

Online-Mind2Web's agreement runs lost two runs to the recording's end:
- An action still going when a run ended held back every later log line.
  The log stands one in as unfinished only after STALLED_S (60 s), and an end
  waits LOG_WAIT_S (10 s), so that run's log was missing 357 entries. Now,
  once its wait is up, an end writes the actions still going up to its last
  entry as unfinished (BrowserLog.read(settle_through=...)). The log then holds
  every line to the end, an action in flight marked as such.
- A frame refused with "Session with given id not found", its tab detached
  or attached anew, was missing at once. It's now asked again within the
  frame budget, on the session the tab has then, else the active tab's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale requested a review from a team as a code owner November 12, 2026 21:30
…ached anew

A frame retried after its session went away looked once for the tab's new
session, else the active tab's. With the only tab detached and its new session
not there yet, that raised "no tab open" with most of the frame's budget left.
It now waits for a session within the budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale merged commit 1500382 into main Nov 12, 2026
35 of 36 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/browser-recording-ends-complete branch November 12, 2026 22:16
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