fix(cli): block gateway-owned package updates#75819
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. #75691 gives a concrete systemd plus agent-exec no-marker path, and current main source still stops/updates based on service state without checking whether the active Gateway PID is in the caller ancestry. Next step before merge Security Review detailsBest possible solution: Land the narrow ancestry guard after rebase and exact-head CI, preserving the merged #75729 service-marker guard and the changelog entry. Do we have a high-confidence way to reproduce the issue? Yes. #75691 gives a concrete systemd plus agent-exec no-marker path, and current main source still stops/updates based on service state without checking whether the active Gateway PID is in the caller ancestry. Is this the best way to solve the issue? Yes. Reusing the existing bounded ancestry walker and refusing before service stop/package replacement is the narrow maintainable fix for this failure mode; a detached restart helper would be a larger separate design. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 0135071833b4. |
112ec87 to
44fb766
Compare
|
I reviewed/tested the related service-marker approach and found the critical lifecycle risk in live VPS testing: an updater launched from a Gateway-owned exec lane can stop the service that owns its process tree and then be SIGTERM’d before package replacement/restart completes. This PR fixes the underlying #75691 failure mode more directly by blocking before any service stop or package mutation when the active Gateway PID appears in the caller’s PPID ancestry. Live proof: targeted tests passed for So this is intentionally narrower than the service-marker PR: it does not try to redesign the post-core marker/runtime-state flow, it just closes the unsafe in-lane update path before the Gateway can kill its own updater. |
|
Live VPS validation on commit
This validates the #75691 failure mode directly: a package update launched from inside the active Gateway process tree is refused before service stop/package mutation, so the Gateway does not kill the updater or keep running stale code silently.
|
|
Thanks for opening this and for the live VPS proof. My read is that this PR is not a duplicate of #75729. They cover related but different safety signals:
Plan from my side:
So please keep this PR open. After rebase, it should remain intentionally narrow: block restartful package updates before service stop/package replacement when the active Gateway PID appears in the caller ancestry. |
44fb766 to
d7e3d6d
Compare
eb7f46f to
acdf73e
Compare
|
Merged via squash.
Thanks @ai-hpc! |
Merged via squash. Prepared head SHA: acdf73e Co-authored-by: ai-hpc <[email protected]> Co-authored-by: hxy91819 <[email protected]> Reviewed-by: @hxy91819
Merged via squash. Prepared head SHA: acdf73e Co-authored-by: ai-hpc <[email protected]> Co-authored-by: hxy91819 <[email protected]> Reviewed-by: @hxy91819
Merged via squash. Prepared head SHA: acdf73e Co-authored-by: ai-hpc <[email protected]> Co-authored-by: hxy91819 <[email protected]> Reviewed-by: @hxy91819
Merged via squash. Prepared head SHA: acdf73e Co-authored-by: ai-hpc <[email protected]> Co-authored-by: hxy91819 <[email protected]> Reviewed-by: @hxy91819
Merged via squash. Prepared head SHA: acdf73e Co-authored-by: ai-hpc <[email protected]> Co-authored-by: hxy91819 <[email protected]> Reviewed-by: @hxy91819

Summary
openclaw updateis running inside the active gateway process tree.Validation
pnpm exec oxfmt --check --threads=1 src/cli/update-cli/update-command.ts src/cli/update-cli.test.ts src/infra/restart-stale-pids.tsgit diff --checkpnpm test src/cli/update-cli.test.ts src/infra/restart-stale-pids.test.ts -- --reporter=verboseOPENCLAW_SERVICE_MARKER=openclaw OPENCLAW_SERVICE_KIND=gateway pnpm openclaw update --channel stable --tag latest --yesand confirmed the update aborts before package install/service stop.