Repository navigation
fix(update): update repair fails after Doctor completes on busy macOS hosts - #170779
Merged
Merged
Conversation
`openclaw update repair` could fail on a loaded macOS host with "Updated pre-plugin Doctor failed: ... Command cleanup could not confirm that owned work stopped" even though Doctor had completed. Doctor's final command-scope settlement SIGKILLs any owned process group that is still observable and then waited only COMMAND_PROCESS_TREE_KILL_GRACE_MS (300 ms) for the group to disappear. That constant is the cooperative TERM->KILL grace; post-SIGKILL teardown and orphan reaping is unrelated and unbounded on busy hosts. On macOS kill(-pgid, 0) reports EPERM rather than ESRCH while a group holds only unreaped zombies, which isChildProcessTreeAlive rightly treats as alive. In two preserved failing runs the parent's custody settlement proved every tracked group extinct 70-200 ms after Doctor gave up; the same 300 ms budget there could also have produced a false "Doctor processes remain unsettled, data-at-risk" refusal. waitForCommandProcessGroupExit in exec-spawn.ts is now the single owner of post-kill confirmation with a dedicated 10 s budget (COMMAND_PROCESS_GROUP_EXIT_CONFIRMATION_MS). Polling still ends as soon as the group is gone, so normal cleanup is unchanged; only a group that truly survives SIGKILL now reports uncertain after 10 s instead of 300 ms. The scoped-command settle, the runner's forced termination and the custody settlement drop their private 300 ms loops; pre-kill identity checks, error messages and Windows paths are unchanged, and the Linux adopted-zombie reaper registration now outlives the new confirmation window. Regression tests hold a killed group in the macOS zombie (EPERM) state for 1 s before it disappears; both fail on the previous code (scope settlement rejects with CommandProcessCleanupError, custody settlement returns settled: false) and pass now.
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
October 13, 2026 07:26
Contributor
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Advance the Linux extension cleanup fixture by the shared post-SIGKILL confirmation budget and prune its obsolete mock-export baseline entry. CI run 38362642640 exposed both stale test artifacts. Production behavior is unchanged.
Contributor
Author
|
Merged via squash.
|
vincentkoc
added a commit
that referenced
this pull request
Oct 13, 2026
* commit '7ae69497bec4d9c37f170f046a3cbbf954ff19a7': (6238 commits) refactor(ui): replace Systems filters with native menu (#170786) fix(browser): browser open honors timeoutMs for its opening navigation (#170053) refactor: deslop old Apple shared/macOS and Control UI code (#170823) perf(memory): reuse pooled origin readers (#170795) fix(crabbox): preserve project snapshots across runtime updates (#170780) fix: prevent chat image loading from shifting messages (#170819) refactor(ui): use native menus for Secret Store actions (#170663) fix(gateway): keep chat metadata available during model reloads (#170805) fix: preserve diagnostics for unresponsive state lease heartbeats (#170835) fix(test): prepare runtime config for corpus revision proof test: give credential fixtures database ownership perf(auth): unblock session writes during health preparation (#170807) fix(ci): use smaller runners for selected Gateway client tests (#170821) fix: use same-commit plugins in development macOS builds (#170776) perf(github): share cached reads across sessions and searches (#170825) fix(projects): keep listings stable during unrelated session changes (#170824) fix(update): update repair fails after Doctor completes on busy macOS hosts (#170779) fix(heartbeat): suppress truncated NO_REPLY finals such as NO_R (#170190) perf(sessions): reduce read transaction overhead (#170745) refactor: simplify older plugin and package lifecycles (#170800) ...
RomneyDa
pushed a commit
that referenced
this pull request
Oct 14, 2026
Backport #170779 for the post-Doctor cleanup flake in #171470. Separate cooperative termination grace from post-SIGKILL extinction confirmation across command scopes, runner cleanup, and recorded process custody while preserving uncertain settlement and identity checks. Keep the main-only extension cleanup test absent from the release branch. (cherry picked from commit 69197e7)
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 14, 2026
… hosts (openclaw#170779) * fix(process): give force-killed command groups time to finish exiting `openclaw update repair` could fail on a loaded macOS host with "Updated pre-plugin Doctor failed: ... Command cleanup could not confirm that owned work stopped" even though Doctor had completed. Doctor's final command-scope settlement SIGKILLs any owned process group that is still observable and then waited only COMMAND_PROCESS_TREE_KILL_GRACE_MS (300 ms) for the group to disappear. That constant is the cooperative TERM->KILL grace; post-SIGKILL teardown and orphan reaping is unrelated and unbounded on busy hosts. On macOS kill(-pgid, 0) reports EPERM rather than ESRCH while a group holds only unreaped zombies, which isChildProcessTreeAlive rightly treats as alive. In two preserved failing runs the parent's custody settlement proved every tracked group extinct 70-200 ms after Doctor gave up; the same 300 ms budget there could also have produced a false "Doctor processes remain unsettled, data-at-risk" refusal. waitForCommandProcessGroupExit in exec-spawn.ts is now the single owner of post-kill confirmation with a dedicated 10 s budget (COMMAND_PROCESS_GROUP_EXIT_CONFIRMATION_MS). Polling still ends as soon as the group is gone, so normal cleanup is unchanged; only a group that truly survives SIGKILL now reports uncertain after 10 s instead of 300 ms. The scoped-command settle, the runner's forced termination and the custody settlement drop their private 300 ms loops; pre-kill identity checks, error messages and Windows paths are unchanged, and the Linux adopted-zombie reaper registration now outlives the new confirmation window. Regression tests hold a killed group in the macOS zombie (EPERM) state for 1 s before it disappears; both fail on the previous code (scope settlement rejects with CommandProcessCleanupError, custody settlement returns settled: false) and pass now. * test(process): align cleanup fixtures with exit confirmation Advance the Linux extension cleanup fixture by the shared post-SIGKILL confirmation budget and prune its obsolete mock-export baseline entry. CI run 38362642640 exposed both stale test artifacts. Production behavior is unchanged.
RomneyDa
added a commit
that referenced
this pull request
Oct 14, 2026
Backport #170779 for the post-Doctor cleanup flake in #171470. Separate cooperative termination grace from post-SIGKILL extinction confirmation across command scopes, runner cleanup, and recorded process custody while preserving uncertain settlement and identity checks. Keep the main-only extension cleanup test absent from the release branch. (cherry picked from commit 69197e7) Co-authored-by: Peter Steinberger <[email protected]>
vincentkoc
added a commit
that referenced
this pull request
Oct 18, 2026
* feat(qa): report scorecard evidence gaps Distinguish catalog coverage, recorded attempts, and qualified evidence without changing scores or release gates. Include the canonical compatibility migration-status correction from ec1fb60. Co-authored-by: Patrick Erichsen <[email protected]> * chore(qa): drop compatibility backport already on main Keep the QA evidence-gap change scoped to its 13 paths. The canonical compatibility correction ec1fb60 and later refinements are already on main; restore the six branch preimages so the merge consumes that upstream owner state. * chore(qa): integrate canonical worker settlement fixes * commit '7ae69497bec4d9c37f170f046a3cbbf954ff19a7': (6238 commits) refactor(ui): replace Systems filters with native menu (#170786) fix(browser): browser open honors timeoutMs for its opening navigation (#170053) refactor: deslop old Apple shared/macOS and Control UI code (#170823) perf(memory): reuse pooled origin readers (#170795) fix(crabbox): preserve project snapshots across runtime updates (#170780) fix: prevent chat image loading from shifting messages (#170819) refactor(ui): use native menus for Secret Store actions (#170663) fix(gateway): keep chat metadata available during model reloads (#170805) fix: preserve diagnostics for unresponsive state lease heartbeats (#170835) fix(test): prepare runtime config for corpus revision proof test: give credential fixtures database ownership perf(auth): unblock session writes during health preparation (#170807) fix(ci): use smaller runners for selected Gateway client tests (#170821) fix: use same-commit plugins in development macOS builds (#170776) perf(github): share cached reads across sessions and searches (#170825) fix(projects): keep listings stable during unrelated session changes (#170824) fix(update): update repair fails after Doctor completes on busy macOS hosts (#170779) fix(heartbeat): suppress truncated NO_REPLY finals such as NO_R (#170190) perf(sessions): reduce read transaction overhead (#170745) refactor: simplify older plugin and package lifecycles (#170800) ... * fix(gateway): preserve safe previews and no-op bindings Clear only the matching pending binding operation after an authoritative unchanged settlement, preserving committed and unknown invalidation fences. Include the canonical managed-media preview correction from 47ba0ae. Co-authored-by: Peter Steinberger <[email protected]> * merge(main): reconcile QA reporting with frozen main * test(gateway): verify retained route authority after binding settlement Co-authored-by: Patrick Erichsen <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 18, 2026
* feat(qa): report scorecard evidence gaps Distinguish catalog coverage, recorded attempts, and qualified evidence without changing scores or release gates. Include the canonical compatibility migration-status correction from 3f6d26f. Co-authored-by: Patrick Erichsen <[email protected]> * chore(qa): drop compatibility backport already on main Keep the QA evidence-gap change scoped to its 13 paths. The canonical compatibility correction 3f6d26f and later refinements are already on main; restore the six branch preimages so the merge consumes that upstream owner state. * chore(qa): integrate canonical worker settlement fixes * commit '4ae87487b6eca95ac58a2f18de0e742b240772eb': (6238 commits) refactor(ui): replace Systems filters with native menu (openclaw#170786) fix(browser): browser open honors timeoutMs for its opening navigation (openclaw#170053) refactor: deslop old Apple shared/macOS and Control UI code (openclaw#170823) perf(memory): reuse pooled origin readers (openclaw#170795) fix(crabbox): preserve project snapshots across runtime updates (openclaw#170780) fix: prevent chat image loading from shifting messages (openclaw#170819) refactor(ui): use native menus for Secret Store actions (openclaw#170663) fix(gateway): keep chat metadata available during model reloads (openclaw#170805) fix: preserve diagnostics for unresponsive state lease heartbeats (openclaw#170835) fix(test): prepare runtime config for corpus revision proof test: give credential fixtures database ownership perf(auth): unblock session writes during health preparation (openclaw#170807) fix(ci): use smaller runners for selected Gateway client tests (openclaw#170821) fix: use same-commit plugins in development macOS builds (openclaw#170776) perf(github): share cached reads across sessions and searches (openclaw#170825) fix(projects): keep listings stable during unrelated session changes (openclaw#170824) fix(update): update repair fails after Doctor completes on busy macOS hosts (openclaw#170779) fix(heartbeat): suppress truncated NO_REPLY finals such as NO_R (openclaw#170190) perf(sessions): reduce read transaction overhead (openclaw#170745) refactor: simplify older plugin and package lifecycles (openclaw#170800) ... * fix(gateway): preserve safe previews and no-op bindings Clear only the matching pending binding operation after an authoritative unchanged settlement, preserving committed and unknown invalidation fences. Include the canonical managed-media preview correction from f3260b9. Co-authored-by: Peter Steinberger <[email protected]> * merge(main): reconcile QA reporting with frozen main * test(gateway): verify retained route authority after binding settlement Co-authored-by: Patrick Erichsen <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Fixes:
openclaw update repair(and the QA packaged bootstrap that uses it) fails with "Updated pre-plugin Doctor failed: … Command cleanup could not confirm that owned work stopped" on a busy macOS host, even though Doctor finished its work.User Impact
User impact: updates and Doctor runs on loaded macOS hosts no longer fail just because a force-killed helper process took more than 300 ms to finish exiting, and the updater no longer risks a false "Doctor processes remain unsettled, data-at-risk" refusal for the same reason. Normal cleanup is not slower: confirmation still returns the moment the process group is gone. Tradeoff: a process group that genuinely survives SIGKILL is now reported as uncertain after up to 10 s instead of 300 ms.
Why This Change Was Made
When a command scope closes, it SIGKILLs any owned process group that is still observable and then confirms the group is gone. That confirmation reused the 300 ms TERM→KILL grace as its deadline, but post-SIGKILL teardown and zombie reaping are unrelated to the cooperative grace. On macOS,
kill(-pgid, 0)reports EPERM rather than ESRCH while a group holds only unreaped zombies, which we correctly treat as alive, so under load the 300 ms window expires before the kernel finishes.Post-kill confirmation now has one owner,
waitForCommandProcessGroupExitinsrc/process/exec-spawn.ts, with its own 10 s budget. The scoped-command settle, the runner's forced termination, and the updater's custody settlement use it instead of three private 300 ms loops. Pre-kill identity checks, error messages, and Windows paths are unchanged. 300 ms remains the TERM→KILL grace.Evidence
update repairruns (one from the original report, one reproduced on this branch's parent withnode scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts extensions/qa-lab/src/session-host-command-state.real-gateway.e2e.test.ts), Doctor printed "Doctor complete." and wrote its clean-close receipt, then failed its final scope settlement. 70–200 ms later the parent updater's custody settlement logged "every tracked process group stopped". The groups did exit; the deadline was too short.kill(-pgid, 0)returns EPERM for a zombie-only process group. Temporary instrumentation of the e2e (not committed) showed the groups being confirmed at Doctor stop time were shortlaunchctlprobes already in the zombie (Z <defunct>) state, not live work.exec-scope-settlement.test.tsandcommand-process-custody.test.tseach hold a killed group in the EPERM state for 1 s before it disappears. Both fail on the previous code (scope settlement rejects withCommandProcessCleanupError; custody settlement returnssettled: false) and pass now.pnpm test src/process/exec-scope-settlement.test.ts src/process/command-process-custody.test.ts src/process/exec-termination.test.ts src/process/exec-termination.liveness.test.ts src/process/scoped-child-reaper.test.ts src/process/exec.test.ts --maxWorkers=1→ 72/72 passed, 44 s wall on a loaded host. The new regression tests run in under 10 ms each on fake timers. A broader consumer run (17 files incl. update custody, spawn broker, proxy, sessions exec) passed 196/196.pnpm tsgo:core, core test typecheck shards, oxlint, oxfmt,git diff --checkclean.Not changed here