Skip to content

fix(qa): recognize process groups reaped during cleanup - #132230

Merged
steipete merged 1 commit into
mainfrom
steipete/release-qa-process-cleanup-20260828
Aug 29, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/release-qa-process-cleanup-20260828

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #131643, #131740. Unblocks the QA lifecycle checks on #129276 and #132090.

What Problem This Solves

Resolves a problem where Linux QA cleanup can report an already-stopped process group as alive, or throw ESRCH after checking it. This interrupted the extension QA gate before the doctor and Gateway repairs could land.

Why This Change Was Made

The shared POSIX group owner previously reused a successful kill(0) observation after /proc inspection. Reaping the last zombie between those observations leaves an empty snapshot, which was converted back to alive=true. The owner now makes a fresh kernel existence probe when that snapshot is inconclusive, and treats /proc ESRCH as an exited member alongside ENOENT.

The two real-process fixtures use the existing idempotent group-signal helper and retain their tracking until termination is confirmed. Live descendants, permission errors, failed replacement ownership, and retry-stop semantics remain protected. No retries, larger timeouts, assertion weakening, new settings, dependencies, or lifecycle policy changes.

User Impact

QA shutdown and CLI/scenario settlement recognize groups that actually disappeared during reaping. This is an internal QA reliability repair, with no operator Gateway or user configuration change.

Production: +8/-5, net +3; those three net lines explain the kernel race, while executable LOC is net-neutral. Tests: +77/-9. The stale liveness default and raw fixture signal calls are replaced at their existing owners.

Evidence

Tested source is commit c48f6ae017240b7b0ac550428292038d618195ab, based on b4833bf0eff0f99bda1adab7d3c1b821a23a75e0. All four committed file hashes match the reviewed and Linux-tested bytes.

  • Real Linux reaping probe: a supervised setsid child is held as a zombie with waitid(WNOWAIT), then reaped through a FIFO handshake between the first kernel probe and /proc inspection. Before: result=true, empty members, final ESRCH. After: result=false, final ESRCH; supervisor joined exit 0 and fixture files removed.
  • Pre-fix regression run: three intended failures, ten passing controls. Final owner/sibling run: 129 tests across seven files passed.
  • Complete original extension QA config, two workers: 220 files / 3046 tests passed. Three additional complete lifetime-file runs passed 10/10 each.
  • Clean Linux Node 24.19.0 Testbox proof: run 33221598080, uninterrupted command exit 0. Source/package/workspace/lock hashes matched before and after, with no tracked deletions. Both proof leases were stopped; the final command receipt, not the hosting lease's cancellation state, records success.
  • Full changed gate passed: owner contract tests, production/test types, lint, dead exports, applicable guards, and zero runtime import cycles. Fresh isolated complete-delta Codex P0 review found no actionable P0 findings; this is not an all-priority review claim.

Complete CI-parity shard command:

CI=1 OPENCLAW_VITEST_MAX_WORKERS=2 OPENCLAW_TESTBOX=1 \
OPENCLAW_TESTBOX_REMOTE_RUN=1 \
OPENCLAW_NODE_TEST_CONFIGS_JSON='["test/vitest/vitest.extension-qa.config.ts"]' \
OPENCLAW_VITEST_SHARD_NAME=changed-extensions-config-38 \
node --import tsx scripts/ci-run-node-test-shard.mts

The original CI logs did not capture kernel state: their exact scheduling is inferred from the matching deterministic real-kernel reproduction. The unchanged full baseline passed, so it is not presented as a natural full-shard red reproduction. Original failures: doctor cleanup ESRCH and Gateway all-dead assertion.

Direct source audit covered the group/stat owner, Gateway process/lifetime/startup cleanup, CLI settlement and sibling lifecycle tests. The behavior follows the Linux process-group signal contract, exited /proc handle contract, and Node 24.19.0 process.kill implementation. Consumer-only retries or weakening failed-replacement retention would leave the shared owner defect intact.

Provenance: the stale default is from #120010, authored by @vincentkoc and merged by @RomneyDa on August 8; the new lifetime coverage in #131740 made it visible. This repair preserves that coverage and its ownership invariant. AI-assisted implementation and review.

