Skip to content

Process ownership fixture races zombie reaping before PID reuse #158997

Closed

Description

@roboclaw-bot

Failure

Related: #158136. A pre-existing process test failed in the full native validation run on local candidate dc1e8117ea01cb9362ecfbed6f8e386b2ec47888 (source tree 18930555ea61b366f626e6d0c8e0035556a1f150). The implicated fixture and process helpers are unchanged from pinned main 5d95277. Current main consolidation #158919 changes the case table but retains this failing scenario and waiting sequence.

Full-run allocation, Blacksmith Testbox, Node 24.19.0, two concurrent projects and two Vitest workers:

  • File: src/process/exec-spawn.test.ts
  • Case: finishes an extinct retained group without signalling a reused root PID
  • Failure at line 208: after waitForPidToExit(descendantPid) resolves true, isChildProcessTreeAlive(child) returned true instead of false.
  • The process shard reported 1 failed / 72 passed / 1 skipped files and 1 failed / 975 passed / 64 skipped cases.

Root cause and deterministic boundary proof

The fixture awaits the wrong completion condition. waitForPidToExit uses isPidAlive, which treats a known Linux zombie as no longer running. isChildProcessTreeAlive uses the kernel process-group probe, which still finds a group containing an unreaped zombie. A non-running member is not evidence that its group has disappeared.

A network- and PID-isolated probe imported the actual candidate helpers. A real child created its own session and exited; its parent used waitid(WEXITED | WNOWAIT) to retain the zombie, without timing sleeps. Observed:

{"kernelState":"Z","oldWaitResult":true,"groupAlive":true,"originalGroupAbsenceAssertionWouldPass":false,"groupGoneAfterActualReap":true}

The final field was observed only after the real parent called waitpid. This deterministically falsifies the fixture assumption. The failing full run did not capture its process table, so the probe is a controlled counterexample, not a fabricated snapshot of that run.

Bounded verification / repair

An unchanged exact process-shard replay passed on a clean Testbox; this confirms the observed failure is intermittent, not that it is fixed. Allocation: https://github.com/openclaw/openclaw/actions/runs/36253637472 . An earlier replay invocation had a duplicate --config argument and ran no tests; it is not counted as a test result.

The narrow repair being verified in the PR work replaces the existing 2,000ms / 25ms PID-liveness wait with a wait for actual process-group absence, using the same deadline and interval. The case and its descendant-dead, unrelated-child-alive, and no-signals-to-reused-root assertions remain. No production code, test-scenario retries, expanded mocks, or longer timeout.

The changed file passed all 14 tests in 17.05s command wall time; independent whole-candidate P0–P3 review found no actionable defect. Whole-process and static verification are still running. The repair is not yet published or merged.

Activity

  1. added
    P2
    clawsweeper:fix-shape-clear
    clawsweeper:queueable-fix
    clawsweeper:source-repro
    impact:other
    issue-rating: 🦞 diamond lobster
    no-stale
    on Sep 26, 2026
  2. clawsweeper commented on Sep 26, 2026

    @clawsweeper
    Contributor

    Codex review: this still needs some work. Reviewed September 26, 2026, 12:08 PM ET / 16:08 UTC.

    Summary
    Keep open. Current main still lets the PID wait finish before the process group disappears, so the retained-zombie counterexample can make this test fail intermittently. The merged test consolidation retained the case, and the reported repair has not been published.

    Reproducibility: yes. Current source exposes the mismatched wait conditions, and the reported retained-zombie probe supplies a concrete failing boundary; this read-only review did not run the test.

    Regression provenance
    Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

    Next step
    No published PR currently contains the source-proven fixture repair, and one focused test-only change has a clear validation path.

    Review details

    Best possible solution:

    Wait for actual process-group absence within the existing bound, preserving the descendant-dead, unrelated-child-alive, and no-signal-to-reused-PID assertions.

    Do we have a high-confidence way to reproduce the issue?

    Yes. Current source exposes the mismatched wait conditions, and the reported retained-zombie probe supplies a concrete failing boundary; this read-only review did not run the test.

    Is this the best way to solve the issue?

    Yes. A bounded wait on the group condition the test actually asserts is narrower than changing production cleanup or weakening the scenario.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The failing shard did not capture its process table, so the zombie probe establishes a causal counterexample rather than the exact kernel state of that run.

    Codex review notes: model internal, reasoning high; reviewed against 8c7f9e12080d.

    Label changes

    Label changes:

    • add P2: An intermittent false failure disrupts native validation, with no demonstrated user-facing runtime regression.
    • add impact:other: The affected outcome is unreliable maintainer test validation rather than an owned user-impact class.
    • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
    • add clawsweeper:source-repro: Current issue advisory state selects this label.
    • add clawsweeper:queueable-fix: Current issue advisory state selects this label.
    • add clawsweeper:fix-shape-clear: Current issue advisory state selects this label.

    Label justifications:

    • P2: An intermittent false failure disrupts native validation, with no demonstrated user-facing runtime regression.
    • impact:other: The affected outcome is unreliable maintainer test validation rather than an owned user-impact class.
    Evidence reviewed

    Acceptance criteria:

    • node scripts/run-vitest.mjs src/process/exec-spawn.test.ts --maxWorkers=1
    • node scripts/check-changed.mjs -- src/process/exec-spawn.test.ts
    • git diff --check

    What I checked:

    • Premature assertion on main: The retained-group case kills the descendant, awaits PID liveness, and immediately asserts that the group is absent. (src/process/exec-spawn.test.ts:211, 8c7f9e12080d)
    • PID wait condition: The test helper returns when isPidAlive becomes false; it does not wait for group disappearance. (src/test-utils/process-tree.ts:22, 8c7f9e12080d)
    • Different zombie semantics: On Linux, isPidAlive treats a known single-thread zombie as no longer alive, while the group check probes the negative process-group ID with signal zero. (src/shared/pid-alive.ts:113, 8c7f9e12080d)
    • Group probe: The group is considered absent only when the signal-zero probe fails with ESRCH. (src/process/child-process-tree.ts:10, 8c7f9e12080d)
    • Reported failure and bounded counterexample: The issue reports the failing full-run assertion and a controlled real-process observation in which a retained zombie made the PID wait succeed while the group remained present. It explicitly says the failing run did not capture its process table and an unchanged shard replay passed.
    • Fixture history: The merged commit patch added this test case and the PID-wait-to-group-absence sequence. Its exact raw parent is recorded, but the local partial checkout could not provide the parent file blob for independent line-history verification. (src/process/exec-spawn.test.ts:211, 8af7f3e640b7)

    Likely related people:

    • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
    • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
    • srikolagani: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  3. clawsweeper commented on Sep 26, 2026

    @clawsweeper
    Contributor

    🦞⚠️
    Automatic implementation stopped before completion.
    Reason: The automatic implementation worker stopped before all deterministic gates completed. Open the workflow run for the exact blocker.
    Worker: https://github.com/openclaw/clawsweeper/actions/runs/36254513981

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2clawsweeper:fix-shape-clearclawsweeper:queueable-fixclawsweeper:source-reproimpact:otherissue-rating: 🦞 diamond lobsterno-stale

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions