Repository navigation
fix(doctor): reclaim legacy pnpm runtimes and TMP/TEMP service scratch - #160164
Conversation
…ions Forward-port retained runtime review corrections from c9de04a. Preserve the recorded watchdog outcome and retained files when workers cannot close, recognize legacy pnpm projections within the same store, and inspect service TMP/TEMP roots without guessing relative paths. Co-authored-by: Vincent Koc <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 28, 2026, 4:25 PM ET / 20:25 UTC (Revision 16). ClawSweeper reviewWhat this changesDoctor discovers abandoned updater runtimes from older pnpm package versions and managed-service TMP/TEMP locations, with recovery documentation and regression tests. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: current main still misses the reported recovery paths. The latest head removed the unsafe exit watchdog identified in the prior review, leaving a distinct, useful Doctor fix. Priority: P2 Review scores
Verification
How this fits togetherThe updater can retain a copy of its running code while replacing an installation. Doctor uses package roots and temporary-directory locations to find those copies, then checks their identity, maintenance ownership, and process liveness before reporting or removing them. flowchart LR
A[Installed package roots] --> C[Doctor scan]
B[Service temporary paths] --> C
C --> D[Runtime marker check]
D --> E[Identity and custody checks]
E --> F[Maintenance and process checks]
F --> G[Retain or remove runtime]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +61, Tests +165, Docs +5. Total +231 across 5 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep Doctor’s bounded recovery and final deletion safeguards, and address safe updater exit after SQLite settlement in #160690. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main reads only service TMPDIR and matches the current package root, leaving the reported TMP/TEMP and older pnpm cases outside Doctor’s scan. This read-only review did not run the flow. Is this the best way to solve the issue? Yes. The branch extends Doctor’s existing cleanup owner and retains its maintenance, identity, and process checks; the unsafe exit watchdog has been removed. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 379dac733ab1. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (15 earlier review cycles; latest 8 shown)
|
|
Blocked by the CI Node-matrix cap, not by a test failure: |
Narrow the first directory entry and declare the generator's undefined return so the synthetic opendir iterator matches Dir's AsyncIterator contract under the core test typecheck.
…atchdog A rejected mutation or recovery drain must turn a recorded successful command result into exit 1. Preserve recorded nonzero results and the original result for disposable retained-worker cleanup stalls. Document the distinction and extend the existing real-child exit cases. PR #160164 follow-up. Before the fix, three new failure cases exited 0 instead of 1; after the fix, all 11 retained-runtime exit cases pass. The regression file took 13.50s wall with --maxWorkers=1. After merging main, the five requested test files pass 79/79 in 99.18s. Core, other, infra, and config-cli typechecks, targeted oxlint, formatting, diff checks, and independent review pass. The published-driver test file passes 11/11 twice on the original branch and once on main. The reported case takes 7.33s and 6.82s on the branch versus 7.88s on main; its stable finalizer exits naturally without invoking the output watchdog. No PR-specific exit regression reproduced, so no CI-related production or test change was made.
|
CI note for run 36427625220 (head 7ca4341): the only failure was |
|
CI note for run 36445210408 (head e40d454): the only failure was |
…f the watchdog Preserve a pending nonzero exit when the output watchdog records success. Once retained-runtime directory removal starts, keep it joined through success or error; worker and preparation stalls before removal retain the bounded watchdog behavior. Document the installed-updater behavior. Real-child regressions failed before the fix for pending exit precedence, interrupted removal, and removal error settlement. Validation: 80 tests across retained-runtime exit/runtime, signal-exit-barrier, and one-shot-exit passed with maxWorkers=2 in 72.86s. The 14-case exit file passed with maxWorkers=1 in 15.73s wall. Core, infra-test, and config-cli-test typechecks, targeted oxlint, oxfmt, and git diff --check passed. Independent P2 autoreview was scoped-clean.
…ker settlement split Remove the watchdog finalizer escape, retirement abort/removal flags, immediate warning path, recorded exit-code state, and watchdog-only process tests. Retained SQLite work and runtime removal stay joined through the existing settlement owner. A mandatory broker settlement versus disposable termination split remains a separate follow-up. Keep Doctor legacy pnpm projection reclamation and service TMP/TEMP/TMPDIR discovery, including Windows casing and drive-relative paths. Main already preserves failed barriers and pending nonzero exits without watchdog state; retain that implementation and cover those outcomes directly in signal-exit-barrier tests. Recovery docs describe the reduced scope. Validation: 101 tests passed across six files with maxWorkers=2 (101.54 seconds); core typecheck and state-logging, config-cli, services, and other core test typecheck lanes passed; targeted oxlint and oxfmt passed; Madge found zero cycles; git diff --check passed. Signal barrier cost with maxWorkers=1: seven tests passed, 3.28 seconds command wall (1.74 seconds Vitest). Autoreview against the merged main base was scoped-clean at P1. Native Windows and published-driver upgrade proof were not run in this scoped reduction.
|
Merged via squash.
|
|
Post-merge published-driver proof: Package Acceptance run 36482095098 on main 165fd29 (contains this PR and #160164/#160170) passed both Docker lanes: |
openclaw#160164) * fix(update): bound stalled runtime cleanup and reclaim legacy projections Forward-port retained runtime review corrections from c9de04a. Preserve the recorded watchdog outcome and retained files when workers cannot close, recognize legacy pnpm projections within the same store, and inspect service TMP/TEMP roots without guessing relative paths. Co-authored-by: Vincent Koc <[email protected]> * test(doctor): type the bounded projection iterator fixture Narrow the first directory entry and declare the generator's undefined return so the synthetic opendir iterator matches Dir's AsyncIterator contract under the core test typecheck. * fix(update): keep failed recovery barriers nonzero after the output watchdog A rejected mutation or recovery drain must turn a recorded successful command result into exit 1. Preserve recorded nonzero results and the original result for disposable retained-worker cleanup stalls. Document the distinction and extend the existing real-child exit cases. PR openclaw#160164 follow-up. Before the fix, three new failure cases exited 0 instead of 1; after the fix, all 11 retained-runtime exit cases pass. The regression file took 13.50s wall with --maxWorkers=1. After merging main, the five requested test files pass 79/79 in 99.18s. Core, other, infra, and config-cli typechecks, targeted oxlint, formatting, diff checks, and independent review pass. The published-driver test file passes 11/11 twice on the original branch and once on main. The reported case takes 7.33s and 6.82s on the branch versus 7.88s on main; its stable finalizer exits naturally without invoking the output watchdog. No PR-specific exit regression reproduced, so no CI-related production or test change was made. * fix(update): keep nonzero exits and in-flight runtime removal ahead of the watchdog Preserve a pending nonzero exit when the output watchdog records success. Once retained-runtime directory removal starts, keep it joined through success or error; worker and preparation stalls before removal retain the bounded watchdog behavior. Document the installed-updater behavior. Real-child regressions failed before the fix for pending exit precedence, interrupted removal, and removal error settlement. Validation: 80 tests across retained-runtime exit/runtime, signal-exit-barrier, and one-shot-exit passed with maxWorkers=2 in 72.86s. The 14-case exit file passed with maxWorkers=1 in 15.73s wall. Core, infra-test, and config-cli-test typechecks, targeted oxlint, oxfmt, and git diff --check passed. Independent P2 autoreview was scoped-clean. * refactor(update): drop the retained-runtime exit watchdog pending broker settlement split Remove the watchdog finalizer escape, retirement abort/removal flags, immediate warning path, recorded exit-code state, and watchdog-only process tests. Retained SQLite work and runtime removal stay joined through the existing settlement owner. A mandatory broker settlement versus disposable termination split remains a separate follow-up. Keep Doctor legacy pnpm projection reclamation and service TMP/TEMP/TMPDIR discovery, including Windows casing and drive-relative paths. Main already preserves failed barriers and pending nonzero exits without watchdog state; retain that implementation and cover those outcomes directly in signal-exit-barrier tests. Recovery docs describe the reduced scope. Validation: 101 tests passed across six files with maxWorkers=2 (101.54 seconds); core typecheck and state-logging, config-cli, services, and other core test typecheck lanes passed; targeted oxlint and oxfmt passed; Madge found zero cycles; git diff --check passed. Signal barrier cost with maxWorkers=1: seven tests passed, 3.28 seconds command wall (1.74 seconds Vitest). Autoreview against the merged main base was scoped-clean at P1. Native Windows and published-driver upgrade proof were not run in this scoped reduction. --------- Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
After an update, the newer Doctor could leave abandoned updater runtimes behind in two situations: legacy pnpm runtime projections whose recorded package root no longer matches the currently installed pnpm version, and scratch directories selected through the managed service's
TMPorTEMP(not justTMPDIR), including Windows casing and drive-relative paths.Forward-ports two of the three retained-runtime review corrections from abandoned release-branch commit c9de04a, adapted to current main. Thanks to Vincent Koc for the original work.
Summary
openclaw@*versions in the same projected store, bounded to 4,096 immediate entries (fails closed with guidance beyond that); existing maintenance, process, identity and custody checks are unchanged.TMPDIR,TMPandTEMPfrom the environment and the managed service definition (case-insensitive environment keys on Windows); a relative service path is resolved only against an absolute working directory on the same drive, otherwise Doctor warns that it could not inspect it.Evidence
src/flows/doctor-retained-runtime.test.tsfailed for the missing service-root reports/warnings, Windows path resolution and old pnpm projections; green after (the bounded-inventory case uses a synthetic directory iterator instead of creating 4,097 directories).pnpm tsgo:coreand matching core test typechecks, targeted oxlint, oxfmt, madge (0 cycles),git diff --checkpass. Autoreview (branch mode, P1): scoped-clean.src/flows/doctor-retained-runtime.test.ts27 tests, about 45 s including transform (the bounded-inventory case 59 ms).Remaining gaps (accepted by the maintainer)
TMP/TEMPcasing and drive-relative handling are covered by the real path/environment owners under simulatedwin32semantics only; no native Windows service run. The release Full Release Validation's Windows packaged-upgrade lanes are the regression check.published-upgrade-survivorrun on main (P5 fix(doctor): prevent plugin load errors after read-only inspection #160446 has landed), per maintainer decision; the release FRV runs the same cell on the re-cut branch.Release note: Doctor now cleans up abandoned updater runtimes after a pnpm version change and in managed-service scratch selected via
TMP/TEMP(Windows paths covered by simulated-platform tests).