Repository navigation
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: needs real behavior proof before merge. Reviewed October 5, 2026, 8:41 PM ET / October 6, 2026, 00:41 UTC (Revision 8). ClawSweeper reviewWhat this changesAdds a crash-isolated native macOS process-membership fallback and regression coverage so external callers can manage the Gateway when launchctl denies PID inspection. Merge readiness⛔ Blocked before merge - 5 items remain The fix remains necessary and has useful physical Monterey evidence. No actionable patch defect was found, but prior-instance child containment and actual installed-updater recovery remain unproven; the latest merge commit does not change the reviewed implementation. Priority: P1 Review scores
Verification
How this fits togetherGateway lifecycle and update commands check whether their caller belongs to the managed service before teardown. This subsystem supplies process-membership facts that let independent operators proceed while protecting service-contained callers. flowchart TD
A[Lifecycle or update command] --> B[Caller and Gateway processes]
B --> C[Process group and launchctl checks]
C -->|PID query denied| D[Isolated native coalition probe]
C --> E[Membership classification]
D --> E
E -->|External caller| F[Continue lifecycle operation]
E -->|Inside or unknown| G[Protect service from teardown]
Decision needed
Why: The contributor's source installation cannot supply the required cell, and unsupported-OS status does not authorize the reviewer to waive repository policy. Before merge
Agent review detailsSecurityNone. PR surfaceSource +90, Tests +81. Total +171 across 2 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one fail-closed membership owner, prove prior-instance child containment, and establish installed-updater recovery or record a narrow maintainer-approved proof exception. Do we have a high-confidence way to reproduce the issue? Yes: the reported Monterey launchctl denial maps directly to current main's unknown-membership refusal and is corroborated by physical hardware evidence. This read-only review did not execute the runtime. Is this the best way to solve the issue? Yes: extending the existing membership owner with crash-isolated native facts is a focused repair that preserves fail-closed behavior; the outstanding questions concern scoped proof. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b10601988195. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
bc6dab6 to
0e088c1
Compare
|
Hardware proof: macOS 12.7.6 Intel iMac. Host: Build tested: both open PRs (#163317 + #163358) cherry-picked onto Gateway stop/start/restart from an external Terminal (test plan step A3):
Supplementary evidence: With this PR applied, the native coalition fallback (coalition ID via Follow-up verification (test plan A4 / A4b / A5), same Monterey host:
Combined with the A3 and |
… PID domains On macOS 12, `launchctl print pid/<pid>` exits 1 (EPERM) for shells, Node, and launchd itself, so service membership stays unknown and `gateway stop`, `restart`, `install`/`uninstall`, and `update` refuse before teardown even from an external terminal. When launchctl exits non-zero, read each PID's resource coalition from the kernel (proc_pidinfo PROC_PIDCOALITIONINFO) and the job name from launchd (xpc_coalition_copy_info). The query runs through Koffi in a joined child process, because Koffi can segfault x86_64 workers under Rosetta; a crash only loses the observation. Equal coalition IDs or equal job names are inside, distinct IDs with distinct names are outside, and missing names, crashes, timeouts, or malformed output stay unknown, so teardown is still refused without native evidence. Fixes openclaw#160541
0e088c1 to
b23014e
Compare
|
Re: ClawSweeper's P1 "published-updater recovery" ask — not reachable from this reporter. The remaining proof gap asks for a transcript of an actual
The gap is therefore not a correctness or safety blocker; it is a request for a demonstration this reporter cannot stage. The hardware proof already provided covers the live scenarios users on Monterey actually encounter: the external-Terminal lifecycle commands ( Flagging for maintainer judgement whether the fix's correctness value (unblocking all gateway lifecycle commands on Monterey — the only route this reporter has to keep running at all) outweighs the one proof element that would require a non-source install this reporter does not have. |
… PID domains (#163317) On macOS 12, `launchctl print pid/<pid>` exits 1 (EPERM) for shells, Node, and launchd itself, so service membership stays unknown and `gateway stop`, `restart`, `install`/`uninstall`, and `update` refuse before teardown even from an external terminal. When launchctl exits non-zero, read each PID's resource coalition from the kernel (proc_pidinfo PROC_PIDCOALITIONINFO) and the job name from launchd (xpc_coalition_copy_info). The query runs through Koffi in a joined child process, because Koffi can segfault x86_64 workers under Rosetta; a crash only loses the observation. Equal coalition IDs or equal job names are inside, distinct IDs with distinct names are outside, and missing names, crashes, timeouts, or malformed output stay unknown, so teardown is still refused without native evidence. Fixes #160541 Co-authored-by: xXG0DLessXx <[email protected]> Co-authored-by: Dallin Romney <[email protected]> (cherry picked from commit e5b62e7)
… PID domains (#163317) On macOS 12, `launchctl print pid/<pid>` exits 1 (EPERM) for shells, Node, and launchd itself, so service membership stays unknown and `gateway stop`, `restart`, `install`/`uninstall`, and `update` refuse before teardown even from an external terminal. When launchctl exits non-zero, read each PID's resource coalition from the kernel (proc_pidinfo PROC_PIDCOALITIONINFO) and the job name from launchd (xpc_coalition_copy_info). The query runs through Koffi in a joined child process, because Koffi can segfault x86_64 workers under Rosetta; a crash only loses the observation. Equal coalition IDs or equal job names are inside, distinct IDs with distinct names are outside, and missing names, crashes, timeouts, or malformed output stay unknown, so teardown is still refused without native evidence. Fixes #160541 Co-authored-by: xXG0DLessXx <[email protected]> Co-authored-by: Dallin Romney <[email protected]> (cherry picked from commit e5b62e7)
… PID domains (openclaw#163317) On macOS 12, `launchctl print pid/<pid>` exits 1 (EPERM) for shells, Node, and launchd itself, so service membership stays unknown and `gateway stop`, `restart`, `install`/`uninstall`, and `update` refuse before teardown even from an external terminal. When launchctl exits non-zero, read each PID's resource coalition from the kernel (proc_pidinfo PROC_PIDCOALITIONINFO) and the job name from launchd (xpc_coalition_copy_info). The query runs through Koffi in a joined child process, because Koffi can segfault x86_64 workers under Rosetta; a crash only loses the observation. Equal coalition IDs or equal job names are inside, distinct IDs with distinct names are outside, and missing names, crashes, timeouts, or malformed output stay unknown, so teardown is still refused without native evidence. Fixes openclaw#160541 Co-authored-by: xXG0DLessXx <[email protected]> Co-authored-by: Dallin Romney <[email protected]>
… PID domains (openclaw#163317) On macOS 12, `launchctl print pid/<pid>` exits 1 (EPERM) for shells, Node, and launchd itself, so service membership stays unknown and `gateway stop`, `restart`, `install`/`uninstall`, and `update` refuse before teardown even from an external terminal. When launchctl exits non-zero, read each PID's resource coalition from the kernel (proc_pidinfo PROC_PIDCOALITIONINFO) and the job name from launchd (xpc_coalition_copy_info). The query runs through Koffi in a joined child process, because Koffi can segfault x86_64 workers under Rosetta; a crash only loses the observation. Equal coalition IDs or equal job names are inside, distinct IDs with distinct names are outside, and missing names, crashes, timeouts, or malformed output stay unknown, so teardown is still refused without native evidence. Fixes openclaw#160541 Co-authored-by: xXG0DLessXx <[email protected]> Co-authored-by: Dallin Romney <[email protected]> (cherry picked from commit e5b62e7) (cherry picked from commit 6ff1e40) Co-authored-by: RomneyDa <[email protected]>
Closes #160541
What Problem This Solves
Fixes
openclaw gateway stop,gateway restart,gateway install/uninstall, andopenclaw updaterefusing withservice-membership-unverifiedon macOS 12 Monterey, even when run from an independent Terminal window.User Impact
Operators running the managed LaunchAgent Gateway on macOS 12 can stop, restart, reinstall, and update it through the supported CLI again instead of falling back to
launchctl bootoutorkickstart. Behavior on newer macOS, and whereverlaunchctl print pid/<pid>succeeds, is unchanged.Update behavior: the updater already installed on a Monterey host is the unfixed code, so
openclaw updatestill refuses while that Gateway is running and cannot pick up this fix by itself. Its preflight runs the membership check only for a running service, so the one-time recovery is:launchctl bootout gui/$(id -u)/ai.openclaw.gateway openclaw update openclaw gateway startSource checkouts can instead pull, rebuild, and run the new CLI. Lifecycle commands and updates work normally after that.
Why This Change Was Made
On macOS 12,
launchctl print pid/<pid>exits 1 withOperation not permittedfor shells, Node, and even launchd (PID 1). The membership probe therefore could not tell whether the caller was inside the Gateway's launchd job, so it treated the result as unknown and refused before teardown.When launchctl exits non-zero, the probe now reads the same membership facts natively. It gets each PID's resource coalition ID from the kernel (
proc_pidinfowithPROC_PIDCOALITIONINFO) and the coalition's job name from launchd (xpc_coalition_copy_info). This follows the “verified native membership” direction in the issue review rather than the process-group shortcut it rejected.The issue's follow-up comment refers to an earlier native fallback, 6e12d07. That commit exists only on the unmerged #133215 branch, and it ran only when launchctl succeeded without coalition output, so it would not cover this failure. This PR is self-contained and does not change
src/shared/pid-alive.ts.Evidence
src/daemon/service-process-membership.test.tscover an external terminal (outside), the same coalition (inside), a child of an earlier Gateway instance (inside), and five fail-closed cases: missing job names, a crashed probe, an invalid ID, unparseable output, and a launchctl timeout that must not trigger the fallback. With the source change reverted, the three classification cases fail and the five fail-closed cases still pass, as intended.service-process-membership.test.tsandlaunchd-service-membership.test.tspass, 109 tests total.node scripts/run-vitest.mjs <both files> --maxWorkers=1took 115 s wall on a slow laptop, almost all of it transform; each new case runs in about 5 ms.pnpm tsgo:coreandtsconfig.core.test.services.jsontypecheck pass, andoxlintis clean on both files./usr/lib/libproc.dylib, which is the expected non-macOS outcome.xnu-8020) markPROC_PIDCOALITIONINFOasNO_CHECK_SAME_USER, andstruct proc_pidcoalitioninfois twouint64coalition IDs (resource first) plus three reserveduint64s, which is 40 bytes.launchctl print pid/$$reproduces the EPERM failure. A source build containing this commit then completed external-Terminalgateway stopandgateway restart, anddoctor --fixcompleted its managed-Gateway stop path. An agent exec caller from the current Gateway remained refused. Full transcript: fix(daemon): gateway stop, restart, and update refuse on macOS 12 Monterey #163317 (comment)Remaining proof limitation
The Monterey host is a source installation, so it cannot supply the repository's published-driver → candidate updater cell. The old updater's manual
launchctl bootoutrecovery was verified through dry-run preflight, but not through an actual published-package-to-candidate installation. The code remains fail closed if native facts are unavailable, and the limitation does not weaken the service-containment invariant.