Recheck kernel existence when a Linux proc snapshot cannot decide liveness,
and accept vanished proc handles alongside vanished paths. This prevents
an already-stopped group from appearing alive again during zombie reaping.

Use the canonical idempotent group signal helper in lifecycle fixture
cleanup, preserving permission failures and confirmed-termination checks.
Failed replacement ownership and retry-stop behavior remain unchanged.

Verified with a deterministic real Linux reaper before/after probe, failing
pre-fix race regressions, 129 owner/sibling tests, the full 220-file QA shard
(3046 tests), three lifetime-file reruns, and complete-delta P0 autoreview.
@steipete steipete self-assigned this Aug 29, 2026
@clawsweeper

clawsweeper Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 29, 2026 00:22
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 29, 2026
@clawsweeper

clawsweeper Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 8:33 PM ET / August 29, 2026, 00:33 UTC.

ClawSweeper review

What this changes

This PR makes QA Lab re-check POSIX process-group existence after an inconclusive Linux /proc snapshot and adds regression coverage for cleanup races during reaping.

Regression provenance

Possible regression — probable (reviewed change; reproduction). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer review: the PR repairs a real current-main QA liveness race at the shared owner boundary, while the exact-head changed-extension check is still running and the PR carries the protected maintainer label.

Priority: P2
Reviewed head: c48f6ae017240b7b0ac550428292038d618195ab
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with credible submitted Linux race evidence and regression coverage; only exact-head CI completion and maintainer handling remain.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The repository state identifies this as a maintainer-authored PR, so the external-contributor proof gate does not apply; nevertheless, the submitted body ties a deterministic real Linux reaping probe to the shared liveness owner and reports the after-fix stopped result.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository state identifies this as a maintainer-authored PR, so the external-contributor proof gate does not apply; nevertheless, the submitted body ties a deterministic real Linux reaping probe to the shared liveness owner and reports the after-fix stopped result.
Evidence reviewed 6 items Introduced owner repair: The introduced liveness owner accepts /proc ESRCH as a vanished member and uses a fresh negative-PGID signal-zero probe when Linux inspection is inconclusive, rather than reusing the earlier successful probe.
Current-main necessity: Fetched current main still has the old fallback that reports an inconclusive Linux inspection as alive, so the central repair is not already implemented on main.
Lifecycle caller: Gateway child-tree shutdown delegates POSIX liveness to this helper before and after TERM/KILL, making the helper the correct ownership boundary rather than a fixture-only workaround.
Findings None None.
Security None None.

How this fits together

QA Lab launches Gateway subprocess groups for isolated scenarios and verifies their termination before settling cleanup. The shared liveness result feeds process-tree cleanup and determines when scenario resources can be considered stopped.

flowchart LR
  A[QA scenario cleanup] --> B[Process group liveness check]
  B --> C[Kernel signal-zero probe]
  C --> D[Linux proc snapshot]
  D --> E[Fresh kernel probe]
  E --> F[Stopped or alive result]
  F --> G[Process and resource cleanup]
Loading

Decision needed

Question Recommendation
After the exact-head QA check completes, should this maintainer-scoped process-group cleanup repair land? Land after exact-head CI: Accept the owner-boundary repair after the running changed-extension check confirms the reviewed head.

Why: The implementation is narrowly scoped and source-supported, but the protected maintainer label requires an explicit maintainer decision rather than automated cleanup.

Before merge

  • Resolve merge risk (P1) - The exact-head changed-extension CI check is still in progress and should complete successfully before landing.
  • Complete next step (P2) - This maintainer-scoped PR needs ordinary exact-head CI completion and maintainer review, not an automated repair lane.
Agent review details

Security

None.

PR surface

Source +3, Tests +68. Total +71 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 8 5 +3
Tests 3 77 9 +68
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 85 14 +71

Review metrics

