fix(daemon): preserve explicit systemd unit during refresh#87556
Conversation
|
Codex review: needs maintainer review before merge. Reviewed May 28, 2026, 3:18 AM ET / 07:18 UTC. Summary PR surface: Source +19, Tests +53. Total +72 across 4 files. Reproducibility: yes. from source inspection, but not as a live Linux reproduction in this review. Current main derives the rendered systemd unit from profile and lets persisted command env overwrite caller env, matching the stale-unit failure shape. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow precedence fix after maintainers either accept the supplied runtime probe or add a Linux user-systemd update-refresh smoke, then let the linked issue close through the merged PR. Do we have a high-confidence way to reproduce the issue? Yes from source inspection, but not as a live Linux reproduction in this review. Current main derives the rendered systemd unit from profile and lets persisted command env overwrite caller env, matching the stale-unit failure shape. Is this the best way to solve the issue? Yes, the PR fixes the narrow ownership boundary: keep explicit service identity env at render and state-merge time. The safer pre-merge addition is live Linux update-refresh proof, not a broader refactor. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 05f357b13bb3. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +19, Tests +53. Total +72 across 4 files. View PR surface stats
What I checked:
Likely related people:
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. How this review workflow works
|
828c553 to
079035b
Compare
|
ClawSweeper PR egg: ✨ hatched 🥚 common Clockwork Test Hopper. Rarity: 🥚 common. Trait: hums during re-review. DetailsShare on X: post this hatch
About:
|
This comment was marked as spam.
This comment was marked as spam.
|
Maintainer verification before merge: Behavior addressed: update/service refresh preserves the explicit systemd unit instead of drifting to a stale persisted default unit.
Autoreview: |
steipete
left a comment
There was a problem hiding this comment.
Verified with focused tests, autoreview, and direct AWS Crabbox Linux systemd install/refresh proof. No blocking findings.
Summary
OPENCLAW_SYSTEMD_UNITvalues when rendering the managed gateway service environmentOPENCLAW_SYSTEMD_UNIT, launchd label, Windows task name) ahead of stale persisted service env during service-state inspectionFixes #87490
Verification
node scripts/run-vitest.mjs src/daemon/service-env.test.ts src/daemon/service.test.ts src/cli/update-cli.test.ts src/cli/update-cli/restart-helper.test.ts src/cli/daemon-cli/install.test.ts src/daemon/systemd.test.ts(6 files / 347 tests passed)git diff --checkgit log --format='%h %an <%ae> %s' upstream/main..HEADReal behavior proof
Behavior addressed: package/update refresh can keep using the explicitly selected systemd unit instead of drifting back to
openclaw-gateway.servicefrom a stale persisted service environment.Real environment tested: local source checkout running the real OpenClaw TypeScript service-env/state code with Node 24 on macOS; the probe used Linux service-env rendering inputs for the systemd unit behavior.
Exact steps or command run after this patch: ran
node --import tsx --input-type=moduleto render a Linux gateway service env withOPENCLAW_SYSTEMD_UNIT=openclaw-gateway-maintenance.service, then read gateway service state from an existing unit command whose persisted env still containedOPENCLAW_SYSTEMD_UNIT=openclaw-gateway.service.Evidence after fix: terminal output from the behavior probe was:
{ "renderedSystemdUnit": "openclaw-gateway-maintenance.service", "mergedSystemdUnit": "openclaw-gateway-maintenance.service", "runtimeSystemdUnit": "openclaw-gateway-maintenance.service" }Observed result after fix: both rendered service env and post-inspection runtime env retained the selected
openclaw-gateway-maintenance.serviceunit despite the stale persisted default unit.What was not tested: a live Linux
systemctl --userpackage-update smoke, because Blacksmith/Testbox requiredblacksmith auth loginand local Docker was unavailable in this environment.If maintainers squash or rework this PR, please preserve author attribution or include:
Co-authored-by: Andy Ye 35905412+TurboTheTurtle@users.noreply.github.com