fix(android): warn about the 180s record limit only when the last chunk ended early - #2636
Merged
Merged
Conversation
…nk ended early stopOwnedChunks OR-ed every chunk's already-exited result, and rotation always ends every earlier chunk before record stop, so every chunked recording got the 'stopped before record stop' truncation warning. Only the active (last) chunk exiting before stop means the video ends early; recovery already judged that from chunks.at(-1).
Size Report
Startup median (7 runs, lower is better):
|
Member
Author
|
Reviewed at e736fdd. Clean. The live emulator run in the PR body (218 s, two chunks, no limit warning) exercises this route. All checks pass and there are no conflicts. |
thymikee
deleted the
fix/android-record-limit-warning-rotated-chunks
branch
September 15, 2026 15:35
|
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
Every chunked Android recording (over 170 s) returned the truncation warning:
The next chunk recorded those interactions, so the warning was wrong. Seen live on 2026-09-15: a 197 s recording returned chunks
and.mp4(188.6 s) andand.part-002.mp4(47.9 s), plus both the chunked warning and this limit warning. The bug is on main; #2613 and #2631 did not add it.Cause
stopOwnedChunkscombined every chunk'sstopChunkresult with OR. Rotation (runtime.ts) starts the next chunk and then stops the previous one. So atrecord stop, every earlier chunk always reportsalready-missing, andreachedLimitwas alwaystruefor a chunked recording.Fix
stopOwnedChunksnow returns the result for the active (last) chunk only. That is the only chunk that must still record at stop. Earlier chunks end because of rotation. The reattach path already used this rule:recovery.tsinspects onlychunks.at(-1).Tests
In
chunks.test.ts, both tests go through the livefinishpath:omits the 180s limit warning when only a rotated-out chunk exited before record stop: two chunks, chunk 1 exited (rotation stopped it), chunk 2 still runs at stop. The result has the chunked warning and no limit warning.warns about the 180s limit when the last chunk exited before record stop: the only chunk exited before stop, and in a second case chunk 2 of 2 exited before stop. Both results have the warning.Mutations I ran by hand:
activeAlreadyExited = alreadyExited || activeAlreadyExited): the omits test fails.const active = chunks[0]: the omits test fails.return false: the warns test fails. The recovery tests still pass under this mutation because recovery passes its ownreachedLimit. The warns test is the only test of the live path.Live validation
I booted a separate emulator (
Pixel_9_Pro_XL_API_37, port 5590, notPixel_7_CI) and used a source CLI with an isolated state dir. I opened Settings, startedrecord start, scrolled every 10 s, and ranrecord stopafter 218 s.live.mp4171.6 s andlive.part-002.mp439.4 s (ffprobe).warning: "Android adb screenrecord is capped at 180s, so this recording was split into multiple MP4 chunks. Android screenrecord encodes a frame only when the screen changes, so this video ends at the last frame it encoded: it covers 211.0s of the 222.6s recording window." The limit warning is not in it.Checks
pnpm formatdone.pnpm check:affected --runstops at lint only because of.claude/workflows/agent-device-pr-review.mjs. That file is gitignored, the local harness makes it, and it is not in this diff. I ran each selected gate by hand. All pass:oxlint . --deny-warnings --ignore-pattern '.claude/**',typecheck,check:layering,check:fallow --base origin/main,build,vitest related. The Android recording unit suite passes (85 tests).