Repository navigation
fix(browser-recording): a frame whose tab closes mid-capture is taken of the tab left - #652
Merged
earakely-scale merged 1 commit intoNov 12, 2026
Conversation
… of the tab left A capture asked of a tab that then closes is never answered, so its frame waited out FRAME_CAPTURE_S (10 s) and went missing, failing the run as an infrastructure failure. #650's retry catches the browser refusing a capture of a session already gone; this is the capture already in flight. While a frame's capture waits, the control now checks that the tab's session is still there. If it went away, the capture is dropped and asked again, within the same budget, of the tab the browser has then. Adds two integration tests, each reproducing one failure against a real browser computer: - a recording that ends while an agent's command is in flight, which #650 fixed: it fails on the main before #650 - a tab that closes while its frame's capture waits: it fails on main and on #650, and passes here Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
earakely-scale
deleted the
edgararakelyan/browser-frame-tab-closes-mid-capture
branch
November 12, 2026 22:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A follow-up to #650: a frame whose tab closes while its capture is in flight is now taken of the tab that's left, instead of going missing and failing the run.
Testing #650 end to end turned up a third way to lose a frame. When a tab closes while its frame's capture is waiting, Chrome never answers the capture. The frame waited out its whole budget,
FRAME_CAPTURE_S(10 s), and went missing, failing the run as an infrastructure failure.#650's retry doesn't cover this. It handles the browser refusing a capture of a session that's already gone (
Session with given id not found). Here the capture is already in flight when the tab goes, so no refusal ever comes back.What changes
BrowserControl._nudged_capturewaits for its captures in 0.25 s slices. Between slices it checks that the tab's session is still there. Once it's gone with no capture answered, it stops waiting (_TabGone).BrowserControl.framethen asks again, within the same budget, of the tab the browser has by then: the tab's new session, else the active tab's. This is the same path fix(browser-recording): a recording ends complete when an action is still going, or a tab's session went away #650 added for a refusal, and a frame of a closed tab already went to the active tab.Test plan
test_browser_recording.py): a frame whose tab closes while its capture waits is taken of the tab left, well within its budget.browser_computer_test.py): two new tests, each reproducing one failure.mainbefore fix(browser-recording): a recording ends complete when an action is still going, or a tab's session went away #650, the log is missing 5 entries.main, and onmainwith fix(browser-recording): a recording ends complete when an action is still going, or a tab's session went away #650, frame 2 is missing:the tab painted nothing within 10 s.Docs
None beyond #650's: a frame waits up to 10 s, and now also outlasts its tab closing mid-capture.
🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge.Summary
The PR recovers recording frames when their tab closes during capture.
No actionable issues were found. Tests were not run during this review.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Capture frame] --> B{Capture answered?} B -->|Yes| C[Return image and captured tab] B -->|No| D{Session still present?} D -->|Yes| B D -->|No| E{Budget remains?} E -->|No| F[Report missing frame] E -->|Yes| G[Cancel pending captures] G --> H[Choose replacement session or active tab] H --> AReviews (1) · Last reviewed commit: "fix(browser-recording): a frame whose ta..." · Reviewed by Greptile