You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mobile): share pending screen recording stops with cleanup - #1559
Keep one screen-recording stop in flight across cancelled callers and attempt cleanup. A confirmed completion clears the recording; an actual SDK failure permits a later retry.
Preserve cancellation before dispatch, document cleanup behavior, and add the patch changeset.
flowchart LR
A[Stop requested] --> B[Shared device stop]
A --> C[Caller cancels its wait]
C --> D[Attempt cleanup]
D --> B
B --> E[Clear recording on success]
Ran it locally: yes, the built CLI and compiled mobile engine over a simulated SDK, with real subprocess workers. A 750 ms finalization response exceeds the caller's 500 ms cleanup budget.
main: stopping the video timed out; ending the attempt timed out
this branch: stopping the video timed out
Cancellation and actual-stop-failure retry cases pass, including cleanup entering between SDK rejection and adapter state updates. Mobile build/typecheck, repository lint, and all 494 mobile unit tests pass. The public reproduction commands are in Mobile: cancelled recording-stop wait can repeat finalization during cleanup #1558.
The full local workspace gate has not completed. Dead-code checking on the partial workspace install reports identical findings on main and this branch.
Simulator benchmarks, native daemon behavior, and actual media were not exercised. The simulated SDK establishes adapter lifecycle behavior.
github-actionsBot
added
size:M
Up to 99 changed lines, not counting tests, fixtures, translated docs, or the lockfile
and removed
size:S
Up to 29 changed lines, not counting tests, fixtures, translated docs, or the lockfile
labels
Nov 4, 2026
CI is green and no review threads remain at ae2d8ed. A temporary checkout combining the current heads of #1557, #1559, #1561 and #1564 passes all 516 mobile tests, build, typecheck and focused lint.
This account has read access and cannot apply the Ready for Human Review label. A maintainer with label permission will need to apply it.
Automated review by Claude Code on behalf of maintainers.
Thanks. Bug confirmed on main: a cancelled stopVideo loses the post-stop bookkeeping, so endAttempt (or a second caller) sends another stop. Moving the bookkeeping onto the shared, tracked SDK promise is the right fix. Typecheck and engine tests pass, mutation testing kills every key change, and it merges cleanly with #1557, #1561, #1564. Labeling ready for human review.
Optional suggestions:
surface.ts:269 vs 279: stopping now means two things. The lease one clears in finally; the screen one keeps the resolved promise, and endAttempt depends on that because it captures dangling before settleInflight. Could endAttempt re-check this.recording === dangling after settling, so both fields clear in finally and mean the same?
surface.ts:701: the one-line .then(ok, err) chain is hard to scan. An async closure inside this.track(...), like stopLeaseRecording, reads better.
docs/reference/mobile.mdx: the new paragraph is internal lifecycle detail; consider dropping it or cutting to one sentence.
Changeset: describe what users see (a cancelled video stop no longer sends a second stop at attempt end, which could time out attempt cleanup).
engine.test.ts: the next-attempt / no-sessions.close check is duplicated; a small helper would do.
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
Ready for Human Reviewsize:MUp to 99 changed lines, not counting tests, fixtures, translated docs, or the lockfile
2 participants
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.
Issue
Fixes #1558.
Verified
Ran it locally: yes, the built CLI and compiled mobile engine over a simulated SDK, with real subprocess workers. A 750 ms finalization response exceeds the caller's 500 ms cleanup budget.
e99a6faCLEANUP_TIMEOUT