Skip to content

fix(codex): avoid startup failures from unrelated unreadable processes - #133111

Merged
steipete merged 1 commit into
mainfrom
steipete/blissful-perlman-def504
Aug 30, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/blissful-perlman-def504

Conversation

@steipete

@steipete steipete commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #133101.

What Problem This Solves

Fixes an issue where starting a Codex-backed session could fail because an unrelated host process was unreadable, even though the registered parent and child identities were available. Inspection deadline failures also incorrectly told operators to change process-inspection permissions.

This is a reproduced registration-boundary defect, not a claim that the exact syscall or CPU cause of the original concurrent-host incident has been identified.

Why This Change Was Made

The canonical process inspector now supports inspecting the observer and known parent/child PIDs for non-destructive registration decisions. Destructive containment still requires a full process-tree snapshot, command fingerprint validation, and fresh identity checks immediately before signals; unreadable required identities remain fail-closed and keep their registrations.

The inspector distinguishes deadline, access-denied, and unavailable/invalid identity failures. An unreadable command can lose its fingerprint obligation only after a successful subsequent identity inspection proves disappearance or replacement. This keeps uncertainty distinct from absence.

No permission expansion, additional retries, larger deadlines, dependency/configuration changes, store/schema changes, or alternate inspection/cache path. Existing Windows behavior and natural startup-exit, cancellation, and owner-revocation precedence are preserved.

User Impact

Unrelated unreadable processes no longer prevent known-PID registration on Linux. Operators get an actionable failure reason rather than a misleading permission diagnosis for a timeout. Recovery guidance is updated at https://docs.openclaw.ai/plugins/codex-harness-runtime.

macOS still uses native ps; this does not claim that its kernel implementation avoids global enumeration. Full cleanup can still refuse to proceed when the process tree cannot be inspected safely. Synchronous database blocking is not removed by this patch.

Evidence

  • Before/after: the two real-registration regressions in transport-process-registration.procfs.test.ts failed against unchanged production, then passed with the fix. The test uses the real registration owner and isolated plugin-state store; only the procfs I/O boundary is faulted.
  • Local Node 24.20.0: six process/registration/containment/startup suites passed 70/70, including real native orphan recovery. The adjacent startup-retry suite passed 14/14 after migrating its old inspection-failure mock and diagnostic expectation.
  • Required-PID failures, malformed identities, missing observer, verified disappearance, fingerprint mismatch, PID reuse, descendants, shared/isolated clients, cancellation, and revoked ownership remain covered. Full-tree inspection still fails with the same unrelated unreadable neighbor.
  • pnpm build passed. Fresh Codex autoreview of the final diff was scoped-clean at the default P0 threshold.
  • node scripts/check-changed.mjs --staged passed, including production/test typechecks, lint, plugin boundaries, doctor-contract tests, and runtime import-cycle checks.
  • Exact-head Linux/Node 26.7.0: 77 passed, 7 macOS-only skipped across all seven suites. Real 2.2-second SQLite-lock/child-exit ordering still refuses an expired inspection with ProcessInspectionError.reason = "deadline"; the non-overlapping control passes. No deadline weakening.
  • Source-bound Docker + real Gateway/CLI + managed Codex 0.151.0: a separate serial functional smoke passed 6/6 turns, including a real apply_patch file write and exact bash readback from a different session. All active-phase health samples passed. Every turn has the expected provider/model/runtime, one successful attempt, and a non-rerouted terminal receipt; no application fallback. Startup pressure is recorded separately.
  • Concurrent control: 4/4 exact-marker responses on both parent and candidate, each using three openai/gpt-5.6-sol/Codex sessions and one direct anthropic/claude-sonnet-4-6 session. Both runs hit the unchanged transient CPU-health guard (parent delay max 112.3 ms; candidate 118.9 ms), stayed ready, and recovered without restart. Both load probes therefore remain incomplete, and neither submitted write/recall followups. The passing serial smoke is not substituted for a passing stress test.
  • All live-run children joined; no supervisor-forced cleanup signals; private auth/state directories were deleted and containers removed. API keys came from the standard repository CI test profile, with only the two selected keys supplied over private stdin. No host home, Git checkout, Docker socket, or unrelated credentials were mounted into model containers.
  • Remote proof: blacksmith-testbox, lease tbx_01m18n4t3beaf6sbm49wah9hs5, Testbox run 33296622700. Exact-head CI run 33296687827 passed, including openclaw/ci-gate.

Proof limits: Docker/Debian and API-key auth are not original Ubuntu/ClawRouter/account-auth parity; source/dist/Node hashes and immutable image IDs were verified before keys were supplied. The first fixture launch omitted explicit multi-agent ownership and stopped before submitting turns; it was corrected and its failed evidence retained. The minimal fixture also logged a pre-wave memory-core reconciliation warning because no system agent was assigned while cron was disabled; memory/dreaming behavior is not certified by this proof. The historical failure's exact errno/CPU cause and the original full stress sequence remain unproven.

Direct dependency inspection: Codex rust-v0.151.0, peeled commit 78c290807ce710180111df227df3b7a4fe845452; initialize gating in codex-rs/app-server/src/message_processor.rs:835-899, stdio EOF in codex-rs/app-server-transport/src/transport/stdio.rs, and single-client shutdown in codex-rs/app-server/src/lib.rs:1004-1024,1165-1174. Registration happens before that native protocol boundary; no upstream behavior is patched.

Production LOC: +143/-61 (net +82) across the three existing owner modules. The growth provides scoped inspection, typed diagnostics, and explicit fail-closed consumers; it does not introduce a second reader or a store redesign. Tests: +349/-56 (net +293); docs: +15/-8. Regression provenance of the original historical incident remains unknown; this PR makes no author/introduction attribution.

The operator's Stable Gateway and the protected Usage patch were not modified or exercised. No release or advisory operation is part of this PR.

Avoid blocking known-PID registration on unrelated unreadable processes and distinguish deadline failures from access denial. Preserve full-tree containment, command fingerprints, and fresh signal identity checks. Fixes #133101.
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: codex size: L maintainer Maintainer-authored PR labels Aug 30, 2026
@steipete
steipete marked this pull request as ready for review August 30, 2026 06:20
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 2:35 AM ET / 06:35 UTC.

ClawSweeper review

What this changes

The PR limits Codex startup registration checks to the observer and registered parent/child processes, adds typed inspection diagnostics, and keeps full-tree inspection for destructive orphan cleanup.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer handling. Current main still performs full-host inspection at the registration gate, while this branch scopes registration to known identities and retains full-tree checks before signals; however, the required direct Codex-source check is unavailable in this environment and the PR carries the protected maintainer label.

Priority: P1
Reviewed head: 6c1201f58e51700e35c12d68e7ab09d77914b539
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The source repair and focused boundary coverage are coherent, but the policy-required upstream Codex contract could not be independently verified in this review environment.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is not subject to the external-contributor proof gate. Its body reports focused before/after registration fixtures, but the pending Gateway/CLI evidence and unavailable Codex source remain maintainer review concerns rather than a contributor-proof failure.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is not subject to the external-contributor proof gate. Its body reports focused before/after registration fixtures, but the pending Gateway/CLI evidence and unavailable Codex source remain maintainer review concerns rather than a contributor-proof failure.
Evidence reviewed 7 items Current-main defect path: Current main calls the unscoped snapshot reader before checking the registered parent, so an unreadable unrelated process can prevent the registration decision.
Introduced owner-bound repair: The branch supplies only the registered parent and child PIDs to registration inspection, preserving a separate full-tree containment path.
Signal safety remains fail-closed: Containment still obtains full snapshots and final PID identities; inspection failures resolve to no containment or no signal rather than granting authority.
Findings None None.
Security None None.

How this fits together

The Codex plugin launches a managed stdio app-server and stores its process identity to reconcile stale children before later starts. Registration decides whether a known child may be retained or added, while containment revalidates a complete process tree before sending operating-system signals.

flowchart LR
  A[Codex session startup] --> B[Stored child identity]
  B --> C[Scoped registration inspection]
  C --> D[Launch and register child]
  B --> E[Full process-tree inspection]
  E --> F[Fresh identity recheck]
  F --> G[Orphan cleanup signals]
Loading

Decision needed

Question Recommendation
Can a maintainer provide or verify the matching Codex app-server source contract that establishes registration completes before any native turn can start? Verify the Codex contract: Record a direct inspection of the matching Codex initialization and shutdown paths, then continue exact-head review.

Why: The branch relies on that upstream lifecycle contract, and the repository policy requires a direct source inspection; this review environment has no usable Codex checkout.

Before merge

  • Resolve merge risk (P1) - This changes a safety-sensitive startup path: known-PID registration now succeeds where a global inspection previously failed, so maintainers should confirm both fresh-start behavior and cleanup of existing registrations on the exact head.
  • Resolve merge risk (P1) - The cited Codex app-server initialization contract could not be independently inspected because the required sibling source checkout is unavailable; repository policy requires that direct check before a final Codex merge verdict.
Agent review details

Security

None.

PR surface

Source +82, Tests +293, Docs +7. Total +382 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 3 143 61 +82
Tests 7 349 56 +293
Docs 1 15 8 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 507 125 +382

Review metrics

Metric Value Why it matters
Production versus test delta production +82 net; tests +293 net; docs +7 net The positive production growth implements scoped inspection and typed failures for a bug fix, so the owner-bound design justification should be retained in final review.

Merge-risk options

Maintainer options:

  1. Verify startup and cleanup invariants (recommended)
    Before merge, confirm the direct Codex initialization contract and preserve proof that scoped registration never weakens full-tree signal authorization.
  2. Pause for upstream-contract evidence
    Keep this safety-sensitive change out of the merge queue until the cited Codex source revision is directly reviewable.

Technical review

Best possible solution:

Keep scoped inspection exclusively at the non-destructive registration owner, retain complete-tree plus fresh-identity checks for every signal, and record a direct inspection of the matching Codex app-server source before merging.

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

Yes, source-reproducible: current main’s registration gate requires a full snapshot before checking the known parent, and the added procfs fixture models an unrelated EACCES entry. I did not execute the fixture in this read-only review.

Is this the best way to solve the issue?

Unclear pending the required direct Codex source check. The implementation is otherwise owner-bound in source: scoped reads are used only for registration, while containment remains full-tree and fail-closed.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3f1c84c706bf.

Labels

Label changes:

  • add P1: The patch addresses failed Codex-backed session startup for operators on hosts with unreadable unrelated processes.
  • add merge-risk: 🚨 compatibility: Existing startup failure and recovery behavior changes from a global inspection failure to a scoped known-PID decision.
  • add merge-risk: 🚨 security-boundary: The changed process-inspection decisions feed a persisted process-identity and operating-system signal boundary.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is not subject to the external-contributor proof gate. Its body reports focused before/after registration fixtures, but the pending Gateway/CLI evidence and unavailable Codex source remain maintainer review concerns rather than a contributor-proof failure.

Label justifications:

  • P1: The patch addresses failed Codex-backed session startup for operators on hosts with unreadable unrelated processes.
  • merge-risk: 🚨 compatibility: Existing startup failure and recovery behavior changes from a global inspection failure to a scoped known-PID decision.
  • merge-risk: 🚨 security-boundary: The changed process-inspection decisions feed a persisted process-identity and operating-system signal boundary.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is not subject to the external-contributor proof gate. Its body reports focused before/after registration fixtures, but the pending Gateway/CLI evidence and unavailable Codex source remain maintainer review concerns rather than a contributor-proof failure.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Record direct inspection of the matching Codex app-server initialization contract before a final merge verdict.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer verification for 6c1201f58e51700e35c12d68e7ab09d77914b539

The ClawSweeper startup/cleanup concerns and direct-source rank-up move are addressed. I personally inspected sibling Codex rust-v0.151.0 at peeled commit 78c290807ce710180111df227df3b7a4fe845452: initialize dispatch and the uninitialized-request rejection, stdio EOF/ConnectionClosed, and single-client shutdown. OpenClaw awaits registration before returning the transport for initialization. Full-tree containment, command fingerprints and immediate pre-signal identity checks remain; no uncertain inspection grants signal authority.

Source proof: two registration regressions failed before and passed after. Local Node24.20: 70 process-boundary tests plus 14 startup-retry tests passed. Exact-head Linux Node26.7: 77 passed, 7 macOS-only skips. The real 2.2s SQLite-lock/child-exit overlap still fails closed, now with reason: "deadline"; the non-overlapping control succeeds. This does not attribute the original historical incident to SQLite.

Commands run on the affected sources:

OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs extensions/codex/src/app-server/transport-process-snapshot.test.ts extensions/codex/src/app-server/transport-process-registration.test.ts extensions/codex/src/app-server/transport-process-registration.procfs.test.ts extensions/codex/src/app-server/transport-orphan.test.ts extensions/codex/src/app-server/transport.process.test.ts extensions/codex/src/app-server/transport-startup.test.ts extensions/codex/src/app-server/attempt-startup-retry.test.ts
node scripts/check-changed.mjs --staged
pnpm build

Fresh Codex autoreview was scoped-clean at its default P0 threshold. Exact-head CI 33296687827 and the required openclaw/ci-gate passed.

Live proof: source-bound root-Dockerfile images, official checksum-verified Node26.7, managed Codex0.151.0, actual Gateway and CLI, real OpenAI/Anthropic API endpoints. Provider blacksmith-testbox, lease tbx_01m18n4t3beaf6sbm49wah9hs5, environment run 33296622700. A separate serial functional smoke passed 6/6 turns with no application fallback, including apply_patch writing exact unpredictable file bytes and a different session reading them back through bash. Write run: b8a941f5-8f8d-4cd7-bba1-d385fe7894e1; readback run: 06672484-d137-4646-b1ec-72efb61556e6. All active-phase health samples passed; startup pressure was recorded separately. Every child joined, no supervisor forced signals, private state removed, and containers removed.

Important limitation, not hidden: concurrent parent and candidate both returned 4/4 correct responses with expected routes/no fallback, but each hit one transient cpu diagnostic (112.3ms versus 118.9ms maximum delay). Both stayed ready, recovered, and stopped followups under the unchanged guard. Those load probes remain incomplete; the serial smoke is not a passing stress-test claim. Candidate sampling found approximately 1.9ms in snapshot frames during the degraded interval, not dominant sampled work; this is not causal proof. Original Ubuntu/ClawRouter/account-auth parity and historical failure causality remain unproven. The minimal fixture's disabled-cron/no-system-agent memory warning is also outside this proof's certification.

Production +143/-61 (net +82), tests +349/-56 (net +293), docs +15/-8. The existing inspector now owns PID scoping and typed diagnostics; no parallel reader, cache, retry, enlarged budget, broader access, config, dependency or storage redesign. The bounded root-cause fix is preferable to silently ignoring unreadable rows in destructive full-tree inspections. Release-note context is in the PR body, not the release-only changelog.

@steipete
steipete merged commit 1180a53 into main Aug 30, 2026
264 of 266 checks passed
@steipete
steipete deleted the steipete/blissful-perlman-def504 branch August 30, 2026 06:59
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
…enclaw#133111)

Avoid blocking known-PID registration on unrelated unreadable processes and distinguish deadline failures from access denial. Preserve full-tree containment, command fingerprints, and fresh signal identity checks. Fixes openclaw#133101.
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 extensions: codex maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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.

[Bug]: Codex startup fails on unrelated process-inspection errors

1 participant