Repository navigation
test: tolerate host systemd child subreaper in procevent and session-lock tests - #7044
RooseveltAdvisors wants to merge 2 commits into
Conversation
…ssion-lock tests Accept a child subreaper registered by systemd directly below init as a valid orphan reaper alongside init itself. On hosts running a user-level process manager (such as systemd --user), orphaned processes are adopted by the per-user subreaper rather than reparenting directly to PID 1. Recognize this hierarchy by checking if the process parent is PID 1 or if its parent is a direct child of PID 1, matching the existing helper in tests/fm-remote-job-orphan-reap.test.sh.
|
Pushed b3917e72ad (fast-forward, no rebase): cherry-picked the two test-only commits d3da8cfcef (pin the clock in the lifecycle block) and beefb22552 (reset gauge fixture), then a plain merge of origin/staging to pick up the mixed-version harness fix (#7038). The fix itself is untouched: the services/control-plane/src diff against staging is byte-identical before and after. |
|
/ocr review |
|
Speaking as Kun's firstmate: thank you @RooseveltAdvisors, and sorry this sat untriaged for a while. A desktop Linux host with What I checked at One small, optional note, not blocking: the grandparent check is a bit wider than "adopted by a subreaper". It would also pass for a process whose parent is still alive, if that parent happens to sit directly under PID 1 (for example a test shell launched straight by a container's init). In these fixtures the parent you're waiting on is a launcher or daemon that the test ends first, so I don't see a false pass here. If you ever want it tighter, you could also check that the parent is no longer the original launcher pid. Contract-class: restore (my own read). These suites are meant to pass on an ordinary Linux host, and on subreaper hosts they didn't. The product's unconfigured behaviour doesn't change. VISION: One captain: n/a · Authority: n/a · Scripts vs judgment: aligns · Restart: n/a · Delegation: aligns (the tests that guard orphan reparenting keep working on more hosts) · Vendor: aligns (not tied to one init setup) · Scope: aligns (this repo's own validation). CI: the only red on this head is Behavior portable serial 2 from 2026-10-11. It was cancelled at the 30-minute job cap, not failed by a test. That's a shard-size problem on our side. Main's CI is also currently red from the ubuntu 26.04 runner move, and that's ours too, not yours. A fix is pending. Status: waiting on CI, and nothing is needed from you. Once main is fixed we'll rerun this, and when it's green and clean it can merge. |
…2 shard failure (pr-babysit flake triage, corr=fm-9etlh)
[Low impact] The PR appears safe to merge. Reviews (1) · Last reviewed commit: "ci: retrigger checks after stale 2026-10..." · Reviewed by Greptile |
Intent
Tolerate host systemd child subreaper in procevent and session-lock-ancestry test suites
What Changed
is_orphaned <pid>helper totests/fm-procevent.test.shandtests/fm-session-lock-ancestry.test.sh. It treats a process as orphaned when its parent is PID 1, or when its parent is a subreaper one hop below init (for examplesystemd --user). Before this change, both tests requiredppid == 1.is_orphaned. On hosts where a per-user systemd manager adopts orphans, the fixture no longer fails.session.sh,daemon.shandfrontend.shscripts now carry an inline copy of the helper and use it in their wait-for-orphan loops. The recycled-chain test also uses it to wait for and assert the pty-host's reparenting.Risk Assessment
✅ Low: Test-only change: the old checks required the orphaned process's parent to be PID 1 exactly. The new is_orphaned helper also accepts a parent whose own parent is PID 1, such as a
systemd --usersubreaper. I traced each fixture's launch chain (bash -c '... &'launchers and procevent reconcile). Before reparenting, the immediate parent's parent is the test shell or a fixture process, not init, so the wider check cannot pass early. In the session-lock suite the old wait loops simply timed out after 10s and continued, so the only behavior change there is a faster wait. The change matches the stated intent.Testing
This host has a
systemd --userchild subreaper, so it reproduces the problem. I ran each suite at the base commit and at the fix. Before the fix, the session-lock-ancestry suite failed with "the pty-host was not reparented to init". The procevent suite failed with "the listener under test was not reparented away from its session (ppid 2896748)". After the fix, both suites pass in full with exit 0: session-lock-ancestry took 43s and procevent took 621s. That includes the reparented-listener and recycled-chain e2e cases. I did not run the full repository suite. This change only touches tests, so there is no UI surface to capture. The temporary base copies were removed and the worktree is clean.Evidence: procevent suite before fix (fails under subreaper)
Source: procevent suite before fix (fails under subreaper)
not ok - the listener under test was not reparented away from its session (ppid 2896748) EXIT=1Evidence: procevent suite after fix
Source: procevent suite after fix
ok - a detached listener starts reparented, with a live descendant tree under it ok - retiring a source reaps its reparented listener and every descendant under it all procevent tests passed EXIT=0Evidence: session-lock-ancestry suite before fix (fails under subreaper)
Source: session-lock-ancestry suite before fix (fails under subreaper)
not ok - the pty-host was not reparented to init after the daemon ended EXIT=1Evidence: session-lock-ancestry suite after fix
Source: session-lock-ancestry suite after fix
ok - session-lock: a verified reclaim keeps the new sidecar beside the new pid EXIT=0Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
Orphan probe: started a double-forkedsleepand checked its ppid. It was 2896748, which is/usr/lib/systemd/systemd --user, and that process's parent is 1bash tests/fm-session-lock-ancestry.test.shat da14ba53 (fixed)bash tests/fm-procevent.test.shat da14ba53 (fixed)Pre-fix copies from 4735ddc6 (git show 4735ddc6:tests/<suite>), run in the same worktree on the same host to reproduce the failure. The temporary copies were deleted afterwards.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.