Skip to content

fix(doctor): reclaim runtimes despite unrelated unreadable cwd - #178278

Merged
steipete merged 1 commit into
mainfrom
upd/upd-l1718
Oct 20, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/upd-l1718

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #178189. Doctor can retain every abandoned updater runtime when an unrelated process such as gpg-agent or fusermount3 has an unreadable working directory.

User Impact

openclaw doctor --fix can reclaim abandoned runtimes without requiring users to stop unrelated helper processes. OpenClaw identities and observed runtime-path holders still preserve artifacts, including non-runtime executables whose working directory is a retained runtime.

Why This Change Was Made

The artifact-custody classifier already recognizes unrelated non-runtime commands, but its missing-cwd branch only exempted foreign users and specific systemd helpers. Apply that existing classification regardless of process ownership when there is no artifact reference, and remove the now-unused parent-command argument. Unresolved Node/Bun processes remain conservative; update-repair handoff ancestry and process-enumeration requirements are unchanged.

Production: +4 / −12 lines (net −8). Tests: +49 / −21 (net +28). The regression runs Doctor's real cleanup contribution and census against synthetic OS observations and real temporary projections. Thanks @davidcittadini for the report.

Evidence

  • Reproduced on main 8b680f322829: the new Doctor regression fails because the abandoned runtime remains. It passes with the fix and preserves the runtime used as another process's cwd (287 ms failing / 124 ms passing test time).
  • All 10 directly importing test files were selected: 259 tests passed, one Windows-only native test skipped; 9 files passed, one skipped. Total command wall time: 329.38 seconds. Group wall times were 179.86 s, 99.00 s, and 35.05 s; shared compiler preparation accounted for most of the first group. No individual test exceeded 30 seconds.
  • Core production types and the affected infra/other test-type graphs passed (4.7 s / 3.7 s / 2.9 s). Scoped lint, formatting, git diff --check, and Madge passed (zero cycles).
  • Independent Codex review returned scoped-clean, with no accepted/actionable findings. Fresh main 36b28bb0f51d has no intervening changes to the cleanup owner.
  • Native live proof remains unverified: the isolated macOS census probe stopped on ProcSafeError: incomplete: unterminated Darwin environment; the native Linux testbox queued and was stopped without running the proof. The regression supplies Linux process-table/cwd observations at the OS boundary rather than mocking the custody decision. No operator state or Gateway was changed.
  • The full check:changed SQLite inventory was omitted under the campaign's local gate budget; PR CI supplies broad proof.
Validation commands

All runtime/test commands used isolated HOME, OPENCLAW_STATE_DIR, and temporary directories.

node scripts/run-vitest.mjs src/flows/doctor-retained-runtime.test.ts -t 'despite unrelated helpers' --maxWorkers=1
node scripts/run-vitest.mjs \
  src/infra/openclaw-process-census.windows.test.ts \
  src/flows/doctor-plugin-source-captures.test.ts \
  src/plugins/plugin-source-capture-recovery.test.ts \
  src/flows/doctor-retained-runtime.settlement.test.ts \
  src/flows/doctor-retained-runtime.test.ts \
  src/infra/openclaw-process-census.missing-command.test.ts \
  src/infra/openclaw-process-census.test.ts \
  src/infra/windows-process-census.native.test.ts \
  src/infra/update-retained-runtime.test.ts \
  src/plugins/plugin-source-capture-directory.test.ts --maxWorkers=1
node scripts/run-tsgo-core-test-shards.mjs --ci-graphs-json '["core","core-test-infra","core-test-other"]'
node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json \
  src/infra/openclaw-process-census.ts src/infra/openclaw-process-census.test.ts \
  src/flows/doctor-retained-runtime.test.ts
node_modules/.bin/oxfmt --check src/infra/openclaw-process-census.ts \
  src/infra/openclaw-process-census.test.ts src/flows/doctor-retained-runtime.test.ts \
  docs/cli/doctor/checks.md
node --import ./scripts/tsx.mjs scripts/check-madge-import-cycles.ts
git diff --check

Ignore unrelated non-runtime commands without artifact references when their working directory is unavailable. Preserve OpenClaw identities, runtime-path holders, unresolved runtimes, and update-repair ancestry checks. Add a Doctor cleanup regression and update its documented custody policy. Fixes #178189.
@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 20, 2026 08:37
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S labels Oct 20, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T08:40:52.690170Z 941994e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 20, 2026
@steipete
steipete merged commit 9e9e1bf into main Oct 20, 2026
199 of 200 checks passed
@steipete
steipete deleted the upd/upd-l1718 branch October 20, 2026 08:52
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
… unreadable cwd (openclaw#178278)

Fixes openclaw#178189. Non-runtime commands (not node/bun/tsx) with no OpenClaw identity and no artifact references are no longer treated as runtime holders just because their cwd is unreadable (non-dumpable daemons such as gpg-agent, fusermount3). Node/Bun runtimes with unreadable cwd, OpenClaw identities and artifact-referencing processes still block cleanup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: doctor keeps updater runtimes when an unrelated user process has an unreadable cwd (gpg-agent, fusermount3) (2026.10.5)

1 participant