Repository navigation
refactor: share native macOS process census across runtimes - #175368
Conversation
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 283436f92e
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex review: needs changes before merge. What this changesThis PR shares proc-safe’s native macOS process census across Node and Bun and replaces numeric Darwin ownership with relative ownership. Example: Node inspects a Codex child inside a macOS Seatbelt sandbox that denies /bin/ps.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: the maintainer-directed native cutover is useful and coherent, with one documentation defect remaining and required checks still failing. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherThe shared process inspector turns operating-system observations into topology, ownership, command, and birth-identity facts consumed by Codex containment, Doctor, and process-group cleanup. flowchart TD
A[macOS process facts] --> B[proc-safe native inspection]
B --> C[Shared Darwin inspector]
C --> D[Codex process containment]
C --> E[Process group census]
E --> F[Doctor and update inspection]
Technical reviewBest possible solution: Keep the shared native owner and align the SDK catalog with its documented Node and Bun behavior. Do we have a high-confidence way to reproduce the issue? Current main’s Node implementation executes ps, and the supplied Seatbelt scenario exercises the denied boundary; this review ran no target code. Is this the best way to solve the issue? Using proc-safe through the existing Darwin inspector is the smallest coherent cutover and preserves the established cleanup owners. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 01a806546943. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource -186, Tests -4, Docs +6, Config 0, Other -1. Total -185 across 21 files. Added test files: 2. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)
Reviewed October 18, 2026, 4:26 PM ET / 20:26 UTC (Revision 3). |
|
Fixed the retired wrapper inventory entry and the export-preserving census mock in 01bdbeb. The ownership suite passes 28/28, the eager-import closure suite passes 19/19, and the mock-export guard, focused lint, and independent review pass. The local provisioning rerun now gets past the missing-file error, but its first scenario exceeded the existing 120-second timeout; no budget or assertion was changed. Fresh exact-head CI is running. The @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Final rebased head:
Classification: unrelated delivery failure under the maintainer-approved Linux-equivalence standard. The import graphs overlap; this does not claim import isolation or a reproduced main failure. Linux returns from its unchanged procfs census branch; its rows never set owner. Added The automatic table marks the failure unknown because no matching changed-file shard exists on scheduled main. The native exception names |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1e3141bc7
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pid: row.pid, | ||
| ppid: row.parentPid, | ||
| pgid: row.processGroupId, | ||
| state: states[row.state], |
There was a problem hiding this comment.
Preserve Darwin live-thread state flags
When a macOS process is a zombie leader with surviving threads, ps stat reports a state containing both Z and l; the previous Node path preserved that flag, and isDeadProcessState() deliberately treats such a process as live. Mapping proc-safe's coarse zombie state to plain Z makes the Codex containment path treat it as fully exited, so terminateCodexAppServerOrphan() can report success and the durable registration can be deleted while the surviving work remains. Preserve the live-thread flag in this projection or make native Z observations conservative.
Useful? React with 👍 / 👎.
| Node and Bun use the pinned proc-safe native census and argument reader, so neither | ||
| operation executes `ps`, including inside macOS Seatbelt sandboxes. Unreadable |
There was a problem hiding this comment.
Update the SDK subpath summary for the native Node census
This new native-only contract leaves docs/plugins/sdk-subpaths.md:432 incorrectly saying that process-runtime uses a bounded ps implementation under Node. Users consulting the SDK catalog will therefore still expect ps execution and miss the newly documented Seatbelt behavior; update that summary alongside this behavior change.
AGENTS.md reference: AGENTS.md:L130-L130
Useful? React with 👍 / 👎.
e1e3141 to
78b7cb7
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
On macOS the native proc-safe census reports a process in its SIGKILL exit window as a bare row without topology, so Darwin inspection fails closed. The Codex reaper's post-SIGKILL confirmation loops treated that first failed observation as lost custody: every first orphan reap after a Gateway crash failed with "Cannot reap registered Codex process", and live transport closes could report cleanup "uncertain". After our own SIGKILL, retry failed observations until the existing containment deadline; runs without SIGKILL are unchanged and the deadline still fails closed. The orphan test's macOS "inspection unavailable" step used a fake ps, which macOS no longer runs since #175368, so it silently became the first real reap attempt. It now disables the native binding with proc-safe's documented PROC_SAFE_NATIVE=off mode.
…#175368) * refactor: share native macOS process census across runtimes * test: preserve process snapshot fixture failure causes * fix: complete Darwin census tooling cutover * docs: explain breaking Darwin process ownership API
…aw#176576) On macOS the native proc-safe census reports a process in its SIGKILL exit window as a bare row without topology, so Darwin inspection fails closed. The Codex reaper's post-SIGKILL confirmation loops treated that first failed observation as lost custody: every first orphan reap after a Gateway crash failed with "Cannot reap registered Codex process", and live transport closes could report cleanup "uncertain". After our own SIGKILL, retry failed observations until the existing containment deadline; runs without SIGKILL are unchanged and the deadline still fails closed. The orphan test's macOS "inspection unavailable" step used a fake ps, which macOS no longer runs since openclaw#175368, so it silently became the first real reap attempt. It now disables the native binding with proc-safe's documented PROC_SAFE_NATIVE=off mode.
* fix(process): backport native Darwin group inspection Backport the process census and supervisor tests from #174147. The independent Doctor diagnostics and runtime-pin migration changes are excluded. (cherry picked from commit 6d50f72) * refactor(process): backport the shared Darwin inspection owner Backport the process owner, SDK exports, Codex consumer and their tests from #174284. The independent credential detection and onboarding changes are excluded. Preserve the release branch's unrelated diagnostic documentation. (cherry picked from commit 4959773) * refactor(process): share native macOS census across runtimes Backport #175368. Retain fs-safe 0.26.5 and adapt native census fixtures to the release branch. Carries the approved DarwinProcess uid-to-owner SDK migration; the following package pin completes the exit-window repair. (cherry picked from commit f236b19) * fix(codex): retry post-kill observations through the native exit window Backport #176576. Keep custody while retrying observations after our own SIGKILL within the existing containment deadline. (cherry picked from commit 5f94dfb) * fix(process): preserve macOS cleanup while unrelated processes exit Backport #176612. Pin proc-safe 0.4.2 and its exact native package exclusions, retain the real exiting-process regression, and align the SDK summary with native inspection on both runtimes. Retain the release branch's other dependency pins and exemptions. (cherry picked from commit 727c607) * test(process): reuse the process group inspection helper
Problem and change
macOS process inspection had separate Node and Bun implementations. Node relied on Apple's setuid
ps, which cannot execute inside Seatbelt. Pin proc-safe 0.4.1 and use its native census for both runtimes. Delete the Bun/libproc census and the Darwinpspaths; retain selected-PID queries, deadlines, explicit errors, and byte-compatible normalized UTCstartedAtidentities.Breaking Plugin SDK change:
DarwinProcessfromopenclaw/plugin-sdk/process-runtimereplacesuid: numberwithowner: "same" | "different" | "unknown". Migraterow.uid === process.getuid()torow.owner === "same"; unknown ownership is insufficient evidence.DarwinProcessInspectionErroraddscode: "ETIMEDOUT" | "EPERM" | "EIO". Bundled callers and documentation are migrated. No public function is added. Linux numeric UID behavior is preserved.The separate Bun socket-shutdown and SQLite FFI bindings are outside this change.
Proof
codex sandbox: Node and Bun, main thread and real Worker, full and selected census pass (8/8 calls); the fixture verifiespsis denied. After rebasing, one Node run correctly failed closed on an incomplete topology observation (EIO); the diagnostic census had no incomplete rows and the exact rerun passed. No fallback, retry, or budget change was added.process-runtime; generated shared declarations contain the new types.CI classification
Historical CI at the prior runtime head completed with nine failed test jobs. Matching same-period main or clean-main failures established inherited attribution for held-agent layout, empty model/reasoning selections, deferred
models.list, viewer replace-set timeout, memory cache overflow, Telegram model-catalog recovery, and lowercaseno_replydelivery.Composer layout-read measurement, streamed-delta batching, and young Telegram session-start conflict are unrelated flakes under the maintainer-approved Linux-equivalence classification. Their import graphs do reach changed shared modules. The Linux
/procproducer never setsowner; the existing numeric UID comparisons and the systemd helper's own UID guards preserve every Linux decision, while the addedowner === "different"terms are false. Clean-main probes passed these three cases. This is not a no-import-overlap claim, and failed CI is not relabeled as green. Detailed evidence: #175368 (comment).The original cutover omissions (deleted-file wrapper inventory and incomplete test mock exports) are fixed. Three local native provisioning timeouts at the unchanged 120-second budget remain documented; no assertions or budgets were weakened. External plugin source discovery is incomplete; the breaking SDK migration is explicit release-note context.
Final head CI
CI run 39160875395, attempt 1, tests head
78b7cb7738da9dcf7a7c6e0afba52a80063f4bfe: 174 successful jobs, 22 skipped jobs, one failed test job and its failed aggregate gate. Security, build, types, lint, lock validation, and UI pass.The sole failed test job is
checks-node-changed-16:gateway-timeout-recovery-subagent.e2e.test.tstimes out waiting for a terminal child's pending delivery to acquire a leasable payload. The test, registry reader and subagent owner are byte-identical to the tested main base. The run is Linux; this patch preserves Linux process decisions and proc-safe's Linux identity implementation. It is classified as an unrelated delivery failure under the maintainer-approved Linux-equivalence standard, not as a reproduced main failure. The automatic table marks it unknown because its changed-file shard has no matching main job. The native exception preserves the failed CI result and names this job and the downstreamopenclaw/ci-gate; no CI rerun or test-budget change is used.