Repository navigation
fork: agent recordings keep a steady frame rate and fail fast on a hidden tab - #55
Merged
Merged
Conversation
…dden tab The recording encoder painted only when a screencast frame or cursor move arrived, so a still page recorded at a few frames a second with long gaps. It now repaints the newest frame at the recording's frame rate, and drops a frame whose decode finishes after a newer one's. A recording's first capture is now bounded at 5 seconds. A tab T3 cannot draw used to hold the start, and the tab's capture lock, until the request timed out; it now fails with an error that says what to do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3mdistal
force-pushed
the
fix/preview-recorder-frames
branch
from
November 14, 2026 11:24
528a5aa to
b557d3d
Compare
…ecorder ends the repaint Review follow-ups for the steady-frame-rate patch: - startRecording opens the recording's CDP session before the first frame and captures over it. A capture a hidden tab never answers used to stay pending on the tab's shared session after the 5 s limit; now the failed start detaches the session, which rejects it. - The encoder clears its repaint timer when the MediaRecorder stops on its own (an encoding error), not only in stop()'s active branch. - Tests: a failed first frame detaches its own session and a retry starts; a recorder that stops on its own stops repainting; the first-frame limit stays pending until 5 s. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`invoke` without a type parameter succeeds with `unknown`, so `Effect.flip` gave the test an `unknown` error channel, which the Effect language service rejects in typecheck. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Owner
Author
|
Landing this on Alice's word. At 8:29 AM ET on Nov 14, 2026, in the T3 thread "big triage" (7542db79-62fe-4b84-a00b-20de26d78285, message 5b6200d0-528f-43a6-8b18-d704999836ec), she wrote "land all of those". That answered a list of rows waiting on a land word, and its first item was this one, the T3 recorder fix. At merge time the head is 0cd5f6e. All 17 checks pass, the branch is up to date with fork/main, and no review threads are open. |
3mdistal
added a commit
that referenced
this pull request
Nov 21, 2026
…dden tab (#55) * fork: agent recordings keep a steady frame rate and fail fast on a hidden tab The recording encoder painted only when a screencast frame or cursor move arrived, so a still page recorded at a few frames a second with long gaps. It now repaints the newest frame at the recording's frame rate, and drops a frame whose decode finishes after a newer one's. A recording's first capture is now bounded at 5 seconds. A tab T3 cannot draw used to hold the start, and the tab's capture lock, until the request timed out; it now fails with an error that says what to do. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fork: a recording's first frame uses its own session, and a stopped recorder ends the repaint Review follow-ups for the steady-frame-rate patch: - startRecording opens the recording's CDP session before the first frame and captures over it. A capture a hidden tab never answers used to stay pending on the tab's shared session after the 5 s limit; now the failed start detaches the session, which rejects it. - The encoder clears its repaint timer when the MediaRecorder stops on its own (an encoding error), not only in stop()'s active branch. - Tests: a failed first frame detaches its own session and a retry starts; a recorder that stops on its own stops repainting; the first-frame limit stays pending until 5 s. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fork: type the failed recording start in its test `invoke` without a type parameter succeeds with `unknown`, so `Effect.flip` gave the test an `unknown` error channel, which the Effect language service rejects in typecheck. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
3mdistal
added a commit
that referenced
this pull request
Nov 21, 2026
…dden tab (#55) * fork: agent recordings keep a steady frame rate and fail fast on a hidden tab The recording encoder painted only when a screencast frame or cursor move arrived, so a still page recorded at a few frames a second with long gaps. It now repaints the newest frame at the recording's frame rate, and drops a frame whose decode finishes after a newer one's. A recording's first capture is now bounded at 5 seconds. A tab T3 cannot draw used to hold the start, and the tab's capture lock, until the request timed out; it now fails with an error that says what to do. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fork: a recording's first frame uses its own session, and a stopped recorder ends the repaint Review follow-ups for the steady-frame-rate patch: - startRecording opens the recording's CDP session before the first frame and captures over it. A capture a hidden tab never answers used to stay pending on the tab's shared session after the 5 s limit; now the failed start detaches the session, which rejects it. - The encoder clears its repaint timer when the MediaRecorder stops on its own (an encoding error), not only in stop()'s active branch. - Tests: a failed first frame detaches its own session and a retry starts; a recorder that stops on its own stops repainting; the first-frame limit stays pending until 5 s. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fork: type the failed recording start in its test `invoke` without a type parameter succeeds with `unknown`, so `Effect.flip` gave the test an `unknown` error channel, which the Effect language service rejects in typecheck. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
3mdistal
added a commit
that referenced
this pull request
Nov 26, 2026
Upstream v0.1.12 (pingdotgg#42445) repaints the newest frame of an agent's recording at the recording's frame rate, which is what this patch used to add, so the fork cut it to what upstream still lacks: upstream's repaint timer stops when the recording stops or grows too large, but not when the MediaRecorder stops on its own, as on an encoding error. The recorder's onstop now clears it too. The test that a still page repaints at the frame rate went with the cut; upstream's own tests cover it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3mdistal
added a commit
that referenced
this pull request
Nov 26, 2026
Upstream v0.1.12 (pingdotgg#42445) repaints the newest frame of an agent's recording at the recording's frame rate, which is what this patch used to add, so the fork cut it to what upstream still lacks: upstream's repaint timer stops when the recording stops or grows too large, but not when the MediaRecorder stops on its own, as on an encoding error. The recorder's onstop now clears it too. The test that a still page repaints at the frame rate went with the cut; upstream's own tests cover it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3mdistal
added a commit
that referenced
this pull request
Nov 26, 2026
Upstream v0.1.12 (pingdotgg#42445) repaints the newest frame of an agent's recording at the recording's frame rate, which is what this patch used to add, so the fork cut it to what upstream still lacks: upstream's repaint timer stops when the recording stops or grows too large, but not when the MediaRecorder stops on its own, as on an encoding error. The recorder's onstop now clears it too. The test that a still page repaints at the frame rate went with the cut; upstream's own tests cover it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3mdistal
added a commit
that referenced
this pull request
Nov 26, 2026
Upstream v0.1.12 (pingdotgg#42445) repaints the newest frame of an agent's recording at the recording's frame rate, which is what this patch used to add, so the fork cut it to what upstream still lacks: upstream's repaint timer stops when the recording stops or grows too large, but not when the MediaRecorder stops on its own, as on an encoding error. The recorder's onstop now clears it too. The test that a still page repaints at the frame rate went with the cut; upstream's own tests cover it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3mdistal
added a commit
that referenced
this pull request
Nov 26, 2026
Upstream v0.1.12 (pingdotgg#42445) repaints the newest frame of an agent's recording at the recording's frame rate, which is what this patch used to add, so the fork cut it to what upstream still lacks: upstream's repaint timer stops when the recording stops or grows too large, but not when the MediaRecorder stops on its own, as on an encoding error. The recorder's onstop now clears it too. The test that a still page repaints at the frame rate went with the cut; upstream's own tests cover it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3mdistal
added a commit
that referenced
this pull request
Nov 30, 2026
Upstream v0.1.12 (pingdotgg#42445) repaints the newest frame of an agent's recording at the recording's frame rate, which is what this patch used to add, so the fork cut it to what upstream still lacks: upstream's repaint timer stops when the recording stops or grows too large, but not when the MediaRecorder stops on its own, as on an encoding error. The recorder's onstop now clears it too. The test that a still page repaints at the frame rate went with the cut; upstream's own tests cover it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Problem
Agents record the preview with
preview_recording_startandpreview_recording_stop, and Alice cuts those videos into clips for review docs by timestamp. A recording of a mostly still page came out at a few frames a second, with long stretches holding no frame at all: her recent agent recordings averaged 0.5–5 fps, with gaps of up to 55 seconds. A cut at a given second landed on whatever frame came before it, so clips around a click showed the wrong moment or froze.Separately, a recording started on a tab T3 couldn't draw, such as while T3's window was minimized, hung until the request timed out after 15 seconds, with no hint why. The hung start also held the tab's capture lock, so the tab's snapshots and later recordings waited behind it until the tab painted again.
Approach
A steady frame rate. The recorder gets frames from Chromium's screencast, which sends one only when the page changes. The server paints each one into a canvas in a hidden encoder page, and a
MediaRecorderrecords the canvas's stream. That stream produces a video frame only when the canvas is painted, so a still page produced none. The encoder now repaints its newest frame on a timer at the recording's frame rate (30 or 60 fps, from settings). A still stretch records as repeated frames, so a time in the file matches the time on the clock. The click ring, which had its own timer, now fades on those repaints. If theMediaRecorderstops on its own, as on an encoding error, the repaint timer stops with it.The newest frame wins. Each screencast frame is decoded on its own, and a large frame can finish decoding after a smaller, newer one. The encoder painted whichever finished last, so an older look could replace the page for a moment, like a menu that seems to reopen after it closed. Each frame now carries the order it arrived in, and one that finishes after a newer one is dropped. I didn't find this flash in Alice's recordings, so this fixes a real race rather than a confirmed cause of what she saw.
A clear failure on a tab that never paints. A recording starts by capturing the tab once, so a stop right away still has a frame to encode. That capture had no time limit. It now waits 5 seconds at most, then fails with this error, which releases the tab's lock:
The Chrome DevTools Protocol (CDP) has no way to cancel a screenshot request. So the first capture now goes over the recording's own CDP session, which
startRecordingopens first, instead of the tab's shared one. A failed start already detaches that session, and detaching it rejects the unanswered capture. Without this, each retry on a hidden tab would leave another screenshot pending on the tab's session.What changed
apps/server/src/preview/ServerBrowserPage.ts: the repaint timer (cleared on stop and when the recorder stops on its own) and arrival-order check inrecordingEncoderScript, and a newrecordingFirstFramethat bounds the first capture.apps/server/src/preview/ServerBrowser.ts:startRecordingopens the recording's CDP session first and takes its first frame over it withrecordingFirstFrame.apps/server/src/preview/ServerBrowserPage.fork.test.ts: new tests.apps/server/src/preview/ServerBrowser.test.ts: upstream's encoder sandbox gets no-op timer stubs, since its tests feed frames by hand, and onefork:test for a failed first frame.FORK.md: a Patches entry.What users will notice
These change recording output that users and agents see. I recommend keeping all three.
The frame-rate setting itself is unchanged; recordings now actually hold it.
Safety and operations
No persisted data, setting or wire contract changes, so stock T3 still opens the fork's data, and rollback is reverting the commit. The encoder runs in the server's headless Chromium for both server and desktop tabs, so desktop recordings change the same way.
Verification
ServerBrowserPage.fork.test.tsruns the real encoder script with a fake canvas and fake timers. Each test fails without its fix and passes here:fork/main: none);fork/main, paint order was[1, 3, 2]: the older frame last);fork/mainthere was no limit);MediaRecorderstops on its own, a second passes with no repaints (the PR's first commit kept repainting).fork:test inServerBrowser.test.tsfails the new session's first screenshot. It checks that the screenshot went over that session, that the failed start detached it, and that a second start succeeds. It fails on the PR's first commit, where the first frame used the tab's session.vp test runpassesServerBrowser.test.ts(49 tests, including the existing recording tests) and the new file (4).vp run check:changed origin/fork/mainon the PC passed format, lint, knip and typecheck (3 packages) on the PR's first commit. For the review follow-up commit, the pre-push format, lint and knip checks passed, and Fork CI runs the typecheck. The test files beside the change pass, exceptServerBrowserPage.test.ts, which can't start a browser on the PC because Playwright's pinned Chromium build isn't installed there. This PR doesn't touch that file; Fork CI runs it.A review by Sol (OpenAI's gpt-6.1-sol) found the pending-capture and recorder-stop gaps. Both are fixed in the second commit. It found the other paths sound: normal and size-limit stops clear the timer, a failed start closes the encoder and releases the lock, and the encoder's timer isn't throttled, because Playwright launches its headless Chromium with background throttling off.
Review focus
Written by Claude Opus 5.5 in Claude Code, running in T3 Code.
🤖 Generated with Claude Code