Skip to content

fix: prune orphan stopped.json temps and wait for Xvfb exit in rollback - #319

Merged
ElbertePlinio merged 5 commits into
mainfrom
fix/315-318-retention-xvfb-flake
Oct 9, 2026
Merged

ElbertePlinio merged 5 commits into
mainfrom
fix/315-318-retention-xvfb-flake

Conversation

@ElbertePlinio

@ElbertePlinio ElbertePlinio commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Closes #315
Closes #318

Session retention now removes orphan stopped.json temp files. Other unknown files still block pruning. Xvfb startup rollback now waits for the spawned Xvfb's exit event before it reports cleanup as confirmed.

#318 is a product bug. The verified group stop treats a zombie leader as gone, but a multi-threaded process can still have a live thread at that point. The fake Xvfb is a Node process, so rollback could return while it still existed.

Requirement Verified by Scenario Result Evidence
#315: remove orphan stopped.json temps on retain Automated test Orphan temp blocks pruning, a later retain removes it, then the session is pruned Pass; the test fails without the fix packages/core/test/session-retention.test.ts, worker report
#315: keep refusing other unknown files Automated test .stopped.json.tmp-notes and a directory with a temp-like name stay and block pruning; the existing unknown-data test is unchanged Pass same
#315: test for orphan temp pruning Automated test As above Pass same
#318: reproduce under load Manual check Concurrent runs plus busy loops: 0 of 200 failed without amplification. With a 2 GB fake Xvfb heap: 5 of 12 and 23 of 24 failed Reproduced with amplification worker report
#318: fix product or test Manual check, automated test /proc/<pid>/stat showed Z with 2 threads at each failed assertion. Fix in display.ts cleanupPartialStart 0 of 12 and 0 of 24 failed after the fix under the same amplification worker report
#318: keep the stop assertion Code check packages/browser/test/session.test.ts is unchanged Kept diff
Review fix: overlapping retains keep each other's temp Automated test Two retains of one session, first rename paused while the second runs; fails on 31dc200 with ENOENT Pass session-retention.test.ts, Astra recheck
Review fix: deterministic test of the Xvfb exit wait Automated test Owned child exits: cleanup confirmed. Mocked stop reports terminated without a signal: unconfirmed after 2 s Pass display-identity.test.ts, Fable recheck
Repo checks Automated build, lint, typecheck, PICKFORGE_REQUIRE_BROWSER=1 coverage: 3077 passed, 6 skipped at b3fcd8b Pass worker report
PickCheck Automated --base origin/main --fail-on new,worsened,unmatched Pass pickcheck.txt

Evidence is in ~/Artifacts/pickforge-batch6-2026-10-09/ on the build host.

No device pass: both changes are internal cleanup paths with nothing to drive, and the automated tests cover them.

Follow-ups: #320 (verified group stop accepts a zombie leader with live threads) and #321 (serialize Android teardown per session).

A teardown killed between the marker temp write and its rename left a
.stopped.json.tmp file that blocked pruning forever. Retaining logs now
removes those temps next to the lease staging files. Other unknown
entries still block pruning.

Closes #315
stopProcessGroupVerified treats a zombie group leader as gone even
while the process's other threads still exit. Xvfb startup rollback
then reported cleanup as confirmed and returned while the spawned
process was a zombie with a live thread. An aborted browser create
could return with the Xvfb pid still present.

Rollback now also waits for the owned child's exit event before it
confirms cleanup. If the exit does not arrive in time, cleanup stays
unconfirmed.

Closes #318
An overlapping retain for the same session deleted the other retain's
marker temp before its rename. Delete a marker temp only when its pid
is not this process and is not alive.
@ElbertePlinio
ElbertePlinio merged commit 27ba1ec into main Oct 9, 2026
10 checks passed
@ElbertePlinio
ElbertePlinio deleted the fix/315-318-retention-xvfb-flake branch October 9, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant