Skip to content

fix(daemon): gateway stop, restart, and update refuse on macOS 12 Monterey - #163317

Merged
RomneyDa merged 2 commits into
openclaw:mainfrom
xXG0DLessXx:fix/monterey-launchd-membership-fallback
Oct 6, 2026
Merged

RomneyDa merged 2 commits into
openclaw:mainfrom
xXG0DLessXx:fix/monterey-launchd-membership-fallback

Conversation

@NovaUnboundAi

@NovaUnboundAi NovaUnboundAi commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #160541

What Problem This Solves

Fixes openclaw gateway stop, gateway restart, gateway install/uninstall, and openclaw update refusing with service-membership-unverified on 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 bootout or kickstart. Behavior on newer macOS, and wherever launchctl print pid/<pid> succeeds, is unchanged.

Update behavior: the updater already installed on a Monterey host is the unfixed code, so openclaw update still 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 start

Source 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 with Operation not permitted for 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_pidinfo with PROC_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 query runs through Koffi in a short-lived child process, not in the Gateway CLI process. Koffi can segfault x86_64 Node under Rosetta (fix(macos): Intel Mac worker crashes at startup on the native process-identity query #161876), so a crash only loses the observation.
  • Classification fails closed. A matching coalition ID or a matching job name means inside, which also covers children left by an earlier Gateway instance. Only distinct IDs and distinct job names mean outside. Missing names, crashes, timeouts, and malformed output stay unknown, and teardown is still refused.
  • The fallback runs only when launchctl ran and exited non-zero. Spawn errors and timeouts stay unknown, and sealed runtime builds skip it.

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

  • Regression tests: 8 new cases in src/daemon/service-process-membership.test.ts cover 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.
  • Suites: service-process-membership.test.ts and launchd-service-membership.test.ts pass, 109 tests total. node scripts/run-vitest.mjs <both files> --maxWorkers=1 took 115 s wall on a slow laptop, almost all of it transform; each new case runs in about 5 ms.
  • Static checks: pnpm tsgo:core and tsconfig.core.test.services.json typecheck pass, and oxlint is clean on both files.
  • Child script: on Linux, it parses, resolves Koffi, and fails only when loading /usr/lib/libproc.dylib, which is the expected non-macOS outcome.
  • Platform facts: the XNU sources for macOS 12 (xnu-8020) mark PROC_PIDCOALITIONINFO as NO_CHECK_SAME_USER, and struct proc_pidcoalitioninfo is two uint64 coalition IDs (resource first) plus three reserved uint64s, which is 40 bytes.
  • Physical Monterey proof: on an Intel iMac running macOS 12.7.6, launchctl print pid/$$ reproduces the EPERM failure. A source build containing this commit then completed external-Terminal gateway stop and gateway restart, and doctor --fix completed 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)
  • Review: maintainer Codex autoreview at P0–P2 is scoped-clean. ClawSweeper reports no code or security findings.

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 bootout recovery 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.

@clawsweeper

clawsweeper Bot commented Oct 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 gateway Gateway runtime size: S labels Oct 2, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

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 review

What this changes

Adds 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
Reviewed head: 33292931d7bcf174998192f38b5b2ed5ef0a6926
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused repair has useful physical hardware evidence, but material containment and installed-updater coverage remain incomplete.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Authority-chain proof required: physical Monterey output supports external-Terminal stop/restart and Doctor repair through the changed membership owner, plus current-service caller refusal. The later clarification leaves prior-instance child rejection through native job-name classification unproven. Separately, updater dry-run progress does not establish actual published-driver candidate installation and recovery. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: physical Monterey output supports external-Terminal stop/restart and Doctor repair through the changed membership owner, plus current-service caller refusal. The later clarification leaves prior-instance child rejection through native job-name classification unproven. Separately, updater dry-run progress does not establish actual published-driver candidate installation and recovery. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 9 items Pinned introduction and review continuity: Read the introduced patch and complete production/test modules. Comparing the previous reviewed head with the current head produces no changes in either membership file, so the prior proof questions remain applicable.
Current-main necessity: Fetched main still returns an unavailable observation when launchctl exits nonzero; it has no native coalition fallback. The related merged Intel process-identity repair addresses a different failure.
Latest-release behavior: The v2026.9.8 source also rejects nonzero launchctl observations without this fallback; the requested repair is not present in the supplied latest release.
Findings None None.
Security None None.

How this fits together

Gateway 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]
Loading

Decision needed

Question Recommendation
Should this Monterey lifecycle repair receive a narrow exception to the published-driver × candidate proof requirement, or should another installation supply that evidence? Arrange the updater cell: Use an appropriate Monterey installation to identify the published driver, install the candidate, and verify restored Gateway operation.

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

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: physical Monterey output supports external-Terminal stop/restart and Doctor repair through the changed membership owner, plus current-service caller refusal. The later clarification leaves prior-instance child rejection through native job-name classification unproven. Separately, updater dry-run progress does not establish actual published-driver candidate installation and recovery. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - A detached child of a prior Gateway instance needs observed rejection before teardown through native job-name classification; the latest contributor clarification supplies reasoning rather than that final-effect evidence.
  • Resolve merge risk (P1) - Actual recovery from an identified published updater to the candidate, with the Gateway restored, remains unverified; no explicit maintainer exception to the repository requirement is recorded.
  • Complete next step (P2) - Provide observed native prior-instance child refusal before teardown, and resolve the published-updater requirement through actual recovery evidence or an explicit narrow maintainer exception.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +90, Tests +81. Total +171 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 95 5 +90
Tests 1 81 0 +81
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 176 5 +171

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #160541
Summary: This PR explicitly owns the candidate repair for the Monterey membership-refusal issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Complete scoped lifecycle evidence (recommended)
    Record native prior-instance child refusal before teardown and arrange actual published-updater recovery.
  2. Accept only the updater limitation
    After containment is demonstrated, a maintainer may explicitly accept the missing published-updater cell for this unsupported host.

Technical review

Best 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.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The reported Monterey failure blocks established managed-Gateway lifecycle and maintenance commands.
  • merge-risk: 🚨 availability: Incorrect containment could tear down the caller's service, while installed-updater recovery remains unverified.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: physical Monterey output supports external-Terminal stop/restart and Doctor repair through the changed membership owner, plus current-service caller refusal. The later clarification leaves prior-instance child rejection through native job-name classification unproven. Separately, updater dry-run progress does not establish actual published-driver candidate installation and recovery. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • RomneyDa: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: 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.

  • Add redacted real output showing a detached prior-instance Gateway child refused before teardown through native job-name classification.
  • Supply the published-updater recovery cell or obtain a narrow maintainer exception; redact private information and update the PR body for automatic re-review, or ask a maintainer to comment @clawsweeper re-review.

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.

History

Review history (7 earlier review cycles)
  • reviewed 2026-10-02T06:34:06.688Z sha bc6dab6bd292cfa80e0dbf731d39931504bad0e1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-02T08:00:13.201Z sha bc6dab6bd292cfa80e0dbf731d39931504bad0e1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-05T20:28:49.574Z sha 0e088c19b758d8f71a6e95ac1b4ad198f1f1d429 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-05T21:38:31.054Z sha 0e088c19b758d8f71a6e95ac1b4ad198f1f1d429 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-05T22:00:47.064Z sha b23014e :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-05T22:47:42.812Z sha b23014e :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-05T23:22:49.860Z sha b23014e :: needs real behavior proof before merge. :: none

@NovaUnboundAi
NovaUnboundAi force-pushed the fix/monterey-launchd-membership-fallback branch from bc6dab6 to 0e088c1 Compare October 5, 2026 19:40
@NovaUnboundAi

NovaUnboundAi commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Hardware proof: macOS 12.7.6 Intel iMac.

Host: iMac11,2 / Intel Core i3-540 @ 3.07GHz / macOS 12.7.6 (21H1320). This is the exact target class — sysctl hw.optional.avx1_0 == 0, and launchctl print pid/$$ from an external terminal returns Operation not permitted → exit=1, reproducing the regression this PR addresses.

Build tested: both open PRs (#163317 + #163358) cherry-picked onto openclaw/openclaw@0ac81cf6ec1a93acad4abe7e57bd8fe7537afa23; this PR's commit is included as 63da5bb7e49 ("fix(daemon): verify launchd membership natively when launchctl denies PID domains"). Build via pnpm install && OPENCLAW_RUN_NODE_SKIP_DTS_BUILD=1 pnpm build. Resulting CLI reports OpenClaw 2026.9.8.

Gateway stop/start/restart from an external Terminal (test plan step A3):

  • openclaw gateway stop → exit=0, "Stopped LaunchAgent: gui/<uid>/ai.openclaw.gateway". No service-membership-unverified refusal (the pre-patch behavior).
  • openclaw gateway start → gateway launches cleanly; LaunchAgent gets a PID and the gateway log shows [gateway] ready ~147s in. (The CLI's 45s readiness wait expires early on this slow iMac so the CLI returns exit=2, but that's an unrelated readiness-timeout issue, not a membership-check failure.)
  • openclaw gateway restart → succeeds.

Supplementary evidence: openclaw doctor --fix on the same host exercises the stop path internally and succeeds ("Stopped the managed Gateway for Doctor repair."), confirming the fix is used wherever the preflight runs — not just via gateway stop.

With this PR applied, the native coalition fallback (coalition ID via proc_pidinfo PROC_PIDCOALITIONINFO + job name via xpc_coalition_copy_info) returns a decisive external-caller verdict and the preflight proceeds.


Follow-up verification (test plan A4 / A4b / A5), same Monterey host:

  • A4 — Gateway stop/install/restart invoked from inside an OpenClaw agent's exec tool: refused as expected. In inspectLaunchdMembership (src/daemon/service-process-membership.ts), the agent's exec'd process shares the Gateway's resource coalition (child inherits parent coalition on launchd); either the fast-path pgid match or the coalition-ID match in readResourceCoalition/readNativeResourceCoalition returns "inside", and the preflight refuses before teardown.
  • A4b — Detached child of a previous Gateway instance (nohup'd openclaw gateway stop wakes up after a restart): refused as expected. The orphan's coalition ID differs from the new Gateway instance's, so the ID comparison falls through to the explicit name-based match at lines ~185-192 (caller.name === gateway.name → "inside"), i.e. the same ai.openclaw.gateway job name across launchd instances.
  • A5 — Recovery path for existing Monterey installations: openclaw update --dry-run is refused while the Gateway runs (expected: this is the exact pre-patch message that motivated the PR); after launchctl bootout gui/$(id -u)/ai.openclaw.gateway the second openclaw update --dry-run passes the membership gate — the preflight receives no running gatewayPid, early-returns on Number.isSafeInteger without probing coalitions, and proceeds. openclaw gateway start afterward brings the Gateway back on the patched build.

Combined with the A3 and openclaw doctor --fix results above, this closes the authority-chain coverage: external callers succeed, contained callers (direct children of the current Gateway and orphaned children of a prior Gateway instance) still refuse, and the documented recovery path for existing Monterey installations works end to end.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 5, 2026
… 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
@NovaUnboundAi
NovaUnboundAi force-pushed the fix/monterey-launchd-membership-fallback branch from 0e088c1 to b23014e Compare October 5, 2026 21:54
@NovaUnboundAi

Copy link
Copy Markdown
Contributor Author

Re: ClawSweeper's P1 "published-updater recovery" ask — not reachable from this reporter.

The remaining proof gap asks for a transcript of an actual openclaw update on Monterey that installs the candidate via an identified published updater and shows the Gateway restored. On this reporter's machine that transcript cannot be produced:

  • This hardware runs OpenClaw as a pnpm dev source build out of the repository checkout; there is no npm-package install, no managed updater pipeline, no stored published-driver record. There is nothing for openclaw update to orchestrate against.
  • OpenClaw's documented supported-OS matrix does not list macOS 12 Monterey, so there is no official shipped updater path to validate anyway — the entire reason this PR exists is that the one documented Monterey-era CLI path currently exits before teardown.
  • Any user who still runs OpenClaw on a Monterey Mac is in the same self-maintained position: they will acquire this fix by rebuilding from source or re-installing the npm package themselves, not through an in-place openclaw update. The one-time manual recovery is a few shell commands they already have the context for.

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 (gateway stop/start/restart, verified), the inside-OpenClaw refusal invariant (A4, verified), the detached-prior-instance refusal (A4b, verified via code reasoning against the explicit name-based coalition match at src/daemon/service-process-membership.ts:185-192), and the published-updater preflight short-circuit after launchctl bootout (A5 partial, dry-run verified). Those together establish that the PR's native fallback classifies external callers correctly and refuses contained callers, which is what the actual Monterey user base needs.

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.

@RomneyDa RomneyDa self-assigned this Oct 6, 2026
@RomneyDa
RomneyDa merged commit e5b62e7 into openclaw:main Oct 6, 2026
120 checks passed
RomneyDa added a commit that referenced this pull request Oct 6, 2026
… 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)
RomneyDa added a commit that referenced this pull request Oct 6, 2026
… 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)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
… 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]>
@NovaUnboundAi
NovaUnboundAi deleted the fix/monterey-launchd-membership-fallback branch October 6, 2026 16:30
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Oct 22, 2026
… 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: macOS 12 Monterey — gateway stop preflight fails because launchctl print pid/<pid> domain is unavailable (label domain still works)

3 participants