Skip to content

fix(update): don't abort the process census on one unparseable process environment - #178705

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

steipete merged 1 commit into
mainfrom
upd/upd-l1735-census

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

One unparseable Darwin process environment aborts the retained-runtime census before it can inspect later processes.

User Impact

Doctor and update cleanup continue the census and report a warning for an unparseable process. That PID retains unknown custody, so potentially held runtimes remain protected.

Why This Change Was Made

At OpenClaw's proc-safe boundary, only a typed ProcSafeError with code incomplete from an individual command inspection becomes an observed process with unavailable command data. Native topology is retained. Unknown ancestors cannot receive a launcher exemption, but they no longer abort all observations. Enumeration failures, unrelated errors, and ordinary process disappearance retain their existing behavior.

The proc-safe Darwin parser was inspected at commit 8a610a06e5baca3336a84e64bdc2c9887687da3c. native/src/inspect.rs deliberately refuses an aligned pfz= ambiguity and an environment buffer without an independent terminating boundary, as documented in docs/inspect.md. This is not evidence that those parser guards should be removed. An upstream improvement would represent argv and environment availability independently: preserve successfully parsed argv and mark requested environment fields unavailable when their boundary cannot be proven. It must never silently turn an unreadable OPENCLAW_SERVICE_MARKER into an absent marker. This PR changes no proc-safe source or dependency.

Evidence

  • The synthetic incomplete-environment regression failed on the baseline because the census returned a global error. The regression covers a peer, an ancestor, and the inspector itself, and verifies later holders remain visible.
  • Focused and consumer proof: all 10 touched test files passed after correcting stale wording expectations (373 tests; one existing skip), and the final nine-file consumer/replay run passed (136 tests; one Windows-only skip). The original 68-file importer run exposed the wording and fixture issues fixed here; its other tests passed.
  • Scoped production and test tsgo: exit 0. Touched-file oxlint and oxfmt: exit 0. Madge: 0 cycle(s). git diff --check: clean.
  • Independent Codex review: no actionable P0–P2 findings; the later change was one matching test-string correction.
  • Native retained-runtime proof used an isolated HOME/OPENCLAW_STATE_DIR, a lane-owned /bin/sleep child, and two runtime-directory queries. Both return pids with no global error; the owned holder is found. Unreadable environments emit custody warnings and can conservatively retain that PID for an unrelated runtime. The child is terminated and joined in finally.
  • Full check:changed SQLite inventory was skipped under the campaign's local gate budget; PR CI supplies broad proof.
  • Production LOC +29/-12 (net +17); test LOC +26/-0; docs +1/-1. No new schema, dependency, CLI, or config options.

Commands ran with HOME="$PWD/.artifacts/home" and OPENCLAW_STATE_DIR="$PWD/.artifacts/state". Focused/consumer tests used node scripts/run-vitest.mjs <test files> --maxWorkers=1; types used node scripts/run-tsgo.mjs -p .artifacts/tsconfig.followup-{prod,tests}.json with changed-file roots; lint used node_modules/.bin/oxlint --tsconfig tsconfig.json <changed TypeScript files>; format used node_modules/.bin/oxfmt --check <changed files>; cycles used node --import ./scripts/tsx.mjs scripts/check-madge-import-cycles.ts.

Native retained-runtime command: env HOME="$PWD/.artifacts/home" OPENCLAW_STATE_DIR="$PWD/.artifacts/state" node_modules/.bin/tsx .artifacts/census-native-proof.ts. Output: holdingError=null, unrelatedError=null, ownHolderFound=true; unknown custody conservatively retained the holder for the unrelated query as well. The checked-in native handoff census test also passed.

Exact focused and consumer test commands
export HOME="$PWD/.artifacts/home" OPENCLAW_STATE_DIR="$PWD/.artifacts/state"
export OPENCLAW_VITEST_FS_MODULE_CACHE_PATH="$PWD/.artifacts/vitest-cache"
export OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1
node scripts/run-vitest.mjs src/infra/openclaw-process-census.test.ts src/state/openclaw-agent-db-lease.test.ts src/infra/update-managed-service-handoff-recovery.test.ts src/logging/diagnostic-support-redaction.test.ts src/commands/doctor-maintenance.agent-lease-wait.test.ts src/commands/doctor-maintenance.settlement.test.ts src/commands/doctor-session-sqlite.shared-store.test.ts src/flows/doctor-health.migration-refusal.test.ts src/flows/doctor-health.test.ts src/state/openclaw-agent-db.test.ts
node scripts/run-vitest.mjs src/infra/openclaw-process-census.windows.test.ts src/plugins/plugin-source-capture-directory.test.ts src/plugins/plugin-source-capture-recovery.test.ts src/infra/openclaw-process-census.native.test.ts src/infra/update-retained-runtime.test.ts src/infra/windows-process-census.native.test.ts src/cli/update-cli/update-repair-cancellation.test.ts src/flows/doctor-retained-runtime.settlement.test.ts src/commands/doctor-maintenance.agent-lease-wait.test.ts --maxWorkers=1

The first run found the final old wait-message assertion; the second run verifies its correction. All other first-run cases passed. The earlier 68-file importer list was selected by production basenames, preserving search order. Proof ran on the combined candidate; the two independent fixes are published on separate branches.

@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 19:13
@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-20T19:18:20.259485Z b456077 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. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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 Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR converts an individual Darwin incomplete-command inspection into unknown custody so process enumeration can continue.

Example: Darwin command inspection for PID 4102 throws an incomplete-environment error before a later runtime holder at PID 4103.

  • Before: The census returns a global error and never classifies the later holder.
  • After: PID 4102 remains a possible holder with a warning, and PID 4103 is still inspected.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch is coherent and conservatively preserves custody; supplied behavioral evidence is a native in-process run on a combined candidate, with exact-head CI unfinished.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its reported isolated native census run exercises real process inspection and conservative holder retention, while full Doctor CLI behavior is not demonstrated.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: One unrelated process with an unparseable environment prevents Doctor from completing its retained-runtime census.
Reason: The maintainer-authored direction restores useful diagnostics without treating unavailable process data as absence or changing cleanup ownership.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes a source-confirmed census failure still present on main, preserves conservative custody decisions, and introduces no actionable defect found in this review.

Priority: P2
Reviewed head: b456077e74992fedec8865fc5bec5dd748b221a1

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied native census run does not demonstrate the shipped Doctor CLI or an upgrade from the latest stable release.
Agent review details

How this fits together

Doctor and update recovery consume native process observations to determine whether retained artifacts remain in use; the census returns holder PIDs, uncertainty warnings, or enumeration errors.

flowchart TD
  A[Doctor and update recovery] --> B[OpenClaw process census]
  B --> C[Native process topology]
  C --> D[Per process command inspection]
  D --> E[Custody classification]
  E --> F[Holder PIDs and warnings]
  F --> G[Existing cleanup owner]
Loading

Technical review

Best possible solution:

Keep the narrow per-process error conversion in the existing census owner while preserving unknown custody and strict enumeration failures.

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

Current-main source shows a typed incomplete error escaping individual Darwin command inspection into the global census catch; the earlier cleanup PR records the same native failure, and this PR reports a red-on-base regression.

Is this the best way to solve the issue?

This is the smallest complete application-side fix: reuse existing unknown custody, retain topology for ancestry handling, and avoid weakening proc-safe parsing or introducing a second classifier.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0061cdde5f9a.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

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 +17, Tests +26, Docs 0. Total +43 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 29 12 +17
Tests 1 26 0 +26
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 56 13 +43

Labels

Label changes:

  • add P2: A Darwin inspection failure interrupts maintenance census results, but existing conservative behavior protects retained artifacts and no core-runtime outage is established.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: A Darwin inspection failure interrupts maintenance census results, but existing conservative behavior protects retained artifacts and no core-runtime outage is established.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • Show the changed behavior through openclaw doctor --fix with an incomplete Darwin environment and a later runtime holder.

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 October 20, 2026, 3:30 PM ET / 19:30 UTC.

@steipete
steipete merged commit 4797b07 into main Oct 20, 2026
214 of 217 checks passed
@steipete
steipete deleted the upd/upd-l1735-census branch October 20, 2026 19:41
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
…s environment (openclaw#178705)

A single proc-safe incomplete observation (for example an unterminated Darwin environment) aborted the whole retained-runtime census. That process now becomes unknown custody (blocking exactly as other unknowns do) and enumeration continues; other errors propagate as before. Upstream proc-safe parser follow-up is described in the PR.
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 status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant