Skip to content

fix: viewer stop signals zombie leaders with live threads; share the presence rule - #336

Merged
ElbertePlinio merged 3 commits into
mainfrom
fix/329-335-zombie-presence
Oct 12, 2026
Merged

ElbertePlinio merged 3 commits into
mainfrom
fix/329-335-zombie-presence

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

The viewer stop now signals a zombie Chrome leader or member that still has live threads, using the same presence rule as the verified group stop. Before this change it sent no signal and failed with "Viewer processes are still alive". Two new core helpers, readPresentProcessIdentity and presentProcessIdentityMatches, apply that rule. An orphaned zombie member shows an empty cmdline, so its viewer profile is now read through a live thread. Containment now uses the shared statCountsAsPresent rule from proc.ts instead of its own copy. The ownership checks (processIdentityMatches, readProcessIdentity, identityIsAlive) still treat every zombie as dead.

Closes #329
Closes #335

Requirement Verified by Scenario Result Evidence
#329: the viewer stop signals a verified zombie leader with live threads Automated test, real kernel A python3 leader calls pthread_exit while another thread runs (State Z, Threads 2). Then stopSessionViewer runs. No failures, the group is empty, and the launch profile is removed "stops a zombie leader with a live thread and removes the launch" in viewer-state.test.ts. It fails on main with "Viewer processes are still alive".
#329: the same for a member Automated test, real kernel A Node leader starts a zombie-with-thread member that has the profile in its arguments, then the leader exits and is reaped The member is signalled and the launch is removed "stops an orphaned zombie member with a live thread and removes the launch". It fails at 5ebf50b with "still alive".
#329: signal safety Unit tests and review Z with 2 threads, Z with 1 thread, EPERM stat, and different start ticks. The identity recheck stays the last /proc read before each signal. Only a present identity with the same start ticks matches. EPERM never matches. proc.test.ts "reads a present identity for %s". Both reviewers confirmed the invariant.
#335: one shared helper used in containment Code Every copy of the rule in containment.ts now calls statCountsAsPresent Done Diff
#335: behaviour unchanged Existing tests proc, containment and containment-cgroup-sim run without test edits Pass Focused run, 236 tests
Repo checks Full suite with coverage, build, tsc, oxlint, PickCheck PICKFORGE_REQUIRE_BROWSER=1 vitest run --coverage at 94dfe9c 3110 passed, 6 skipped. Build, typecheck and lint pass. PickCheck reports no violations. Local run

QA pass skipped: this changes internal viewer teardown, with no UI or CLI output to drive. The real-kernel tests run the stop end to end.

@pickforge/core gains two exports, used by desktop-linux. Only packages/cli is published, so no public API changes.

Reviews: Astra (xhigh) and Fable (xhigh). Both found that an orphaned zombie member was still skipped. Fable also asked for direct helper tests. Both were fixed in 94dfe9c, and both reviewers confirmed the fixes with no new findings.

…ainment

Export statCountsAsPresent from proc.ts and use it in containment.ts instead of the copied zombieIsGone and num_threads checks.

Closes #335
The viewer stop checked identities with processIdentityMatches and readProcessIdentity, which treat every zombie as dead. A Chrome leader that is a zombie with live threads was never signalled, so the stop timed out.

Add readPresentProcessIdentity and presentProcessIdentityMatches to core with the group stop rule and use them for the viewer signals. The identity recheck stays the last read before each signal.

Closes #329
@ElbertePlinio
ElbertePlinio merged commit 139edfa into main Oct 12, 2026
10 checks passed
@ElbertePlinio
ElbertePlinio deleted the fix/329-335-zombie-presence branch October 12, 2026 17:01
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