Metric Value Why it matters
Production versus test delta production +8/-5 (executable logic net 0; 3 explanatory comment lines); tests +77/-9 The repair changes one shared liveness decision while most of the diff is focused regression and fixture-cleanup coverage.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the shared-owner repair once exact-head QA CI is green, retaining the new race coverage and the existing conservative handling of permission failures.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the shared-owner repair once exact-head QA CI is green, retaining the new race coverage and the existing conservative handling of permission failures.

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

Yes, source inspection shows current main returns alive for an inconclusive Linux snapshot after a successful probe, and the PR supplies a deterministic Linux reaping scenario for the intervening-exit race.

Is this the best way to solve the issue?

Yes. The patch repairs the shared liveness owner used by Gateway child cleanup instead of masking the race in individual consumers or extending timeouts.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This fixes internal QA cleanup reliability with a bounded blast radius rather than an operator-facing runtime outage.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies this as a maintainer-authored PR, so the external-contributor proof gate does not apply; nevertheless, the submitted body ties a deterministic real Linux reaping probe to the shared liveness owner and reports the after-fix stopped result.

Label justifications:

  • P2: This fixes internal QA cleanup reliability with a bounded blast radius rather than an operator-facing runtime outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies this as a maintainer-authored PR, so the external-contributor proof gate does not apply; nevertheless, the submitted body ties a deterministic real Linux reaping probe to the shared liveness owner and reports the after-fix stopped result.

Evidence

What I checked:

  • Introduced owner repair: The introduced liveness owner accepts /proc ESRCH as a vanished member and uses a fresh negative-PGID signal-zero probe when Linux inspection is inconclusive, rather than reusing the earlier successful probe. (extensions/qa-lab/src/posix-process-group.ts:30, c48f6ae01724)
  • Current-main necessity: Fetched current main still has the old fallback that reports an inconclusive Linux inspection as alive, so the central repair is not already implemented on main. (extensions/qa-lab/src/posix-process-group.ts:50, ad6739064efa)
  • Lifecycle caller: Gateway child-tree shutdown delegates POSIX liveness to this helper before and after TERM/KILL, making the helper the correct ownership boundary rather than a fixture-only workaround. (extensions/qa-lab/src/gateway-child-process.ts:171, c48f6ae01724)
  • Regression coverage: The changed tests distinguish unreadable /proc state from vanished members and model a group disappearing between the initial and fresh probes; fixture cleanup also uses the existing idempotent group-signal helper. (extensions/qa-lab/src/posix-process-group.test.ts:64, c48f6ae01724)
  • History and release status: The candidate commit is dated 2026-08-28T17:14:22-07:00; it is not an ancestor of fetched main and no local release tag contains it, so this remains an unmerged, unreleased repair. (extensions/qa-lab/src/posix-process-group.ts:39, c48f6ae01724)
  • Submitted real Linux proof: The PR body documents a deterministic supervised Linux reaping probe with pre-fix true versus after-fix false results and an exact-head Testbox run; the linked GitHub run could not be re-read because GitHub network access failed in this review environment. (c48f6ae01724)

Likely related people:

  • steipete: Authored the candidate and the locally available parent history that contains the pre-existing process-group helper and current QA lifecycle work. (role: recent area contributor; confidence: high; commits: c48f6ae01724, c85129f85507; files: extensions/qa-lab/src/posix-process-group.ts, extensions/qa-lab/src/gateway-child-process.ts)
  • vincentkoc: The related merged QA lifecycle PR identifies this person as the author of the original process-group settlement work. (role: original lifecycle feature contributor; confidence: medium; commits: bf0aadbc40c2; files: extensions/qa-lab/src/posix-process-group.ts)
  • RomneyDa: The related merged lifecycle PR identifies this person as the merger of the original settlement change. (role: merger of earlier lifecycle work; confidence: medium; commits: bf0aadbc40c2; files: extensions/qa-lab/src/posix-process-group.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm the running changed-extension check succeeds on commit c48f6ae.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • 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.

@steipete

Copy link
Copy Markdown
Contributor Author

Exact head c48f6ae017240b7b0ac550428292038d618195ab is ready for native preparation: CI 33223349656 passed, including openclaw/ci-gate.

I inspected the complete four-file delta and the current main owner/callers. The committed bytes match the real Linux reaping red/green proof, 129 owner/sibling tests, complete 220-file / 3046-test QA config, three complete lifetime-file repeats, full changed gate, and fresh isolated P0 autoreview documented above. Executable production LOC remains net-neutral; permission errors, actual descendants, failed replacement tracking and all-dead assertions remain protected. Original CI kernel scheduling remains an inference, explicitly separated from the deterministic real-kernel reproduction.

The latest ClawSweeper entry is an active review placeholder with no posted rank-up findings yet. Current main rules require the passing aggregate check and do not require an additional approval; there are no outstanding review requests or changes-requested reviews. No approval or CI bypass is being used. This is the focused main QA unblock; it does not establish full release verification.

@steipete
steipete merged commit 80944da into main Aug 29, 2026
190 checks passed
@steipete
steipete deleted the steipete/release-qa-process-cleanup-20260828 branch August 29, 2026 00:39
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 29, 2026
…#132230)

Recheck kernel existence when a Linux proc snapshot cannot decide liveness,
and accept vanished proc handles alongside vanished paths. This prevents
an already-stopped group from appearing alive again during zombie reaping.

Use the canonical idempotent group signal helper in lifecycle fixture
cleanup, preserving permission failures and confirmed-termination checks.
Failed replacement ownership and retry-stop behavior remain unchanged.

Verified with a deterministic real Linux reaper before/after probe, failing
pre-fix race regressions, 129 owner/sibling tests, the full 220-file QA shard
(3046 tests), three lifetime-file reruns, and complete-delta P0 autoreview.
steipete added a commit that referenced this pull request Oct 13, 2026
Consolidate image traversal, request observation ownership, bus waiters,
Slack response classification, Node selection and WebSocket decoding.
Retire the generic Windows executable export after its Node caller moved;
keep trusted taskkill/PowerShell paths and all environment validation.
Remove duplicate planner validation and unsupported private lifecycle guards.
Keep external evidence validation, security authority, resource limits and
ordinary write-capable shutdown settlement.

Also preserve WhatsApp audio preflight when enabling message actions and
avoid recording a POSIX pipe-drain failure during the normal TERM grace.

Best-effort tradeoffs accepted:
- Bus cloning trusts its private typed event union. 0ebeee8 added the
  unsupported-kind throw only for lint; fabricated internal kinds now fail
  naturally, and a new typed variant must update this owner at compile time.
- Overlapping private QA driver transitions are unsupported; callers await
  them. #113855 introduced synthetic interleavings, not a human incident.
- Canonical smoke selection is trusted instead of revalidated; #114055 was
  an ownership cutover. A future selector defect belongs at that owner.
- Wire image inputs are parsed JSON trees. #71311 introduced no human
  cyclic-input incident; unsupported internal cyclic objects are best effort.
- Fabricated cyclic/BigInt tool outputs now fail clearly instead of becoming
  empty evidence. 195e721 added stabilization, not a human incident.
- Reinstalling the private AIMock mount is unsupported. bdc9c60 added
  speculative guards; the actual owner installs it once before start.
- Obsolete repeated observer disposal after port reuse can remove the newer
  QA lookup. 6386dc4 was an affinity repair, not a disposal incident;
  normal unique-port ownership and stop ordering prevent that lifecycle.
- Local non-federated Matrix joins fail immediately on setup errors; #64489
  added initial coverage, not a reported transient-join incident. Rerun the
  QA command after an unusual setup fault.
- Artifact publication is trusted after its awaited atomic writer. #92606
  added suite execution, not a missing-write incident; deletion afterward
  is reported by normal readers.
- Native browser JSON needs no branded rawJSON surrogate workaround.
  #140882 added that generality without a human incident; a future branded
  producer must own its serialization contract.
- Insertion-only pending caches clear directly on settlement. #113926 and
  #128379 supplied no human successor-eviction incident; no replacement can
  precede these finalizers. Real close-time successor checks stay.
- Re-registering the identical private borrowed-relay handle is unsupported.
  #128379/#133706 introduced no such incident; the owner creates fresh handles
  and current authority and distinct-successor comparisons remain.
- Inconclusive Linux process snapshots conservatively stay alive until the
  next check. #132230/#131643 used controlled fault injection, not a human
  actual-use incident. Final unconfirmed settlement retains state for retry.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…0889)

Consolidate image traversal, request observation ownership, bus waiters,
Slack response classification, Node selection and WebSocket decoding.
Retire the generic Windows executable export after its Node caller moved;
keep trusted taskkill/PowerShell paths and all environment validation.
Remove duplicate planner validation and unsupported private lifecycle guards.
Keep external evidence validation, security authority, resource limits and
ordinary write-capable shutdown settlement.

Also preserve WhatsApp audio preflight when enabling message actions and
avoid recording a POSIX pipe-drain failure during the normal TERM grace.

Best-effort tradeoffs accepted:
- Bus cloning trusts its private typed event union. f993a27 added the
  unsupported-kind throw only for lint; fabricated internal kinds now fail
  naturally, and a new typed variant must update this owner at compile time.
- Overlapping private QA driver transitions are unsupported; callers await
  them. openclaw#113855 introduced synthetic interleavings, not a human incident.
- Canonical smoke selection is trusted instead of revalidated; openclaw#114055 was
  an ownership cutover. A future selector defect belongs at that owner.
- Wire image inputs are parsed JSON trees. openclaw#71311 introduced no human
  cyclic-input incident; unsupported internal cyclic objects are best effort.
- Fabricated cyclic/BigInt tool outputs now fail clearly instead of becoming
  empty evidence. 5929e9a added stabilization, not a human incident.
- Reinstalling the private AIMock mount is unsupported. e98e098 added
  speculative guards; the actual owner installs it once before start.
- Obsolete repeated observer disposal after port reuse can remove the newer
  QA lookup. ace0e05 was an affinity repair, not a disposal incident;
  normal unique-port ownership and stop ordering prevent that lifecycle.
- Local non-federated Matrix joins fail immediately on setup errors; openclaw#64489
  added initial coverage, not a reported transient-join incident. Rerun the
  QA command after an unusual setup fault.
- Artifact publication is trusted after its awaited atomic writer. openclaw#92606
  added suite execution, not a missing-write incident; deletion afterward
  is reported by normal readers.
- Native browser JSON needs no branded rawJSON surrogate workaround.
  openclaw#140882 added that generality without a human incident; a future branded
  producer must own its serialization contract.
- Insertion-only pending caches clear directly on settlement. openclaw#113926 and
  openclaw#128379 supplied no human successor-eviction incident; no replacement can
  precede these finalizers. Real close-time successor checks stay.
- Re-registering the identical private borrowed-relay handle is unsupported.
  openclaw#128379/openclaw#133706 introduced no such incident; the owner creates fresh handles
  and current authority and distinct-successor comparisons remain.
- Inconclusive Linux process snapshots conservatively stay alive until the
  next check. openclaw#132230/openclaw#131643 used controlled fault injection, not a human
  actual-use incident. Final unconfirmed settlement retains state for retry.
steipete added a commit that referenced this pull request Oct 14, 2026
kill(-pgid, 0) still succeeds while an unreaped zombie remains in the
group. When that zombie is reaped before the /proc scan, the snapshot is
empty and the owner returned the stale successful probe as "alive".
Hosted Extension Tests shard-2 hit this in 3 of the last 8 hourly main
runs via gateway-child-bootstrap assertStopped.

Restore the fresh kernel existence probe for inconclusive snapshots
(added in #132230, removed in #170889) and its regression test. A group
that still exists stays alive; only a fresh ESRCH releases it.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
…171692)

kill(-pgid, 0) still succeeds while an unreaped zombie remains in the
group. When that zombie is reaped before the /proc scan, the snapshot is
empty and the owner returned the stale successful probe as "alive".
Hosted Extension Tests shard-2 hit this in 3 of the last 8 hourly main
runs via gateway-child-bootstrap assertStopped.

Restore the fresh kernel existence probe for inconclusive snapshots
(added in openclaw#132230, removed in openclaw#170889) and its regression test. A group
that still exists stays alive; only a fresh ESRCH releases it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: qa-lab maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant