fix(update): escape systemd update handoffs#85414
Conversation
|
Codex review: needs maintainer review before merge. Latest ClawSweeper review: 2026-05-24 01:31 UTC / May 23, 2026, 9:31 PM ET. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
PR Surface View PR surface stats
Summary Reproducibility: yes. The linked issue gives a concrete Linux user-systemd failure, and current main/release source still starts the helper as a plain detached child before restarting; I did not rerun the live current-main failure in this read-only review. PR rating Rank-up moves:
What the crustacean ranks mean
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 Risk before merge
Maintainer options:
Next step before merge Security Review detailsBest possible solution: Land the transient user-scope handoff after maintainer review and normal CI, preserving the existing non-systemd paths and treating any helper-never-ran diagnostic as a separate follow-up if needed. Do we have a high-confidence way to reproduce the issue? Yes. The linked issue gives a concrete Linux user-systemd failure, and current main/release source still starts the helper as a plain detached child before restarting; I did not rerun the live current-main failure in this read-only review. Is this the best way to solve the issue? Yes. Moving only the systemd supervisor path to Label changes:
Label justifications:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against d92501dbf34e. |
|
ClawSweeper PR egg ✨ Hatched: ✨ glimmer Velvet Review Wisp Hatch commandComment Hatchability rules:
Rarity: ✨ glimmer. What is this egg doing here?
|
Real behavior proof: systemd handoff survives gateway service restartBehavior addressed: Update handoff helper is launched outside the openclaw-gateway.service cgroup for systemd-supervised installs, so it survives the gateway unit restart and can run the update command. Real environment tested: local WSL2 Ubuntu 24.04 user-systemd environment, Linux 6.6.87.2-microsoft-standard-WSL2, systemd 255.4-1ubuntu8.14, systemd-run --user --scope available and working. Exact steps or command run after this patch: created a real systemctl --user unit named openclaw-gateway-proof.service with KillMode=control-group. The unit ran Node from this PR checkout and called startManagedServiceUpdateHandoff with supervisor=systemd, handoffId=wsl-proof, and restartDelayMs=0. After handoff-started.json was written, ran systemctl --user restart openclaw-gateway-proof.service while the handoff helper was waiting for the parent PID to exit. Evidence after fix: Observed result after fix: the restarted gateway-proof service ran in app.slice/openclaw-gateway-proof.service, while the handoff/update command ran in separate transient scope app.slice/openclaw-update-wsl-proof.scope and completed with exit code 0 after the service restart. What was not tested: a full packaged npm upgrade against a production openclaw-gateway.service. Remote Crabbox proof was attempted but blocked before command execution: AWS runs run_58a14cc15ac9 / lease cbx_7de29d1525db and run_72d49c7e458f / lease cbx_41ad1ed803d3 both timed out waiting for SSH; Hetzner had invalid token, Namespace CLI was missing, Daytona auth was missing, and Blacksmith Testbox did not return a tbx_ id. |
dc67477 to
35c9958
Compare
Summary
systemd-run --user --scope --collectso the helper moves out ofopenclaw-gateway.servicebefore the gateway unit restarts.restartDelayMs: 0, plus focused coverage for the transient scope command and restart scheduling.Verification
2026-05-23 update after rebasing onto
origin/main(32f91503be), head35c99588ab:node scripts/run-vitest.mjs src/gateway/server-methods/update-managed-service-handoff.test.ts src/gateway/server-methods/update.test.ts --reporter=verbose(4 files, 50 tests passed)./node_modules/.bin/oxfmt --check --threads=1 CHANGELOG.md src/gateway/server-methods/update-managed-service-handoff.ts src/gateway/server-methods/update-managed-service-handoff.test.ts src/gateway/server-methods/update.ts src/gateway/server-methods/update.test.ts./node_modules/.bin/oxlint src/gateway/server-methods/update-managed-service-handoff.ts src/gateway/server-methods/update-managed-service-handoff.test.ts src/gateway/server-methods/update.ts src/gateway/server-methods/update.test.tsgit diff --check origin/main...HEADEarlier verification before the rebase:
pnpm installOPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/gateway/server-methods/update-managed-service-handoff.test.ts src/gateway/server-methods/update.test.ts src/commands/status-update-restart.test.ts -- --reporter=verbosepnpm exec oxlint --tsconfig config/tsconfig/oxlint.core.json src/gateway/server-methods/update-managed-service-handoff.ts src/gateway/server-methods/update-managed-service-handoff.test.ts src/gateway/server-methods/update.test.ts src/gateway/server-methods/update.tsnode scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfonode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfogit diff --checkcodex review --uncommittedNote:
node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json ...was blocked in this worktree before linting changed files by an unrelated WhatsApp boundary artifact failure: missingbaileystypes inextensions/whatsapp. Direct focused oxlint on changed files passed.Real behavior proof
Behavior addressed: systemd-supervised Control UI/package update handoffs no longer leave the update helper inside
openclaw-gateway.service, where the helper can be killed by the gateway unit restart before it writeshandoff.logor runsopenclaw update.Real environment tested: WSL Ubuntu-24.04 checkout at
/root/src/openclaw-85414, Node/Vitest via repo wrapper. Earlier proof also used a WSL2 Ubuntu 24.04 user-systemd environment with a realsystemctl --userunit, documented in the PR comments.Exact steps or command run after this patch:
node scripts/run-vitest.mjs src/gateway/server-methods/update-managed-service-handoff.test.ts src/gateway/server-methods/update.test.ts --reporter=verboseEvidence after fix: The focused tests verify the production handoff path chooses
systemd-run --user --scope --collect --unit=openclaw-update-<handoff>.scope <node> <handoff.cjs> <handoff.json>forsupervisor: "systemd", while preserving service identity env and stripping transient systemd invocation hints. The update scheduling test verifies the minimum 2000ms systemd restart grace whenrestartDelayMs: 0is requested.Observed result after fix: The focused suite passed: 4 test files, 50 tests. The systemd handoff starter spawns
systemd-runinstead of a plain detached Node child, andupdate.runschedules the gateway restart with enough grace for the transient scope handoff to leave the service cgroup.What was not tested: I did not repeat the live package-upgrade/systemd-unit E2E after this rebase; the changed behavior is covered by the production-path tests plus the earlier live WSL systemd proof in the PR discussion.