Skip to content

fix(mobile): share pending screen recording stops with cleanup - #1559

Merged
okwasniewski merged 2 commits into
e2e-inc:mainfrom
shamilovtim:codex/mobile-share-recording-stop
Nov 5, 2026
Merged

okwasniewski merged 2 commits into
e2e-inc:mainfrom
shamilovtim:codex/mobile-share-recording-stop

Conversation

@shamilovtim

@shamilovtim shamilovtim commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor
  • 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]
Loading

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.

Case main e99a6fa this branch
SDK stop commands in the built CLI 2 1
Ending the attempt CLEANUP_TIMEOUT completes
Original stop-wait timeout and exit 3 retained retained
Deterministic cancelled waiter + concurrent caller + cleanup 3 SDK stops, fails 1 SDK stop, passes
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-actions github-actions Bot added the size:S Up to 29 changed lines, not counting tests, fixtures, translated docs, or the lockfile label Nov 4, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread packages/mobile/src/surface.ts Resolved
@github-actions github-actions Bot 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
@shamilovtim

Copy link
Copy Markdown
Contributor Author

[Codex] responding on behalf of shamilovtim

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.

@okwasniewski

Copy link
Copy Markdown
Member

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.

@okwasniewski

Copy link
Copy Markdown
Member

thanks!

@okwasniewski
okwasniewski merged commit 8f425b1 into e2e-inc:main Nov 5, 2026
26 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 5, 2026
kblok added a commit to hardkoded/e2e-dotnet that referenced this pull request Nov 5, 2026
@shamilovtim
shamilovtim deleted the codex/mobile-share-recording-stop branch November 5, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for Human Review size:M Up to 99 changed lines, not counting tests, fixtures, translated docs, or the lockfile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mobile: cancelled recording-stop wait can repeat finalization during cleanup

2 participants