Skip to content

fix(managed-child): honor process groups that vanish before cleanup - #119614

Merged
steipete merged 1 commit into
mainfrom
codex/loc-0805-process-lifecycle-dmvazq
Aug 5, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/loc-0805-process-lifecycle-dmvazq

Conversation

@steipete

@steipete steipete commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a problem where live updater operations can fail with "Git fast-forward merge process tree could not be cleaned up" after a successfully exited Git process group disappears between its liveness probe and cleanup signal, masking the actual replacement readiness failure and breaking LaunchAgent rollback.

Why This Change Was Made

The managed-child lifecycle owner now treats Node process.kill(-pid, SIGKILL) throwing ESRCH as authoritative proof that the process group no longer exists, superseding the earlier stale liveness probe. Real lingering descendants still fail closed after cleanup; Windows behavior, timeout guarantees, and orphan draining remain unchanged. The owner implementation removes 8 net production lines.

User Impact

Live updater users retain accurate replacement-readiness failures and reliable LaunchAgent rollback instead of false process-tree cleanup errors. Actual surviving process groups remain rejected.

Evidence

  • New deterministic POSIX regression proves a successful liveness probe followed by real ESRCH on cleanup.
  • Unchanged true-orphan coverage still rejects and drains descendants; the original live updater replacement-readiness rollback scenario passes.
  • Focused remote Blacksmith Testbox proof: 108/108 tests passed, comprising 19 managed-child-process, 81 openclaw-live-updater, and 8 vitest-process-group tests.
  • Full unchanged pnpm check:changed passed remotely, including 252 script declaration contracts, test-root tsgo typechecking, and changed-script lint with zero warnings and zero errors.
  • Independent exact gpt-5.6-sol/xhigh autoreview: confidence 0.98; no actionable findings.
  • Net delta: -8 production LOC and +34 deterministic regression-test LOC.
  • Blacksmith Testbox run: https://github.com/openclaw/openclaw/actions/runs/31008770672; its sole lease was independently verified completed.

Exact-head live-updater ESRCH and rollback runtime proof

Reviewed, unchanged head: 2bcfdd5f28a01f68b9fdc6e7db34d5474a5798e8. A remote-only, isolated fixture injected the stale liveness observation directly into the real live-updater Git merge after the kernel had already confirmed that its owned process group was absent. The unchanged production updater then preserved the original readiness error and restored the previous managed service:

[runtime-proof] live-updater git merge: injected stale liveness=LIVE after verified actual process-group=ABSENT
[runtime-proof] live-updater git merge: cleanup signal=SIGKILL error.code=ESRCH authoritative process-group=ABSENT
[runtime-proof] replacement readiness failure observed: replacement readiness failed
[runtime-proof] rollback stop proof: previous gateway runtime=STOPPED port=FREE fixture=isolated
[runtime-proof] rollback restored previous LaunchAgent plist and prior gateway entrypoint
[runtime-proof] rollback bootstrapped previous LaunchAgent; old gateway safe=YES fixture=isolated
[runtime-proof] managed-child regression: cleanup signal=SIGKILL error.code=ESRCH authoritative process-group=ABSENT

The existing deterministic managed-child regression and the original live-updater LaunchAgent rollback scenario both passed in the same exact-head run: 2 tests passed, 98 skipped. Remote runtime proof: https://github.com/openclaw/openclaw/actions/runs/31011790318.

Second rank-up move disposition: exact-head build-artifacts and required openclaw/ci-gate are already SUCCESS. The branch head is unchanged since the substantive ClawSweeper review, so root AGENTS.md explicitly forbids a review-refresh round trip on an unchanged reviewed SHA; no bot re-review is warranted.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S maintainer Maintainer-authored PR labels Aug 5, 2026
@steipete
steipete marked this pull request as ready for review August 5, 2026 13:20
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Aug 5, 2026
@clawsweeper

clawsweeper Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 5, 2026, 9:27 AM ET / 13:27 UTC.

ClawSweeper review

What this changes

This PR makes strict managed-command cleanup accept a process group that genuinely disappears between its liveness probe and SIGKILL attempt, while retaining rejection for real lingering descendants.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 4 items remain

Keep open: the patch is a correct, focused repair for a current POSIX cleanup race, but the protected maintainer label and CI/test-only proof require explicit maintainer handling before merge.

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

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation is focused and source-supported, but merge-ready real-behavior proof remains test/CI-only.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR reports remote Testbox and CI results, but the available evidence is deterministic test/CI-only; add a redacted live-updater terminal transcript or log before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR reports remote Testbox and CI results, but the available evidence is deterministic test/CI-only; add a redacted live-updater terminal transcript or log before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Lifecycle owner repair: The PR records the cleanup signal result and accepts only an ESRCH-derived terminated state after the group becomes dead; a successfully signaled group still fails strict cleanup.
Regression and sibling invariant: The new POSIX test simulates a stale successful probe followed by a real kernel cleanup call, while existing coverage still rejects and drains an actual surviving descendant.
Updater caller and rollback boundary: Every updater leaf command requests strict tree exit; genuine cleanup failures are mapped to command_cleanup_failed, while replacement-readiness failures follow the rollback path.
Findings None None.
Security None None.

How this fits together

The live updater runs Git phases through the managed-child wrapper with strict process-tree exit verification. Cleanup results determine whether the updater proceeds to report a readiness failure and restore the prior LaunchAgent.

flowchart LR
  A[Live updater] --> B[Strict managed command]
  B --> C[Detached process group]
  C --> D[Liveness probe]
  D --> E[Cleanup signal result]
  E --> F[Readiness result]
  F --> G[Rollback or update outcome]
Loading

Decision needed

Question Recommendation
Should this protected process-lifecycle change require redacted live-updater proof of the ESRCH/rollback path, or receive an explicit proof override based on the remote Testbox evidence? Require live updater proof: Request a redacted terminal transcript or log showing the ESRCH race preserves the replacement-readiness error and restores the prior LaunchAgent.

Why: The patch is source-supported, but the available PR evidence does not directly show the after-fix operator-visible updater outcome, and protected-label handling requires a human choice.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR reports remote Testbox and CI results, but the available evidence is deterministic test/CI-only; add a redacted live-updater terminal transcript or log before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The available after-fix evidence is deterministic tests and CI summaries, not an inspectable redacted live-updater run showing the readiness error and LaunchAgent rollback.
  • Resolve merge risk (P1) - GitHub reports a clean but behind branch with checks still in progress, so final review must use the exact head that passes required validation.
Agent review details

Security

None.

PR surface

Tests +34, Other -8. Total +26 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 34 0 +34
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 8 16 -8
Total 2 42 16 +26

Review metrics

Metric Value Why it matters
Production versus regression LOC production -8, tests +34 The patch removes the stale liveness-state branch and adds focused POSIX race coverage without expanding runtime surface.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep this lifecycle-owner repair, preserve fail-closed handling for successfully signaled live groups, and add a redacted live-updater transcript that shows the original readiness failure and rollback remain visible after the ESRCH race.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep this lifecycle-owner repair, preserve fail-closed handling for successfully signaled live groups, and add a redacted live-updater transcript that shows the original readiness failure and rollback remain visible after the ESRCH race.

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

Yes, source-reproducible: the added POSIX test creates a real exited child group, injects only the stale liveness result, and lets the actual cleanup signal return ESRCH; it was not executed in this read-only review.

Is this the best way to solve the issue?

Yes: the change fixes the lifecycle owner at the authoritative cleanup signal, retains strict rejection for real survivors, and matches the sibling process-group runner's ESRCH interpretation.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs a bounded live-updater error path and preserves rollback behavior, without evidence of an emergency-wide outage.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR reports remote Testbox and CI results, but the available evidence is deterministic test/CI-only; add a redacted live-updater terminal transcript or log before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This repairs a bounded live-updater error path and preserves rollback behavior, without evidence of an emergency-wide outage.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR reports remote Testbox and CI results, but the available evidence is deterministic test/CI-only; add a redacted live-updater terminal transcript or log before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Lifecycle owner repair: The PR records the cleanup signal result and accepts only an ESRCH-derived terminated state after the group becomes dead; a successfully signaled group still fails strict cleanup. (scripts/lib/managed-child-process.mjs:292, 2bcfdd5f28a0)
  • Regression and sibling invariant: The new POSIX test simulates a stale successful probe followed by a real kernel cleanup call, while existing coverage still rejects and drains an actual surviving descendant. (test/scripts/managed-child-process.test.ts:421, 2bcfdd5f28a0)
  • Updater caller and rollback boundary: Every updater leaf command requests strict tree exit; genuine cleanup failures are mapped to command_cleanup_failed, while replacement-readiness failures follow the rollback path. (.agents/skills/openclaw-live-updater/scripts/update-main.mjs:922, d85920c03e25)
  • Established ESRCH interpretation: The sibling process-group runner treats ESRCH as terminal group absence and prevents later signals from targeting a reused group ID. (scripts/pr-lib/process-group-runner.mjs:73, d85920c03e25)
  • Current behavior provenance: Blame attributes the current stale sawLive rejection condition to the commit that introduced this managed-child implementation and its updater caller. (scripts/lib/managed-child-process.mjs:308, 4b7a989a8bfe)
  • Available proof: The PR body reports a remote Testbox run and the supplied check context includes successful real-behavior checks, but no inspectable after-fix live-updater transcript or action log was available in this review. (2bcfdd5f28a0)

