Repository navigation
fix(doctor): unblock cleanup when foreign system cwd is unreadable - #166335
Conversation
Allow retained-runtime cleanup to continue when a process with a positively foreign UID has readable non-runtime arguments but an unavailable working directory. Preserve explicit retained-runtime references, OpenClaw identity and service markers, and fail-closed handling for same or unknown owners and runtime ambiguity.
|
🦞👀 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: needs maintainer review before merge. Reviewed October 6, 2026, 11:17 PM ET / October 7, 2026, 03:17 UTC (Revision 6). ClawSweeper reviewWhat this changesDoctor and update cleanup can ignore positively foreign-user, non-runtime processes whose working directories are unreadable while preserving checks for live OpenClaw holders. Merge readiness✅ Ready for maintainer review This repair remains necessary on current main. No blocking patch defect was found, and the successful native acceptance evidence resolves the previous review’s cleanup-proof request. Priority: P2 Review scores
Verification
How this fits togetherThe process census checks whether running processes could still hold temporary OpenClaw artifacts. Doctor and update cleanup consume its result before removing abandoned runtime directories. flowchart TD
A[Host process records] --> B[Process census]
B --> C[Retained artifact and OpenClaw checks]
C --> D[Runtime arguments and ownership]
D --> E[Holder or unresolved evidence]
D --> F[Verified non-holder]
E --> G[Preserve temporary runtime]
F --> H[Guarded cleanup]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +12, Tests +55. Total +67 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep cleanup conservative for possible runtime holders while allowing confirmed foreign system processes to stop vetoing abandoned-runtime removal. Do we have a high-confidence way to reproduce the issue? Yes: current main rejects a foreign system process with readable non-runtime arguments and unavailable cwd. Source establishes that path; this reviewer did not execute it. Is this the best way to solve the issue? Yes: the exception belongs in the existing census owner and preserves ambiguity, holder, ownership, and final cleanup safeguards. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8fffecae0861. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
Add an opt-in native-cleanup Package Acceptance profile that reuses an integrity-checked candidate and npm 12 install without Docker, live, Telegram, or preparation lanes. Require a real non-root Linux permission boundary, retain the runtime while an owned holder is alive, then verify abandoned-runtime removal and unrelated sentinel preservation after that exact holder settles. Bound tooling fixture spawns and use the compatible Darwin shell for their heredocs.
Retain the independently validated harness in parent history for follow-up. Restore the product tree exactly to 5484773; published-driver and native-host cleanup proof remain bound to that immutable package.
…penclaw#166335) * fix(doctor): unblock cleanup when foreign system cwd is unreadable Allow retained-runtime cleanup to continue when a process with a positively foreign UID has readable non-runtime arguments but an unavailable working directory. Preserve explicit retained-runtime references, OpenClaw identity and service markers, and fail-closed handling for same or unknown owners and runtime ambiguity. * test(ci): add native retained-runtime cleanup acceptance Add an opt-in native-cleanup Package Acceptance profile that reuses an integrity-checked candidate and npm 12 install without Docker, live, Telegram, or preparation lanes. Require a real non-root Linux permission boundary, retain the runtime while an owned holder is alive, then verify abandoned-runtime removal and unrelated sentinel preservation after that exact holder settles. Bound tooling fixture spawns and use the compatible Darwin shell for their heredocs. * fix(ci): bind native cleanup to defining workflow * fix(ci): validate serialized defining workflow identity * test(update): isolate native cleanup acceptance account * fix(ci): isolate workflow identity and cleanup lifetime * fix(ci): read checkout identity from defining job * fix(ci): preserve native launcher when isolating cleanup fixture * fix(ci): keep cleanup validation harness outside runtime repair Retain the independently validated harness in parent history for follow-up. Restore the product tree exactly to 5484773; published-driver and native-host cleanup proof remain bound to that immutable package.
…166335) * fix(doctor): unblock cleanup when foreign system cwd is unreadable Allow retained-runtime cleanup to continue when a process with a positively foreign UID has readable non-runtime arguments but an unavailable working directory. Preserve explicit retained-runtime references, OpenClaw identity and service markers, and fail-closed handling for same or unknown owners and runtime ambiguity. * test(ci): add native retained-runtime cleanup acceptance Add an opt-in native-cleanup Package Acceptance profile that reuses an integrity-checked candidate and npm 12 install without Docker, live, Telegram, or preparation lanes. Require a real non-root Linux permission boundary, retain the runtime while an owned holder is alive, then verify abandoned-runtime removal and unrelated sentinel preservation after that exact holder settles. Bound tooling fixture spawns and use the compatible Darwin shell for their heredocs. * fix(ci): bind native cleanup to defining workflow * fix(ci): validate serialized defining workflow identity * test(update): isolate native cleanup acceptance account * fix(ci): isolate workflow identity and cleanup lifetime * fix(ci): read checkout identity from defining job * fix(ci): preserve native launcher when isolating cleanup fixture * fix(ci): keep cleanup validation harness outside runtime repair Retain the independently validated harness in parent history for follow-up. Restore the product tree exactly to 5484773; published-driver and native-host cleanup proof remain bound to that immutable package. (cherry picked from commit d1b8902)
What Problem This Solves
Fixes: Doctor and update runtime cleanup retain every temporary candidate when an unrelated system process has an unreadable working directory.
User Impact
Cleanup can proceed past a positively identified foreign-user, non-runtime process such as systemd. Processes with retained-runtime references, OpenClaw markers, unknown ownership, or ambiguous runtime arguments still block cleanup. No configuration, migration, or manual cleanup is required.
Why This Change Was Made
The process census rejected missing working directories before checking whether an inspected process could be an OpenClaw runtime. The narrow exception now applies only after retained-artifact and OpenClaw identity checks, and only when ownership is positively foreign and argument parsing definitively excludes a runtime. Same-user and unknown-owner handling is unchanged.
Evidence
pnpm test src/infra/openclaw-process-census.test.ts --maxWorkers=1 --reporter=dotpassed 98/98 tests: 19.79 s wall time, 17.29 s reported test-run duration, including 15.362 s cold compilation. Hosted CI cost is not yet measured.pnpm format:checkfor both changed files,node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/infra/openclaw-process-census.ts src/infra/openclaw-process-census.test.ts, andgit diff HEAD^ HEAD --checkpassed.5484773df113a1b60f412215214ecab7edba5a24.5484773df113a1b60f412215214ecab7edba5a24. Published driver2026.9.8updated to candidate2026.9.8; the sole lane passed in 630 s. Native assertions verified the finished update, readiness HTTP 200, running version, durable and incognito state preservation, and fixture service stop.5484773df113a1b60f412215214ecab7edba5a24package. The independently reviewed harness was2ebfe578918dd4f6b340e6ce07d70a633280fcbd. The test verified a separate non-root inspector, foreign system-process ownership with an unreadable cwd, retention while an exact owned holder remained live, and native Doctor removal plus actual absence after that holder settled. The unrelated sentinel survived and fixture cleanup completed. The selected npm job took 131 s; Docker and Telegram lanes were not repeated.c0b6ce45d346a21c3a37b747ac292b6f248c5248has exactly the same complete Git tree as5484773. A signed forward commit removed only the optional validation-harness changes from this PR; their source/history remains retained for separate follow-up, including its unresolved analyzer-model qualification. No security finding was dismissed. The unit and integration evidence above is reused by exact input equality; it is not a claim that older CI belongs to the current head.