Repository navigation
fix(update): stop the managed systemd Gateway with the same bounded sequence as gateway stop - #167040
Conversation
Keep update and standalone stops at the shared lifecycle owner, with a separate manager-inspection budget and one timeout-only retry. Check the supplied custody guard after routing and preserve inherited native guards, start/restart fences, and graceful stop behavior. Record retry warnings and name the stalled inspection without stopping the original Gateway. The installed updater owns this behavior; an older running updater cannot obtain the repair from its candidate. Closes #166663. Reported by @jlapenna.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed October 8, 2026, 3:53 AM ET / 07:53 UTC. ClawSweeper reviewWhat this changesThis PR gives managed Linux Gateway stops a separate 60-second routing-inspection budget, one timeout-only retry, and retained warning diagnostics. Example: An update encounters a six-second manager probe
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this is a useful owner-backed repair absent from current main, with no concrete introduced defect found. Required upgrade validation remains incomplete. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe updater asks the native service owner to stop the managed Gateway before replacing its package. On Linux, that owner selects a systemd user-manager route and dispatches the stop while preserving live update custody. flowchart TD
A[Package update or Gateway stop] --> B[Shared Linux service owner]
B --> C[Inspect systemd manager route]
C --> D{Inspection timed out?}
D -->|Once| C
D -->|Repeated timeout| E[Report diagnostic and keep Gateway running]
D -->|Route selected| F[Check current custody]
F --> G[Dispatch native stop]
Technical reviewBest possible solution: Keep the shared service owner and final custody fences, and establish native upgrade compatibility while documenting that older installed updaters retain their own stop logic. Do we have a high-confidence way to reproduce the issue? Yes for the deadline mechanism: source shows custody checks can consume the five-second routing allowance, and the PR reports failing controlled regressions. The exact reported native incident has not been reproduced on current main. Is this the best way to solve the issue? Yes: repairing the shared stop owner avoids a competing updater path and preserves final custody checks; real upgrade validation is still needed. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0a2c5ee706f0. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: unit tests only. Added test files: 3. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +77, Tests +176, Docs +8. Total +261 across 8 files. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment |
…equence as gateway stop (openclaw#167040) Closes openclaw#166663 Reported by @jlapenna.
What Problem This Solves
Fixes native Linux package updates that fail with
managed-service-stop-failedwhen systemd routing inspection spends its five-second deadline on update custody checks, even though a later standalone Gateway stop succeeds.Closes #166663. Thanks @jlapenna for the detailed failure and recovery report.
User Impact
Managed updates and standalone
openclaw gateway stopuse the same stop sequence. Slow manager inspection has a separate 60-second allowance and one timeout-only retry, with the warning retained in update history. A repeated inspection timeout names the stalled check and leaves the original Gateway running. Ownership refusals still prevent the stop.This repair belongs to the installed updater: a candidate cannot change the stop logic of an older updater already running. No new configuration, environment variables, CLI options, dependencies, or database schema changes are introduced.
Why This Change Was Made
Both callers already reach the systemd lifecycle owner. The updater additionally supplies a custody guard whose lease/database checks were repeated inside transport discovery, including cached-route reads. One database busy wait can itself consume the entire ordinary five-second inspection budget.
The shared stop path now resolves the manager route with its own budget, then checks the supplied custody guard immediately before dispatch. It drops the redundant
statuspreflight. Inherited native admission/completion guards remain intact, as do the existing start/restart fences. Only inspection is retried; the stop command and its graceful drainage are never replayed. Discovery starts after its deadline timer is armed, and ownership refusals or unresolved native cleanup retain priority over deadline expiry and later custody loss. Timeout diagnostics distinguish the manager route/check from custody or native-command admission.Evidence
reset-failedguard.node scripts/check-changed.mjspassed on the final source (exit 0). The first run passed typechecks and other completed guards, then caught a fixture parameter reassignment; the fixture now uses a local counter.git diff --checkpassed. The retired transport-deadline singleton has no remaining references.Single-worker cost (
pnpm test <file> --maxWorkers=1):src/daemon/systemd-stop.test.tssrc/daemon/systemd.test.tssrc/daemon/service-stop-fence.test.tsMost wall time in the existing daemon suites was transform/compiler preparation. Existing importer process fixtures were slower: the final Docker helper suite took 201.17 s and the update/rollback process group took 821.91 s wall (1,192.72 s in the earlier run); individual Windows/Doctor recovery cases reached 43.10 s and 45.86 s in earlier runs. These timings are recorded without increasing timeouts or weakening assertions. CI timings are pending at author handoff.
Production: +107 / -30 LOC. Tests: +189 / -13 LOC. Documentation: +8 / -0 LOC.