Likely related people:

  • steipete: Prior merged work includes repeated live-updater, PID/signal-race, and process-group-runner changes in addition to this PR. (role: recent updater and process-lifecycle contributor; confidence: high; commits: 21fba83254a8, 51fa35c94d86, 27065a65b766; files: .agents/skills/openclaw-live-updater/scripts/update-main.mjs, scripts/pr-lib/process-group-runner.mjs)
  • Jason (Json): Commit 4b7a989 introduced the managed-child wrapper, its tests, and the strict updater call site now being corrected. (role: introduced current managed-child behavior; confidence: medium; commits: 4b7a989a8bfe; files: scripts/lib/managed-child-process.mjs, test/scripts/managed-child-process.test.ts, .agents/skills/openclaw-live-updater/scripts/update-main.mjs)
  • Vincent Koc: History shows substantial related work in the shared scripts and process-group area, including Windows command and taskkill handling. (role: adjacent process-lifecycle contributor; confidence: medium; commits: 6c4028e07369, 6b0210a5fd0c; files: scripts/lib/managed-child-process.mjs, scripts/pr-lib/process-group-runner.mjs)

Rank-up moves

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

  • Add a redacted after-fix live-updater transcript or log that demonstrates the ESRCH race preserves the readiness failure and rollback.
  • After the final exact-head checks complete, refresh review on that head.

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
steipete merged commit 03a9e02 into main Aug 5, 2026
159 of 163 checks passed
@steipete
steipete deleted the codex/loc-0805-process-lifecycle-dmvazq branch August 5, 2026 13:57
@steipete

steipete commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to VACInc/openclaw that referenced this pull request Aug 5, 2026
* origin/main: (130 commits)
  refactor(qa): consolidate scenario runtime helpers (openclaw#119623)
  fix(telegram): bind Mini App auth to dashboard launches
  refactor(agent-core): unify session projection and compaction summaries (openclaw#119639)
  fix(codex): allow natural reactions in the current conversation (openclaw#119649)
  refactor(providers): deduplicate bundled model catalogs (openclaw#119627)
  fix(ui): observe the active service worker after asset refresh (openclaw#119622)
  fix(agents): strip echoed base64 image payloads so photo-heavy turns no longer hit the per-turn output cap (openclaw#119488)
  improve: make state-heavy test suites faster (openclaw#119617)
  perf(agents): add concurrency benchmark (openclaw#119569)
  fix(browser): visibly report failed pairing and tab-sharing actions (openclaw#119526)
  refactor(lobster): consolidate embedded workflow execution (openclaw#119630)
  fix(plugin-sdk): stabilize tuple-derived API baseline ordering (openclaw#119635)
  docs(skills): make full-authority maintainer runs unattended (openclaw#119629)
  fix(managed-child): honor process groups that vanish before cleanup (openclaw#119614)
  fix(ci): stop label-driven automation churn (openclaw#119610)
  fix(media): keep the ttl sweep out of the managed outgoing tree (openclaw#119127)
  fix(claws): remove owner-qualified skills (openclaw#119606)
  fix(clawrouter): show stable error for malformed usage responses (openclaw#119580)
  fix(gateway): claim malformed plugin icon routes (openclaw#119559)
  fix(telegram): preserve truthful empty-content delivery (openclaw#88810)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant