Skip to content

fix(update): detect nested macOS gateway ancestry#85391

Merged
vincentkoc merged 3 commits into
mainfrom
fix/macos-nested-update-ancestor
May 22, 2026
Merged

fix(update): detect nested macOS gateway ancestry#85391
vincentkoc merged 3 commits into
mainfrom
fix/macos-nested-update-ancestor

Conversation

@vincentkoc

@vincentkoc vincentkoc commented May 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Walk the macOS process parent chain with ps so nested updater children inherit the existing gateway-ancestry block before package updates stop the managed Gateway service.
  • Mark service-mode Gateway descendants with the live Gateway runtime PID and strip that marker before post-core update children are spawned, giving sandboxed updater grandchildren a trusted fallback when process ancestry is truncated.
  • Thread the caller spawn timeout through macOS ancestry probes and add regression coverage for nested macOS updater ancestry, inherited runtime PID blocking, timeout plumbing, and the changelog entry.
  • Refresh npm shrinkwraps for the CI npm version.

Fixes #85120.

Verification

  • node scripts/run-vitest.mjs src/cli/update-cli.test.ts src/infra/restart.test.ts src/infra/restart-stale-pids.test.ts src/cli/gateway-cli/run.option-collisions.test.ts test/scripts/install-ps1.test.ts -- -t "runtime pid|ancestor|gateway process tree|managed gateway service|service-mode gateway descendants|poll timeout|caller timeout|explicit port override|portable Node"
  • node scripts/run-vitest.mjs test/scripts/install-ps1.test.ts -- -t "portable Node"
  • node scripts/run-oxlint.mjs test/scripts/install-ps1.test.ts CHANGELOG.md src/daemon/constants.ts src/cli/gateway-cli/run.ts src/cli/gateway-cli/run.option-collisions.test.ts src/cli/update-cli/update-command.ts src/cli/update-cli.test.ts src/infra/restart.test.ts src/infra/restart-stale-pids.ts src/infra/restart-stale-pids.test.ts
  • ./node_modules/.bin/oxfmt --check --threads=1 test/scripts/install-ps1.test.ts CHANGELOG.md src/daemon/constants.ts src/cli/gateway-cli/run.ts src/cli/gateway-cli/run.option-collisions.test.ts src/cli/update-cli/update-command.ts src/cli/update-cli.test.ts src/infra/restart.test.ts src/infra/restart-stale-pids.ts src/infra/restart-stale-pids.test.ts
  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfo
  • git diff --check
  • git diff --check origin/main...HEAD
  • tmp_npm_dir=$(mktemp -d /tmp/openclaw-npm-11.6.2-rerebased-check.XXXXXX) && npm install --prefix "$tmp_npm_dir" [email protected] >/dev/null && PATH="$tmp_npm_dir/node_modules/.bin:$PATH" node scripts/generate-npm-shrinkwrap.mjs --all --check
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main -> clean, no accepted/actionable findings; overall patch is correct (0.78).

Blocked validation:

  • OPENCLAW_TESTBOX=1 pnpm check:changed could not run here because local pnpm attempted a dependency repair/install before invoking the script. The direct Testbox wrapper path then failed because this shell is not authenticated with Blacksmith (blacksmith auth login required).
  • Live Crabbox mac proof is blocked in this shell: Crabbox has no coordinator/broker configured, and the configured Hetzner provider has no token.

@clawsweeper

clawsweeper Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Latest ClawSweeper review: 2026-05-22 15:51 UTC / May 22, 2026, 11:51 AM ET.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • 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.

Summary
The branch adds macOS process ancestry walking, inherited Gateway runtime PID blocking, regression tests, changelog text, and refreshed npm shrinkwrap metadata.

Reproducibility: no. high-confidence live macOS reproduction was run in this read-only review. The source path is credible because current main checks only the service runtime PID against the caller/ancestor set while macOS ancestry currently stops at process.ppid.

PR rating
Overall: 🦐 gold shrimp
Proof: 🌊 off-meta tidepool
Patch quality: 🦐 gold shrimp
Summary: The core fix is focused and tested, but merge confidence is limited by fail-closed behavior, missing live macOS proof, and broad shrinkwrap metadata changes.

Rank-up moves:

  • Review or split the shrinkwrap refresh with dependency/security evidence.
  • Add redacted macOS LaunchAgent proof for the nested in-band refusal path.
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

Real behavior proof
Not applicable: The PR is maintainer-authored, so the external-contributor real-behavior proof gate does not apply; live macOS LaunchAgent proof would still reduce merge risk.

Mantis proof suggestion
A real macOS LaunchAgent run would materially prove the nested in-band update refusal before the gateway is stopped. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

visual task: on macOS LaunchAgent, invoke openclaw update from a nested gateway-owned tool child and verify it refuses before stopping the gateway.

Risk before merge

  • Merging intentionally makes nested macOS in-band openclaw update invocations fail closed before the managed service stop path, so affected operators need an external shell or a future durable handoff flow.
  • The branch changes published root and bundled-plugin npm shrinkwrap metadata, which is a supply-chain review surface even if the observed diff is metadata-only.
  • No live macOS LaunchAgent run was available in this review, so the nested process-tree refusal path is supported by source inspection and mocked tests rather than packaged macOS proof.

Maintainer options:

  1. Review or split shrinkwrap refresh (recommended)
    Have the dependency/security owner verify the generated shrinkwrap deltas with release-style evidence, or remove those files from this bugfix and handle them separately.
  2. Prove the macOS refusal path
    Run a real macOS LaunchAgent nested in-band update and show that the command refuses before the Gateway receives SIGTERM.
  3. Accept fail-closed update behavior
    Maintainers may intentionally land the ancestry guard if they accept that nested in-band macOS updates now require an external shell or future handoff flow.

Next step before merge
Protected maintainer PR with dependency metadata and fail-closed behavior that need human acceptance rather than a narrow automated repair.

Security
Needs attention: The runtime code does not show a direct secret-handling regression, but the cross-package npm shrinkwrap refresh needs dependency/security review before merge.

Review details

Best possible solution:

Land the ancestry/refusal fix after dependency/security review or split-out of the shrinkwrap refresh, with maintainer acceptance of the fail-closed macOS behavior and preferably redacted macOS LaunchAgent proof.

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

No high-confidence live macOS reproduction was run in this read-only review. The source path is credible because current main checks only the service runtime PID against the caller/ancestor set while macOS ancestry currently stops at process.ppid.

Is this the best way to solve the issue?

Partly yes: the refusal path is a narrow maintainable fix for the immediate gateway-kill hazard, but maintainers still need to accept fail-closed behavior and review or split the shrinkwrap refresh.

Label justifications:

  • P1: The linked bug can terminate the managed gateway/session path during a macOS in-band update.
  • merge-risk: 🚨 compatibility: The PR intentionally changes nested macOS in-band update behavior to refuse before stopping the service.
  • merge-risk: 🚨 security-boundary: The PR changes published npm shrinkwrap metadata across root and bundled plugins, which is a supply-chain review surface.
  • rating: 🦐 gold shrimp: Current PR rating is 🦐 gold shrimp because proof is 🌊 off-meta tidepool, patch quality is 🦐 gold shrimp, and The core fix is focused and tested, but merge confidence is limited by fail-closed behavior, missing live macOS proof, and broad shrinkwrap metadata changes.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The PR is maintainer-authored, so the external-contributor real-behavior proof gate does not apply; live macOS LaunchAgent proof would still reduce merge risk.

Security concerns:

  • [medium] Review generated shrinkwrap metadata changes — npm-shrinkwrap.json:895
    The PR changes root and bundled-plugin npm-shrinkwrap files; even when versions and integrities appear unchanged, published install metadata is a supply-chain surface that maintainers should verify or split from the runtime bug fix.
    Confidence: 0.79

Acceptance criteria:

  • node scripts/run-vitest.mjs src/cli/update-cli.test.ts src/infra/restart.test.ts src/infra/restart-stale-pids.test.ts src/cli/gateway-cli/run.option-collisions.test.ts test/scripts/install-ps1.test.ts -- -t "runtime pid|ancestor|gateway process tree|managed gateway service|service-mode gateway descendants|poll timeout|caller timeout|explicit port override|portable Node"
  • node scripts/run-oxlint.mjs test/scripts/install-ps1.test.ts CHANGELOG.md src/daemon/constants.ts src/cli/gateway-cli/run.ts src/cli/gateway-cli/run.option-collisions.test.ts src/cli/update-cli/update-command.ts src/cli/update-cli.test.ts src/infra/restart.test.ts src/infra/restart-stale-pids.ts src/infra/restart-stale-pids.test.ts
  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfo
  • node scripts/generate-npm-shrinkwrap.mjs --all --check

What I checked:

  • Current main ancestry guard is limited: Current main blocks a package update only when the service runtime PID is in getSelfAndAncestorPidsSync(), and current macOS ancestry collection stops at process.ppid. (src/cli/update-cli/update-command.ts:773, 5cc0dbce8628)
  • PR adds macOS parent-chain probing: The PR adds readParentPidFromPs(), routes darwin ancestry through ps with the caller timeout, and passes that timeout into parsePidsFromLsofOutput(). (src/infra/restart-stale-pids.ts:107, 1e0e000d7671)
  • PR adds inherited runtime PID fallback: The update guard now accepts a parsed OPENCLAW_GATEWAY_SERVICE_PID when the process still carries the gateway service marker, covering truncated ancestry cases. (src/cli/update-cli/update-command.ts:792, 1e0e000d7671)
  • PR strips the inherited marker before post-core children: The post-core update child environment deletes OPENCLAW_SERVICE_MARKER, OPENCLAW_SERVICE_KIND, and OPENCLAW_GATEWAY_SERVICE_PID so the updated child does not inherit the in-band block marker. (src/cli/update-cli/update-command.ts:1083, 1e0e000d7671)
  • Regression coverage was added: The PR adds tests for macOS nested ancestor exclusion, inherited runtime PID refusal, marker stripping, and service-mode runtime PID marking. (src/cli/update-cli.test.ts:2050, 1e0e000d7671)
  • Shrinkwrap refresh is broad generated metadata: The PR changes 13 npm-shrinkwrap files; inspection found peer/libc metadata churn and no version/resolved/integrity line changes in the shrinkwrap diff. (npm-shrinkwrap.json:895, 1e0e000d7671)

Likely related people:

  • steipete: git blame attributes the current package-update ancestry guard, managed service stop path, and service-mode cleanup call sites to f4bdfd4, and cc7e616 previously hardened service-mode stale process cleanup. (role: introduced/current behavior owner; confidence: high; commits: f4bdfd46a99a, cc7e61612aa8; files: src/cli/update-cli/update-command.ts, src/infra/restart-stale-pids.ts, src/cli/gateway-cli/run.ts)
  • vincentkoc: git history shows prior merged package-update cutover work in a15797a, and this branch continues that updater/service boundary work. (role: recent area contributor; confidence: high; commits: a15797ad1129, 1e0e000d7671; files: src/cli/update-cli/update-command.ts, src/cli/update-cli.test.ts, src/cli/gateway-cli/run.ts)
  • openperf: 8aadca4 introduced the ancestor-PID exclusion logic that this PR extends from Linux/direct-parent coverage into macOS nested ancestry. (role: adjacent behavior introducer; confidence: medium; commits: 8aadca4c3e47; files: src/infra/restart-stale-pids.ts, src/infra/restart-stale-pids.test.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 5cc0dbce8628.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels May 22, 2026
@clawsweeper

clawsweeper Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🔥 Warming up: real-behavior proof passed; findings, security review, or rank-up moves are still in progress.

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.
What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@vincentkoc
vincentkoc force-pushed the fix/macos-nested-update-ancestor branch from 973912d to c39ff31 Compare May 22, 2026 14:25
@vincentkoc
vincentkoc marked this pull request as ready for review May 22, 2026 14:25
@vincentkoc
vincentkoc force-pushed the fix/macos-nested-update-ancestor branch 2 times, most recently from f4afc29 to 8cceb8d Compare May 22, 2026 14:41
@vincentkoc
vincentkoc requested a review from a team as a code owner May 22, 2026 14:46
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label May 22, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: slack Channel integration: slack channel: whatsapp-web Channel integration: whatsapp-web and removed dependencies-changed PR changes dependency-related files labels May 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Changes Detected

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • extensions/acpx/npm-shrinkwrap.json
  • extensions/amazon-bedrock-mantle/npm-shrinkwrap.json
  • extensions/amazon-bedrock/npm-shrinkwrap.json
  • extensions/anthropic-vertex/npm-shrinkwrap.json
  • extensions/codex/npm-shrinkwrap.json
  • extensions/diagnostics-otel/npm-shrinkwrap.json
  • extensions/diffs/npm-shrinkwrap.json
  • extensions/discord/npm-shrinkwrap.json
  • extensions/memory-lancedb/npm-shrinkwrap.json
  • extensions/slack/npm-shrinkwrap.json
  • extensions/twitch/npm-shrinkwrap.json
  • extensions/whatsapp/npm-shrinkwrap.json
  • npm-shrinkwrap.json

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfile, shrinkwrap, or workspace dependency policy changes are present.
  • Treat package-lock.json and npm-shrinkwrap.json diffs as security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@socket-security

socket-security Bot commented May 22, 2026

Copy link
Copy Markdown

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels May 22, 2026
@vincentkoc
vincentkoc force-pushed the fix/macos-nested-update-ancestor branch from ea31647 to f754bab Compare May 22, 2026 15:05
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels May 22, 2026
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes size: M and removed size: S labels May 22, 2026
@vincentkoc
vincentkoc force-pushed the fix/macos-nested-update-ancestor branch 2 times, most recently from f99a3d6 to 100b8dd Compare May 22, 2026 15:21
@vincentkoc
vincentkoc force-pushed the fix/macos-nested-update-ancestor branch from 100b8dd to 1e0e000 Compare May 22, 2026 15:44
@vincentkoc
vincentkoc merged commit adc6adc into main May 22, 2026
161 of 166 checks passed
@vincentkoc
vincentkoc deleted the fix/macos-nested-update-ancestor branch May 22, 2026 16:00
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
* fix(update): detect nested macOS gateway ancestry

* fix(release): refresh shrinkwrap for CI npm

* fix(update): inherit gateway runtime pid for update guard
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
* fix(update): detect nested macOS gateway ancestry

* fix(release): refresh shrinkwrap for CI npm

* fix(update): inherit gateway runtime pid for update guard
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
* fix(update): detect nested macOS gateway ancestry

* fix(release): refresh shrinkwrap for CI npm

* fix(update): inherit gateway runtime pid for update guard
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* fix(update): detect nested macOS gateway ancestry

* fix(release): refresh shrinkwrap for CI npm

* fix(update): inherit gateway runtime pid for update guard
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 25, 2026
* fix(update): detect nested macOS gateway ancestry

* fix(release): refresh shrinkwrap for CI npm

* fix(update): inherit gateway runtime pid for update guard
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
* fix(update): detect nested macOS gateway ancestry

* fix(release): refresh shrinkwrap for CI npm

* fix(update): inherit gateway runtime pid for update guard
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
* fix(update): detect nested macOS gateway ancestry

* fix(release): refresh shrinkwrap for CI npm

* fix(update): inherit gateway runtime pid for update guard
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
* fix(update): detect nested macOS gateway ancestry

* fix(release): refresh shrinkwrap for CI npm

* fix(update): inherit gateway runtime pid for update guard
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
* fix(update): detect nested macOS gateway ancestry

* fix(release): refresh shrinkwrap for CI npm

* fix(update): inherit gateway runtime pid for update guard
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
* fix(update): detect nested macOS gateway ancestry

* fix(release): refresh shrinkwrap for CI npm

* fix(update): inherit gateway runtime pid for update guard
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* fix(update): detect nested macOS gateway ancestry

* fix(release): refresh shrinkwrap for CI npm

* fix(update): inherit gateway runtime pid for update guard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord channel: slack Channel integration: slack channel: twitch Channel integration: twitch channel: whatsapp-web Channel integration: whatsapp-web cli CLI command changes dependencies-changed PR changes dependency-related files extensions: acpx extensions: amazon-bedrock extensions: anthropic-vertex extensions: codex extensions: diagnostics-otel Extension: diagnostics-otel extensions: diffs extensions: memory-lancedb Extension: memory-lancedb gateway Gateway runtime 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: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: in-band openclaw update on macOS LaunchAgent can stop the gateway supervising it

1 participant