Repository navigation
refactor(gateway): deslop gateway shutdown - #165980
Conversation
Consolidate close-owner grace handling and fixture types, preserve shutdown diagnostics in stronger lifecycle tests, and remove redundant tests and unreachable suspension checks. Keep restart, persistence, and admission behavior unchanged.
|
🦞👀 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 October 6, 2026, 3:07 AM ET / 07:07 UTC (Revision 2). ClawSweeper reviewWhat this changesConsolidates Gateway shutdown grace handling and simplifies chat cleanup and duplicated lifecycle test fixtures while preserving existing shutdown behavior. Merge readiness✅ Ready for maintainer review Keep open: this remains useful cleanup absent from current main, and no introduced correctness or security defect was found. The prior review’s empty finding list remains consistent with the inspected head. Priority: P3 Review scores
Verification
How this fits togetherThe Gateway shutdown owner receives stop and restart requests, drains accepted work, and closes runtime resources. Its completion controls when shared databases and process state can safely retire. flowchart TD
A[Stop or restart request] --> B[Close work admission]
B --> C[Shutdown hooks and reply drain]
C --> D[Runtime cleanup with grace]
D --> E[Join pending cleanup and persistence]
E --> F[Retire shared resources]
F --> G[Restart or process exit]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -125, Tests -574. Total -699 across 19 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one shutdown owner responsible for grace, diagnostics, and cleanup settlement, with the retained lifecycle coverage protecting resource retirement. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR proposes behavior-preserving cleanup rather than a reported defect; source and retained tests support the stated equivalence. Is this the best way to solve the issue? Yes: folding the adapters into the existing close owner and deriving fixture types removes duplication without creating another lifecycle owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 48b40f4909f6. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
Consolidate close-owner grace handling and fixture types, preserve shutdown diagnostics in stronger lifecycle tests, and remove redundant tests and unreachable suspension checks. Keep restart, persistence, and admission behavior unchanged.
What Problem This Solves
Gateway shutdown maintenance carries duplicate adapters, copied fixture contracts, and repeated tests around the same cleanup owners.
User Impact
No user-visible behavior change. Restart/update behavior, shutdown budgets, required persistence joins, recovery marking, and current-owner checks are preserved. No config, schema, or persisted-shape changes.
Why This Change Was Made
Measurement against the branch base: −699 net lines across 19 files: production −125; tests/support −574. No performance improvement is claimed.
The lane's −1,500 target uses the safety escape hatch. Further deletion would remove distinct cleanup/authority contracts in
server-close.agent-databases.test.ts:80,server-close.board.test.ts:14, andserver-close.auth-usage.test.ts:16; package helper IPC coverage inrun-loop-package-lifecycle.test-support.ts:35; or actual process lifetime proof inrun-loop.restart-liveness.process.test.ts:188. Removing the close-runtime barrel requires changing the non-owned architecture testserver-import-boundary.test.ts:147. No out-of-scope files changed.Evidence
Final head:
3c181dc8454209cf6e7eb9fab9b1c1f15219daa4. Rebased ontomainimmediately before publication; stable patch IDs matched before and after rebase. Independent Codex review is clean at P0–P2, and the diff-scoped deslop pass is complete.Exact-head CI and
openclaw/ci-gatepassed. The 20 selected Node CI jobs consumed 3,932 job-seconds in total; this is the selected CI scope, not a per-test attribution. No inherited red jobs or gate exceptions remain.All heavy local-proof commands ran on Blacksmith Testbox, provider
blacksmith-testbox, profileopenclaw-check:tbx_01m47x8x6smxsshjv59ynfv0e9--maxWorkers=1: 312 passed in 57.66s. Gateway files: 16.25s; the existing 167-case CLI lifecycle suite: 38.75s. The CLI suite exceeds 30s because it exercises distinct shutdown/update races through the run-loop entry point; this change adds no process boots.tbx_01m47zr9pv6zpnreth98phrhqrnode scripts/check-changed.mjs --base f70dff05e8c0b9eee8d17cf95474a3e45731b4d0: passed, 34m02.621s remote command time. Includes core and all 27 selected test typecheck graphs, zero unused-export entries, lint, import-cycle and ownership guards.Source preflights verified the exact base/head, changed paths, and file-content hashes. The focused runs preceded restoring the existing CLI exit adapters; final CLI production changes are comments only, and the final-head gate and CI verify the published tree. The final lint run reported one non-failing existing max-lines warning in the untouched
server-close.agent-databases.test.ts.Initial preparation found and resolved two unused bindings and the executable-line ratchet rejecting CLI inlining. A formatted-diff checksum was replaced by a source-content manifest check. Two subsequent sync timeouts occurred before gate execution; that lease was stopped. A queued replacement was retired when the head changed, and final proof used a fresh lease. All three leases are stopped.
Focused Testbox commands
Ready for lead review and landing. This PR remains unmerged, with no auto-merge request.