Repository navigation
fix(gateway): name the shutdown trigger in admission and lifecycle logs - #148910
Conversation
|
🦞👀 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: needs maintainer review before merge. Reviewed September 15, 2026, 9:41 AM ET / 13:41 UTC (Revision 10). ClawSweeper reviewWhat this changesThe PR names stop and restart triggers in Gateway logs and shutdown history, adds repeated-signal hints, and exposes shutdown and competing-service diagnostics in deep CLI status. Merge readiness✅ Ready for maintainer review Keep open: this remains a useful diagnostic repair absent from inspected main. No actionable patch defect was found, and the broader restart-loop report remains unresolved. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway run loop accepts shutdown signals and restart requests, closes admission to new work, and records lifecycle outcomes. Deep CLI status reads those outcomes and installed-service information to help operators diagnose unexpected stops. flowchart TD
A[Signals and restart requests] --> B[Gateway run loop]
B --> C[Close work admission]
C --> D[Trigger-specific logs]
B --> E[Existing shutdown history]
E --> F[Deep CLI status]
G[Installed systemd services] --> F
F --> H[Operator diagnostics]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +133, Tests +261, Docs +10. Total +404 across 10 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep shutdown diagnostics with the existing lifecycle and service owners, while investigating schema-specific attribution separately in the linked issue. Do we have a high-confidence way to reproduce the issue? Yes, for the misleading diagnostic: current main sends ordinary stops through admission code that logs 'restart drain', and the related discussion records that sequence on the released Gateway. This review did not execute the path. Is this the best way to solve the issue? Yes, for the stated diagnostic scope: passing the already-known trigger through existing owners avoids changing shutdown policy or introducing another state store. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 49c1bc4d6ee9. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
dd77304 to
7419815
Compare
7419815 to
bdde166
Compare
3c0a84f to
5947c13
Compare
Carry accepted stop/restart signals and intent reasons into admission logging and retained lifecycle outcomes. Show the last shutdown and existing systemd scope warning in deep status, with hints for repeated signals and clean stops. Release-note context: operators debugging restarts can distinguish external stops from Gateway-requested restarts without changing lifecycle behavior. Reported by @mtoko (#148866).
5947c13 to
531faaa
Compare
|
Merged via squash.
|
…gs (openclaw#148910) Carry accepted stop/restart signals and intent reasons into admission logging and retained lifecycle outcomes. Show the last shutdown and existing systemd scope warning in deep status, with hints for repeated signals and clean stops. Release-note context: operators debugging restarts can distinguish external stops from Gateway-requested restarts without changing lifecycle behavior. Reported by @mtoko (openclaw#148866).
Refs #148866
What Problem This Solves
Ordinary Gateway stops log
restart drain, making externally initiated stops look like self-initiated restart loops and leaving operators without a recorded trigger.Reported by @mtoko (#148866).
User Impact
Operators debugging restarts can distinguish a stop from a restart, see the signal and available config/update reason, and inspect the last recorded shutdown with
openclaw gateway status --deep. Repeated signals or recorded plain stops produce a supervisor-check hint. Deep Linux status also exposes the existing competing systemd scope diagnosis for the native service target.Why This Change Was Made
The run loop already knows the accepted action, signal, and restart intent. It now carries that reason into admission logging and the existing lifecycle reason field. The repeated-stop diagnostic reads the existing five-minute history; it does not change crash-loop breaker decisions, shutdown ordering, exit behavior, update handoff ownership, schema, or retention. Signal callbacks do not expose a sender PID or command, so diagnostics do not claim one.
This repairs misleading diagnostics; it does not establish or fix the external cause of the restart loop in #148866. Failure completions keep their specific failure reasons, older retained rows may still say
gateway.stop, and an unrecorded hard kill cannot supply a stop reason. Production grows by 133 lines to include the missing read-only status plumbing and cross-process history diagnostic.Evidence
admission closed: restart draininstead ofadmission closed: stop (SIGTERM), missing repeated-signal guidance, missing last-shutdown output, and missing dual-systemd diagnosis.node scripts/check-changed.mjs: passed, including lint, core/test typechecks, import-cycle, schema, and repository guards. One test-only Promise-executor lint issue was fixed before the passing rerun.ed264cc3ca59b51648a366d7ed86df9e58c76390. Current PR head:531faaa391fbbfc748105adf192b9858c9dc7a9a.531faaa391fbbfc748105adf192b9858c9dc7a9a, and the full check rollup is green. Earlier unrelated main failures were handled by rebasing onto their main corrections; no diagnostic code changes or CI reruns were needed.1a248fe53023722e684f9cacf41d334cb1648793;git range-diffconfirms all subsequent rebases preserved that patch exactly.No live operator Gateway was restarted. Linux scope discovery is tested through the existing owner with synthetic installed-unit facts; no live Linux supervisor or published-updater installation campaign was run for this diagnostic change.
ClawSweeper review
Completed review found no actionable findings on exact head
531faaa391fbbfc748105adf192b9858c9dc7a9a. No items required applying or skipping. The rebases preserve the patch; no code fixup or manual re-review request was needed.