Repository navigation
fix: gateway restart avoids false failure when systemd probe is unavailable - #123069
Conversation
Allow restart to proceed when the loaded-state probe is unavailable but an installed service definition identifies the native manager. Native restart errors and Gateway health checks remain authoritative.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 13, 2026, 4:27 AM ET / 08:27 UTC. ClawSweeper reviewWhat this changesThe PR lets Gateway restart continue when a loaded-state probe fails but a service definition can be read, and removes the post-restart loaded-state reprobe. Merge readinessThis PR needs revision before merge: its fallback recognizes only a parsed user-scope unit, so a supported installed system-scope unit still fails at the unavailable Priority: P2 Review scores
Verification
How this fits togetherGateway restart selects a platform service manager, performs the native restart, then verifies Gateway health. On Linux, systemd supports both user- and system-scope units, while the CLI’s shared lifecycle code decides whether restart may begin. flowchart LR
A[Operator runs gateway restart] --> B[CLI lifecycle]
B --> C[Systemd loaded-state probe]
C --> D{Installed service detected}
D --> E[Native systemd restart]
E --> F[Gateway health check]
F --> G[Restart result]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +27. Total +27 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Expose an adapter-owned installed-definition check that covers both systemd scopes, use it only for restart’s probe-unavailable path, and add a regression that combines an unavailable probe with a system-scope unit. Do we have a high-confidence way to reproduce the issue? Yes, from source: make the systemd loaded-state probe reject while only a system-scope unit exists; Is this the best way to solve the issue? No. The fallback uses a user-unit command parser as an installation predicate even though the service adapter’s systemd operations support system-scope units; installation detection belongs at that adapter boundary. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4c60b3b985eb. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Move installed-definition detection into the platform service adapter so gateway restart can recover from an unavailable loaded-state probe for both user- and system-scope systemd units.
|
Merged via squash.
|
…ilable (openclaw#123069) * fix(cli): avoid false gateway restart failures Allow restart to proceed when the loaded-state probe is unavailable but an installed service definition identifies the native manager. Native restart errors and Gateway health checks remain authoritative. * fix(daemon): detect system-scope restart definitions Move installed-definition detection into the platform service adapter so gateway restart can recover from an unavailable loaded-state probe for both user- and system-scope systemd units.
What Problem This Solves
Fixes an issue where operators running
openclaw gateway restartcould receive a failure when the service loaded-state probe could not launchsystemctl is-enabled, even though an installed systemd unit existed and the Gateway restart path was otherwise recoverable.The reported Team Hetzner incident surfaced as
Gateway service check failed: Error: systemctl is-enabled unavailable: Command failed during launch or output capture (EACCES)while the Gateway itself recovered with healthy readiness.Why This Change Was Made
Restart now asks the platform service adapter whether an installed definition exists when the preliminary loaded-state probe is unavailable. Linux uses the canonical systemd scope detector, covering user-scope, system-scope, marker-owned, and existing user-first/dueling semantics. The native restart command and the existing Gateway health/readiness check remain authoritative, so real systemd restart failures and unhealthy restart outcomes still fail.
The redundant post-success loaded-state reprobe was removed from the emitted snapshot path; restart success now carries forward the already established managed/recovered state. Node service adapters preserve their node-specific identity when using the new installation predicate.
AI-assisted: yes (Claude Code and Codex).
User Impact
Operators no longer see a false restart failure solely because
systemctl is-enabledcould not be launched or captured. Missing service definitions still fail the service check, native service-manager errors still fail the restart, and a Gateway that does not recover health/readiness still fails with the existing diagnostics.Evidence
node scripts/run-vitest.mjs src/cli/daemon-cli/lifecycle-core.test.ts -t "restarts an installed system-scope service when its loaded-state probe is unavailable"promise rejected "Error: __exit__:1" instead of resolvingat the service loaded-state check.node scripts/run-vitest.mjs src/cli/daemon-cli/lifecycle-core.test.ts src/cli/daemon-cli/lifecycle.test.ts src/daemon/service.test.ts src/daemon/systemd.test.tsoxfmt --checkon all four changed files: clean.git diff --check: clean.core, coreTests.Live proof gap: this PR does not restart the operator-owned Team Hetzner Gateway. The exact EACCES condition is covered deterministically at the lifecycle owner boundary; exact-head CI/Testbox evidence will be required before merge.