Skip to content

fix(doctor): reclaim updater runtimes while a Gateway runs - #191284

Merged
steipete merged 7 commits into
mainfrom
codex/issue-188868-runtimes
Nov 2, 2026
Merged

steipete merged 7 commits into
mainfrom
codex/issue-188868-runtimes

Conversation

@steipete

@steipete steipete commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Related: #188868

What Problem This Solves

Fixes: every openclaw update leaves a retained updater runtime (openclaw-update-runtime-*). The next update never reclaims it while the Gateway runs, so runtimes accumulate until someone runs openclaw doctor --fix.

User Impact

User impact: the next openclaw update now removes runtimes left by earlier updates while the Gateway keeps running. Processes that reference a runtime, or that may be the update that created it, still block removal as before.

Why This Change Was Made

Each prepared update defers its runtime cleanup to the next eligible update or Doctor pass. Native runs showed that Doctor already reclaims these runtimes: --fix maintenance stops a managed Gateway first, and it refuses to run against an unmanaged one. The update's own pre-pass (maintainRetainedUpdateRuntimes, run before it prepares its own runtime) never could. A process-tree capture during a live update found three false holders:

  • The Gateway. Its process title (openclaw-gateway) erases its script path, and the census treated every OpenClaw process without artifact evidence as holding every runtime.
  • The Gateway's spawn-broker worker.
  • The update CLI's own respawn launcher. This is an idle parent whose node openclaw update argv stays visible.

The census now:

  • Releases a holder with no artifact evidence only when it is positively a Gateway process: the openclaw-gateway title, a visible gateway subcommand after the CLI's --update rewrite, or the spawn-broker worker entrypoint. Title-erased CLIs, update, doctor (its git-update path runs the updater in-process), update workers, resolved artifact paths, including symlink aliases, and unresolved preloads all stay holders.
  • When the inspecting process is itself the update CLI, exempts its direct parent if that parent is a visible update CLI launcher. A nested updateCommand inside update-migrated-finalize.worker is not the update CLI, so its outer updater stays a holder.

No marker format change, so runtimes left by shipped updaters are reclaimed too.

Rejected:

Accepted edge case: a Gateway launched by hand from inside an updater's private temporary projection would not be recognized as holding it. No product path starts one there.

Not covered: Windows. The runtime-mode census throws Exact process command census is unavailable on win32 before classification, so Windows updates still keep every runtime. Covering it means routing runtime mode through readWindowsProcessCensus (today only the handoff census uses it), with a foreign/access-denied process policy and native Windows proof. That is a separate change.

Evidence

Native Crabbox (AWS Linux, systemd user Gateway live throughout). Each lane went published 2026.10.9 → hop 1 to a build → hop 2 to the same commit relabelled 2026.10.10 → doctor --fix. No other processes ran during the lanes.

  • main c108c2ce145: the hop-2 pre-pass kept the hop-1 runtime, held by the Gateway, its spawn broker, and the updater's launcher ("other OpenClaw processes are still running (PIDs: 58378, 58491, 58760, 58830)"). Two runtimes remained after hop 2.
  • This PR d6568d9a55b: the hop-2 pre-pass removed the hop-1 runtime while the Gateway ran. Only the current run's runtime remained, correctly held by its own updater family and then deferred. Both hops exited 0, readyz was ready, and the package database backup stayed intact.
  • Process-tree capture during the pre-pass: the only remaining holder at intermediate commit 751cf0dd9bf was the update CLI's respawn launcher (100019 node …/openclaw update, parent of the updating child 100033).
  • Doctor: a managed Gateway is stopped for maintenance ("Stopped the managed Gateway for Doctor repair"); an unmanaged foreground Gateway makes Doctor refuse with GatewayStateOwnerContentionError. This is the same on main and this PR, so Doctor was never the failing path.
  • Pre-existing, unrelated: the version-bumped second hop logs "First restoration refusal observed … during post-plugin doctor" identically on main and this PR.

Tests, red on main and green here:

  • src/infra/openclaw-process-census.test.ts: the Gateway release cases, the conservative holders, and the respawn-launcher exemption, including the nested-worker case.
  • src/flows/doctor-retained-runtime.test.ts: Doctor with a live Gateway reclaims; with a title-erased CLI it retains.

Sibling suites pass: census missing-command, windows, native; update-retained-runtime; doctor settlement; plugin source captures; update-repair-cancellation. pnpm run tsgo:core, type-aware oxlint (core shard), and oxfmt pass.

Review: $autoreview (branch, P2) is scoped-clean. An independent Codex review found two real issues in earlier revisions (Linux clock reconstruction; a resolved alias dropped by a later preload), then two more (Doctor's in-process git update; the --update root-flag spelling). All four are fixed, and the final head got NO FINDINGS.

Credit

@fuller-stack-dev reported the root cause and first investigated it in #188868.

Every prepared update leaves its retained runtime for the next eligible
update or `openclaw doctor --fix`, but both passes refused to reclaim it
whenever any Gateway was running. The runtime census counted every
OpenClaw-identified process without artifact path evidence as holding
every runtime, and a live Gateway always looks like that: its process
title erases the script path. Runtimes therefore accumulated with each
update.

Without a reference to a runtime, an OpenClaw process can only hold it as
the updater that created it, and that updater started before mkdtemp
created the directory. The census now releases identity-only holders
whose native start time is more than 10 s after the runtime's birth
(ctime where birth time is unavailable). Processes that reference any
retained artifact, unknown custody, and identity-only processes that
predate the runtime still block reclamation.

Refs #188868
Review found that comparing process start times with the runtime's
birth breaks on Linux: process starts are reconstructed against the
current wall clock, so a forward clock step can make the creating
updater look newer than its runtime. Releasing also dropped resolved
artifact evidence when a later OpenClaw preload replaced the holder.

An OpenClaw process without artifact evidence can hold a runtime only as
the `openclaw update` that created it, so the census now releases such
holders only when their command is known and is not `update`: the
`openclaw-gateway` process title or a visible subcommand. Title-erased
CLIs and visible updates still block, and any resolved artifact path
keeps the holder conservative.
@clawsweeper

clawsweeper Bot commented Nov 2, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S labels Nov 2, 2026
@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. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed 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 Nov 2, 2026
@clawsweeper

clawsweeper Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Allow abandoned updater runtimes to be reclaimed while identifiable non-updater OpenClaw processes are running.

Example: Run openclaw doctor --fix with openclaw-gateway running and an unused /tmp/openclaw-update-runtime-Gate01 directory.

  • Before: The Gateway counts as holding the runtime, so Doctor retains it.
  • After: Doctor removes the unused runtime while preserving runtimes with actual path evidence or a possible creating updater.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, useful repair with no concrete introduced defect; supplied validation does not yet establish native or existing-state cleanup behavior.
Proof confidence 🦐 gold shrimp (3/6) Maintainer authorship exempts the ordinary contributor proof gate; the supplied tests exercise real census and cleanup owners with synthetic process observations, while native verification and existing-state upgrade compatibility remain unproven.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Abandoned updater runtime copies accumulate because a running Gateway prevents cleanup even when it does not use them.
Reason: Maintainer authorship establishes direction, the storage leak is source-verified, and Related correctly preserves the broader linked PR's separate scope.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR open: it addresses a verified current-main cleanup defect with a focused change, and no actionable introduced bug was found.

Priority: P2
Reviewed head: 3db65ceffb1104a1d4e06e310cfdd33f213966b9

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Complete an isolated latest-stable upgrade and Doctor cleanup with a live Gateway, showing unused legacy runtimes removed, active updater/runtime holders preserved, settings and data intact, and the regression red on base and green on head.
Agent review details

How this fits together

Update and Doctor share a cleanup owner that combines runtime markers, maintenance ownership, resource settlement, and process-census evidence before removing disposable runtime directories.

flowchart TD
  A[Update or Doctor] --> B[Retained runtime cleanup]
  B --> C[Marker and ownership checks]
  C --> D[Shared process census]
  D --> E[Command and artifact evidence]
  E --> F[Preserve runtime]
  E --> G[Remove abandoned runtime]
Loading

Technical review

Best possible solution:

Keep command-aware runtime custody in the existing census while retaining conservative updater, unresolved-preload, and artifact-reference protection.

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

Current-main source establishes the false-holder path, and the linked maintainer discussion reports a matching probe; this read-only review executed no target code.

Is this the best way to solve the issue?

The patch repairs the shared decision used by both Update and Doctor without file-mapping scans, new markers, or another custody store.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 428b02da8fa7.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned introduced change: The introduced diff changes the shared census, its regressions, and Doctor documentation; it adds no competing cleanup owner or persisted format. (src/infra/openclaw-process-census.ts:77, 3db65ceffb11)
  • Current-main defect: Current main returns an unscoped holder for an identified OpenClaw process without an artifact path, and runtime-scoped inspection cannot exclude that holder. (src/infra/openclaw-process-census.ts:113, 428b02da8fa7)
  • Deletion safeguards remain owned: The existing cleanup owner still verifies directory ownership, recognized markers, unchanged directory identity, creating-process registration, census results, and current maintenance authority before removal. (src/infra/temp-artifact-cleanup.ts:160, 3db65ceffb11)
  • Distinct regression boundaries: The added tests cover Gateway reclamation versus title-erased updater retention, visible update commands, worker entrypoints, resolved aliases, and preload retention; the Doctor regression checks actual temporary-directory removal through the cleanup owner. (src/flows/doctor-retained-runtime.test.ts:211, 3db65ceffb11)
  • Credited investigation and split scope: fix(update): leftover runtimes and database snapshots are never reclaimed on hosts running a Gateway #188868 records fuller-stack-dev's investigation and steipete's confirmation of the runtime false-holder defect; its database-snapshot and broader retention work remain separate.
  • Accepted bounded tradeoff: The maintainer-authored body explicitly accepts that a manually launched Gateway inside a private updater projection may escape detection, and explains that product service restarts use the installed package. (3db65ceffb11)

Likely related people:

  • Peter Steinberger: Raw commit 8b78b23 adds src/infra/openclaw-process-census.ts:79 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8b78b230a1c1; files: src/infra/openclaw-process-census.ts)
  • Dallin Romney: Raw commit 88a4f54 adds src/infra/openclaw-process-census.ts:45 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 88a4f54164de; files: src/infra/openclaw-process-census.ts)

PR surface

Source +34, Tests +54, Docs 0. Total +88 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 40 6 +34
Tests 3 55 1 +54
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 96 8 +88

Labels

Label changes:

  • add P2: Repeated updates accumulate disposable runtime copies, increasing disk use without an established immediate outage.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: Repeated updates accumulate disposable runtime copies, increasing disk use without an established immediate outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Rank-up moves

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

  • Complete the latest-stable upgrade and cleanup scenario described above.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 2, 2026, 12:00 PM ET / 17:00 UTC.

@steipete
steipete marked this pull request as ready for review November 2, 2026 18:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 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-11-02T18:19:25.133928Z d6568d9 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.

@steipete
steipete merged commit 7fd2b43 into main Nov 2, 2026
194 checks passed
@steipete
steipete deleted the codex/issue-188868-runtimes branch November 2, 2026 18:42
@steipete

steipete commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 3, 2026
…191284)

* fix(doctor): reclaim updater runtimes while a Gateway runs

Every prepared update leaves its retained runtime for the next eligible
update or `openclaw doctor --fix`, but both passes refused to reclaim it
whenever any Gateway was running. The runtime census counted every
OpenClaw-identified process without artifact path evidence as holding
every runtime, and a live Gateway always looks like that: its process
title erases the script path. Runtimes therefore accumulated with each
update.

Without a reference to a runtime, an OpenClaw process can only hold it as
the updater that created it, and that updater started before mkdtemp
created the directory. The census now releases identity-only holders
whose native start time is more than 10 s after the runtime's birth
(ctime where birth time is unavailable). Processes that reference any
retained artifact, unknown custody, and identity-only processes that
predate the runtime still block reclamation.

Refs openclaw#188868

* fix(doctor): release runtimes by command, not start time

Review found that comparing process start times with the runtime's
birth breaks on Linux: process starts are reconstructed against the
current wall clock, so a forward clock step can make the creating
updater look newer than its runtime. Releasing also dropped resolved
artifact evidence when a later OpenClaw preload replaced the holder.

An OpenClaw process without artifact evidence can hold a runtime only as
the `openclaw update` that created it, so the census now releases such
holders only when their command is known and is not `update`: the
`openclaw-gateway` process title or a visible subcommand. Title-erased
CLIs and visible updates still block, and any resolved artifact path
keeps the holder conservative.

* test(doctor): keep a title-erased CLI as the later runtime holder

* fix(doctor): keep runtime holders whose preloads are unresolved

* fix(doctor): release runtimes from OpenClaw worker entrypoints

* fix(doctor): release runtimes only from Gateway processes

* fix(update): let the update reclaim runtimes past its respawn launcher
steipete added a commit that referenced this pull request Nov 3, 2026
Related: #188868

## What Problem This Solves

Fixes: every Windows update leaves an `openclaw-update-runtime-*` directory behind, and neither the next update nor `openclaw doctor --fix` ever removes it. Each one costs disk on every update.

## User Impact

On Windows, `openclaw doctor --fix` now reclaims abandoned updater runtimes. A later `openclaw update` also reclaims earlier runtimes while the Gateway keeps running, as #191284 made possible on Linux and macOS. Runtimes that a live process could still use are kept, and Doctor names that process's PID. There is no config, schema, or migration change.

## Why This Change Was Made

The runtime census read processes through `readProcessGroupMembers`, which throws `Exact process command census is unavailable on win32` before it classifies anything. Every Windows cleanup therefore kept every runtime. The update handoff path already uses the native Windows census, so runtime mode now uses it too:

- **Readable command lines** are classified exactly as they are on Linux and macOS.
- **Rows owned by another account** do not hold runtimes. That includes positively foreign owners and rows that deny even limited query (no identity at all). This matches the existing treatment of unreadable foreign argv on macOS. The handoff census already relies on the same rule: every same-account process grants limited query at any integrity level.
- **Same-account rows with a hidden command line** are classified by their image, the same way Linux treats unrelated processes with an unreadable cwd. Non-runtime images do not block; Node.js, Bun, OpenClaw, or unknown images keep runtimes and produce a warning.
- **An exited ancestor ends the inspector's ancestry walk**, because Windows never reparents. Before, it aborted the census.
- **The Gateway's Windows job anchor** (`service-child-windows-job-anchor`) joins the spawn broker as a non-creator when it has no artifact evidence. Native runs showed that only this process kept blocking in-update reclamation while the Gateway ran. Only the Gateway task supervisor and the TUI's local shell launch it.

Accepted edge, named in code: a same-account process whose own DACL denies limited query counts as foreign. OpenClaw never launches one, and update locks and Doctor maintenance already exclude a concurrent updater.

The `backup create` scratch-cleanup `EPERM` that the Windows manual-procedure lane reported came from the 2026.10.4 CLI. That rename-onto-reservation bug was fixed by #176836, which shipped from 2026.10.6. Published 2026.10.9 and this build both completed `backup create --verify` five times on native Windows with no `EPERM` and no leftover scratch, so this PR does not change backup code.

## Evidence

- **Regression test** in `src/infra/openclaw-process-census.windows.test.ts`. On base it fails with the exact production message: `Could not inspect OpenClaw processes: Error: Exact process command census is unavailable on win32.` It passes with the fix. The case covers path-scoped holders, foreign and denied rows, opaque system and Node images, cwd evidence, the installed Gateway, and its job anchor. Without the anchor exemption, the anchor PID blocks the case.
- **Focused suites:** the census suites (runtime, Windows, missing-command, native) and the Doctor retained-runtime suites pass, 119 tests. `openclaw-process-census.native.test.ts` ("finds a real non-Node process holding retained handoff paths") fails on this macOS host only in the combined run, and identically on unmodified base. It is the macOS `incomplete` census path, which this PR does not touch.
- **Lint and types:** oxfmt, oxlint `--type-aware` and `tsgo:core` are clean.
- **Native Windows (Crabbox AWS m7i.large, Windows Server, OpenSSH, Node 24.22.1, Scheduled Task Gateway).** All hops below ran from published 2026.10.9:

| Step | Driver | Result |
|---|---|---|
| 10.9 → base build | 10.9 | runtime retained: `Exact process command census is unavailable on win32` |
| `doctor --fix` on base | base | runtime retained, same error |
| base → fix (2026.10.10) | base | both runtimes retained |
| fix → fix relabelled 2026.10.11 | fix | census runs; in-update passes are blocked only by live update processes and one Gateway-owned PID |
| `doctor --fix` on 2026.10.11 | fix | **removed all three runtimes**; Gateway restarted, `/readyz` ready |
| Native census against a fresh runtime with the live Gateway | fix vs. this head | fix: `pids: [1104]` (1104 = `service-child-windows-job-anchor.js`, child of the Gateway); this head: `pids: []` |
| The same, plus a same-account worker running from the runtime | this head | `pids: [<worker>]`, still blocks |

Every hop ended with the Gateway healthy (`ready`, `coreReady`). The "First restoration refusal observed … databases changed after snapshot capture" line on the second hop also appears on main, is unrelated to this change, and is tracked separately.

Gap: the Crabbox Windows image runs every token at High integrity, so a medium-integrity (UAC) inspector was not exercised natively; the policy for rows it cannot read is covered by the unit case above.

Production code +58/−11 (one owner file); tests +58/−9; docs +7/−1.

Review: `$autoreview` is scoped-clean on the final branch. An independent Codex review of the first head raised the access-denied rule (P1). That rule is kept and named as the accepted edge above. A second independent pass traced the job anchor's spawners and found nothing.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 4, 2026
…92129)

Related: openclaw#188868

## What Problem This Solves

Fixes: every Windows update leaves an `openclaw-update-runtime-*` directory behind, and neither the next update nor `openclaw doctor --fix` ever removes it. Each one costs disk on every update.

## User Impact

On Windows, `openclaw doctor --fix` now reclaims abandoned updater runtimes. A later `openclaw update` also reclaims earlier runtimes while the Gateway keeps running, as openclaw#191284 made possible on Linux and macOS. Runtimes that a live process could still use are kept, and Doctor names that process's PID. There is no config, schema, or migration change.

## Why This Change Was Made

The runtime census read processes through `readProcessGroupMembers`, which throws `Exact process command census is unavailable on win32` before it classifies anything. Every Windows cleanup therefore kept every runtime. The update handoff path already uses the native Windows census, so runtime mode now uses it too:

- **Readable command lines** are classified exactly as they are on Linux and macOS.
- **Rows owned by another account** do not hold runtimes. That includes positively foreign owners and rows that deny even limited query (no identity at all). This matches the existing treatment of unreadable foreign argv on macOS. The handoff census already relies on the same rule: every same-account process grants limited query at any integrity level.
- **Same-account rows with a hidden command line** are classified by their image, the same way Linux treats unrelated processes with an unreadable cwd. Non-runtime images do not block; Node.js, Bun, OpenClaw, or unknown images keep runtimes and produce a warning.
- **An exited ancestor ends the inspector's ancestry walk**, because Windows never reparents. Before, it aborted the census.
- **The Gateway's Windows job anchor** (`service-child-windows-job-anchor`) joins the spawn broker as a non-creator when it has no artifact evidence. Native runs showed that only this process kept blocking in-update reclamation while the Gateway ran. Only the Gateway task supervisor and the TUI's local shell launch it.

Accepted edge, named in code: a same-account process whose own DACL denies limited query counts as foreign. OpenClaw never launches one, and update locks and Doctor maintenance already exclude a concurrent updater.

The `backup create` scratch-cleanup `EPERM` that the Windows manual-procedure lane reported came from the 2026.10.4 CLI. That rename-onto-reservation bug was fixed by openclaw#176836, which shipped from 2026.10.6. Published 2026.10.9 and this build both completed `backup create --verify` five times on native Windows with no `EPERM` and no leftover scratch, so this PR does not change backup code.

## Evidence

- **Regression test** in `src/infra/openclaw-process-census.windows.test.ts`. On base it fails with the exact production message: `Could not inspect OpenClaw processes: Error: Exact process command census is unavailable on win32.` It passes with the fix. The case covers path-scoped holders, foreign and denied rows, opaque system and Node images, cwd evidence, the installed Gateway, and its job anchor. Without the anchor exemption, the anchor PID blocks the case.
- **Focused suites:** the census suites (runtime, Windows, missing-command, native) and the Doctor retained-runtime suites pass, 119 tests. `openclaw-process-census.native.test.ts` ("finds a real non-Node process holding retained handoff paths") fails on this macOS host only in the combined run, and identically on unmodified base. It is the macOS `incomplete` census path, which this PR does not touch.
- **Lint and types:** oxfmt, oxlint `--type-aware` and `tsgo:core` are clean.
- **Native Windows (Crabbox AWS m7i.large, Windows Server, OpenSSH, Node 24.22.1, Scheduled Task Gateway).** All hops below ran from published 2026.10.9:

| Step | Driver | Result |
|---|---|---|
| 10.9 → base build | 10.9 | runtime retained: `Exact process command census is unavailable on win32` |
| `doctor --fix` on base | base | runtime retained, same error |
| base → fix (2026.10.10) | base | both runtimes retained |
| fix → fix relabelled 2026.10.11 | fix | census runs; in-update passes are blocked only by live update processes and one Gateway-owned PID |
| `doctor --fix` on 2026.10.11 | fix | **removed all three runtimes**; Gateway restarted, `/readyz` ready |
| Native census against a fresh runtime with the live Gateway | fix vs. this head | fix: `pids: [1104]` (1104 = `service-child-windows-job-anchor.js`, child of the Gateway); this head: `pids: []` |
| The same, plus a same-account worker running from the runtime | this head | `pids: [<worker>]`, still blocks |

Every hop ended with the Gateway healthy (`ready`, `coreReady`). The "First restoration refusal observed … databases changed after snapshot capture" line on the second hop also appears on main, is unrelated to this change, and is tracked separately.

Gap: the Crabbox Windows image runs every token at High integrity, so a medium-integrity (UAC) inspector was not exercised natively; the policy for rows it cannot read is covered by the unit case above.

Production code +58/−11 (one owner file); tests +58/−9; docs +7/−1.

Review: `$autoreview` is scoped-clean on the final branch. An independent Codex review of the first head raised the access-denied rule (P1). That rule is kept and named as the accepted edge above. A second independent pass traced the job anchor's spawners and found nothing.
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 23, 2026
…191284)

* fix(doctor): reclaim updater runtimes while a Gateway runs

Every prepared update leaves its retained runtime for the next eligible
update or `openclaw doctor --fix`, but both passes refused to reclaim it
whenever any Gateway was running. The runtime census counted every
OpenClaw-identified process without artifact path evidence as holding
every runtime, and a live Gateway always looks like that: its process
title erases the script path. Runtimes therefore accumulated with each
update.

Without a reference to a runtime, an OpenClaw process can only hold it as
the updater that created it, and that updater started before mkdtemp
created the directory. The census now releases identity-only holders
whose native start time is more than 10 s after the runtime's birth
(ctime where birth time is unavailable). Processes that reference any
retained artifact, unknown custody, and identity-only processes that
predate the runtime still block reclamation.

Refs openclaw#188868

* fix(doctor): release runtimes by command, not start time

Review found that comparing process start times with the runtime's
birth breaks on Linux: process starts are reconstructed against the
current wall clock, so a forward clock step can make the creating
updater look newer than its runtime. Releasing also dropped resolved
artifact evidence when a later OpenClaw preload replaced the holder.

An OpenClaw process without artifact evidence can hold a runtime only as
the `openclaw update` that created it, so the census now releases such
holders only when their command is known and is not `update`: the
`openclaw-gateway` process title or a visible subcommand. Title-erased
CLIs and visible updates still block, and any resolved artifact path
keeps the holder conservative.

* test(doctor): keep a title-erased CLI as the later runtime holder

* fix(doctor): keep runtime holders whose preloads are unresolved

* fix(doctor): release runtimes from OpenClaw worker entrypoints

* fix(doctor): release runtimes only from Gateway processes

* fix(update): let the update reclaim runtimes past its respawn launcher

(cherry picked from commit 7fd2b43)

Release adaptation: Retain artifact and unknown custody; release only positive Gateway/broker identity without runtime evidence. Existing updater ancestry contract retained; Windows extension is separate.

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 23, 2026
Release adaptation: restore the source assertion for the existing Darwin
unbounded-environment regression after selecting openclaw#191284. A positively
identified Gateway is not a retained runtime without artifact evidence;
unknown-custody peers remain retained with their original warnings.
No production guards or census policy change.

Source policy: 7fd2b43 (openclaw#191284).
Regression proof: original assertion fails 1/63; corrected census suites
pass 64/64, with focused typecheck, lint, and formatting passing.

(cherry picked from commit adeda50)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 2df6fef118b367d777b8b1ffe5fa24844f05eeef)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant