Skip to content

fix(android): recognize exited screenrecord processes - #4450

Merged
thymikee merged 2 commits into
callstack:mainfrom
shamilovtim:codex/android-recorder-exited-identity
Nov 12, 2026
Merged

thymikee merged 2 commits into
callstack:mainfrom
shamilovtim:codex/android-recorder-exited-identity

Conversation

@shamilovtim

@shamilovtim shamilovtim commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Android record stop can reject a finished clip while screenrecord remains unreaped. This four-file fix recognizes valid zombies as exited, confirms disappearance after failed or unparseable identity reads, and keeps interrupted probes uncertain. Read current start time after command line before signalling a live writer.

The daemon scenario covers running and zombie recorders. Transport coverage retains exact-path/PID-reuse guards and proves the disappearing writer candidate is actually inspected. One documentation sentence is added.

Fixes #4449.

Validation

Tested 481db79 against 2deb909:

  • Ordinary built CLI/daemon stop on a real unreaped recorder: baseline fails ownership confirmation; candidate returns stopped/confirmed/retired and collects its original video. The actual PID/start time remain consistent through start, real Z/empty-argv pre-stop inspection and cleanup; neither daemon nor parent signals the exited child, which is reaped afterward.
  • Separate healthy built CLI and real-ADB source-transport controls pass. Full focused suites: 24 transport and 10 daemon passes. New tests reproduce three failures on prior c228017; the writer-scan mutant fails and restored coverage passes.
  • Exact clean unchanged affected gate: all 11 runnable checks pass; 19,186 unit passes, three existing skips, 330 related and 12 command-docs passes.

Commands, source/build pins, receipts and original footage. Footage shows the completed Android artifact; typed real CLI/ADB results establish subsequent host stop/collection. All failed setup attempts are retained and classified. All 16 checks at 481db79 are terminal: 14 successes and two conditional skips.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff

@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

@thymikee

Copy link
Copy Markdown
Member

The code review at c228017 found a missing live validation. CI reports 16 passing checks and no nonpassing checks; I could not independently inspect the local receipt. There are no known conflicts.

The mocked ADB regression does not establish that an exited, unreaped recording process stops and exports successfully through the daemon. Could you provide accessible evidence at this commit for an Android recording with its PID and start time, real /proc state Z and empty cmdline before ordinary record stop, a successful stopped response and collected playable video, no signal to the zombie, and completed native cleanup? Please include the commands, device and API level, and source and build pins. Recording stop

The process disappearance thread still applies, as does one lower-priority thread.

Before merge, please address or explicitly disposition the process disappearance thread and provide the live stop and collection evidence. The lower-priority thread is a nonblocking coverage note.

@shamilovtim

Copy link
Copy Markdown
Contributor Author

In response to the live validation request:

The missing composed native case is now covered at 481db79. Accessible evidence includes the executed fixture/commands, complete generated runtime/build pins, native helper hashes, emulator model/API, original playable capture, selected ordinary CLI results and cleanup attestations.

The built CLI performs an ordinary recording start, capturing the actual live child PID/start time in its production manifest. A pinned native parent retains that real screenrecord child after its successful timed exit. Immediately before ordinary record stop, real ADB observes the same PID/start time, state Z and empty cmdline. Only that native launch is controlled; process reads, stop, collection and export are unmodified.

Candidate stop returns stopped, confirmed and retired, removes the native chunk, and collects the unchanged original video. The exited child remains until its parent reaps it; both delegated daemon commands and parent cleanup record zero signals to it. Close and daemon stop also succeed. The same composed baseline case fails ordinary stop with the ownership error. Its later close cleanup occurs after parent reaping and can recover export; that is recorded separately.

Actual device/process identifiers are replaced by consistent generic markers in public evidence; source assertions and original private receipts preserve their equality. Both review threads are addressed in this revision. The earlier source-only transport comparisons retain their actual c228017 and 481db79 source attribution and are separate from this composed daemon case.

@thymikee

Copy link
Copy Markdown
Member

This PR is ready at 481db79. The findings from the earlier review (#4450 (comment)) are now fixed, and no new problems remain. Not blocking, and you can take or leave it: test -d /proc/<pid> now treats a signal-ended result as uncertain, but probeRemotePath (https://github.com/callstack/agent-device/blob/481db79/src/platform-runtime-screen-recording-android-host.ts#L30-L36) and the manifest probe in readManifest still read exit 1 with empty stderr as absent. I found no sign that production adb returns exit code 1 together with a signal. If that shape is legal, one owner could classify a probe result as present, absent or uncertain for all three sites. Otherwise the signal branch can go.

The two earlier review threads are fixed at this head, so please resolve them: the presence recheck after inconclusive reads (#4450 (comment)) and the PID 45 scanner test (#4450 (comment)).

CI is green with 16 checks and none failing. I did not run the tests or the mutants locally. I read the live evidence from your public pages only, so the Z and empty-cmdline observation and the zero-signal counts rest on your attestation and the README. No conflicts are known. Nothing else blocks merge, but a maintainer may spot-check a composed-cli-481 RESULT.json first.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 12, 2026
@thymikee
thymikee merged commit 0054479 into callstack:main Nov 12, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android record stop rejects unreaped exited screenrecord processes

2 participants