Repository navigation
Conversation
Keep cleanup-worker admission open until canonical state lease finalizers finish, while sealing ordinary clients and canceling queued writes immediately. Then close the SQLite host and clear its successful retirement bookkeeping. The retained-lease singleton regression is red on the base; 73 focused tests pass with the fix. A synthetic owner process reproduces exit 1 on the base and 4bce760, and exit 0 with the fix. The current faulty callback ordering comes from 83064b3 (#188496), before the reported release range. Production delta: +3 lines. Codex autoreview: scoped-clean at P0-P2.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review Please review final head 8720b39, especially retained lease cleanup before broker admission closes, immediate queued-write cancellation, and propagation of genuine cleanup failures. The owner-level regression is red on the base and green here; 73 focused tests and two independent Codex review passes are clean. The full final changed-file check remains in progress while this PR is draft. |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR lets retained state leases finish cleanup before closing SQLite worker admission. Example: An orderly Gateway stop releases a retained state lease that needs a cleanup worker.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenanceRegression provenance — suspected predecessor, not a causality claim: source commit Possible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review This PR fixes a source-confirmed shutdown ordering defect that remains on main; no actionable introduced defects were found. Exact-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe SQLite broker manages worker admission, clients, and native worker retirement; global singleton shutdown joins canonical shared-state cleanup before retiring those workers. flowchart TD
A[Gateway shutdown] --> B[Global singleton drain]
B --> C[Seal ordinary clients and cancel waiters]
C --> D[Canonical state lease cleanup]
D --> E[Close worker admission and drain workers]
E --> F[Classify cleanup result]
Technical reviewBest possible solution: Keep canonical lease cleanup ahead of host admission shutdown, using the existing sealing and lifecycle owners to preserve accepted settlement and genuine failure reporting. Do we have a high-confidence way to reproduce the issue? Source confirms the cleanup-worker admission failure, and the contributor records a failing base regression and real-worker harness; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch fixes ordering at the existing broker boundary without adding policy, persistent state, or a competing cleanup path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 17d1657c3488. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +3, Tests +6, Docs +2, Other +136. Total +147 across 5 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
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 HistoryReview history (1 earlier review cycle)
Reviewed November 16, 2026, 7:57 PM ET / November 17, 2026, 00:57 UTC (Revision 2). |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@clawsweeper re-review Final head: e1803f0. Your prior review has zero findings and no open checklist items. The only subsequent diff adds braces around the existing conditional await in the measurement script (lines 69–71); production code and the 73-test proof are unchanged, and the lint-only delta passed Codex autoreview. The PR is now ready. Final |
|
🦞👀 Re-review progress:
|
|
Merged via squash auto-merge.
|
…200334) * fix: stabilize release qualification prerequisites Constrain the live output-limit stimulus while preserving actual provider streams and recovery assertions. Wait for native lazy-question and cold Control UI readiness, and remove the retired RFB re-export. Co-authored-by: RomneyDa <[email protected]> * fix: retry transient state owner exit observations Co-authored-by: RomneyDa <[email protected]> * fix: preserve admitted restart widget authoring Co-authored-by: RomneyDa <[email protected]> * fix: recover restart dashboards and stabilize release qualification OpenClaw-Publication: 5ae6496f-a9a5-4e37-a9af-79ec1af4bbb4 --------- Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 89c9e82) Release adaptation: preserve the release inline RFB banner parser and its rfb-preauth consumer; the removed main-only re-export does not exist here. No newer RFB refactor imported. Later #200330 overlaps documentation only and is not a dependency of this patch.
…es (openclaw#200330) * fix(gateway): preserve clean exit while releasing retained state leases Keep cleanup-worker admission open until canonical state lease finalizers finish, while sealing ordinary clients and canceling queued writes immediately. Then close the SQLite host and clear its successful retirement bookkeeping. The retained-lease singleton regression is red on the base; 73 focused tests pass with the fix. A synthetic owner process reproduces exit 1 on the base and 6199e71, and exit 0 with the fix. The current faulty callback ordering comes from 4807fa9 (openclaw#188496), before the reported release range. Production delta: +3 lines. Codex autoreview: scoped-clean at P0-P2. * style(perf): brace the shutdown measurement abort wait
…es (#200330) Backport f5d74a5 after #188496. Keep cleanup-worker admission open until retained state lease finalizers finish, then drain the host and discard successful retirement bookkeeping. Regression first: singleton close failed with SQLite worker host is closing, while database close passed. Fixed selected lease, capacity, queued-write, and cleanup checks: 6 passed. Format, staged test-line ratchet, and diff checks passed. Lint/typecheck blocked by linked dependency declaration boundaries. Co-authored-by: RomneyDa <[email protected]>
…es (#200330) * fix(gateway): preserve clean exit while releasing retained state leases Keep cleanup-worker admission open until canonical state lease finalizers finish, while sealing ordinary clients and canceling queued writes immediately. Then close the SQLite host and clear its successful retirement bookkeeping. The retained-lease singleton regression is red on the base; 73 focused tests pass with the fix. A synthetic owner process reproduces exit 1 on the base and 4bce760, and exit 0 with the fix. The current faulty callback ordering comes from 83064b3 (#188496), before the reported release range. Production delta: +3 lines. Codex autoreview: scoped-clean at P0-P2. * style(perf): brace the shutdown measurement abort wait (cherry picked from commit f5d74a5) Co-authored-by: RomneyDa <[email protected]> Release adaptation: none; source change applies to the pinned beta baseline. Follow-up disposition: bounded pinned-main same-path audit recorded in the lane report; cross-lane changes remain parent-owned. (cherry picked from commit afe57940d76947a5931805bce036549abbb6491e)
What Problem This Solves
Fixes an orderly Gateway stop exiting with failure when a retained state lease needs its final SQLite cleanup worker.
User Impact
Completed orderly cleanup preserves exit status 0, so service managers and deployment tooling do not classify it as a crash. Real cleanup failures still propagate. No configuration or schema changes are required.
Why This Change Was Made
The broker marked itself draining before canonical state cleanup finished. Releasing a retained lease then tried to open its cleanup worker and failed with
SQLite worker host is closing | closed. The broker now seals ordinary clients and cancels queued admissions immediately, finishes canonical state cleanup, and only then closes host admission and workers. Accepted work still settles.The faulty callback ordering is present in #188496 (
83064b3ae1155); the implicated owner files are unchanged between4bce7604and344cc75d. This identifies the current faulty implementation, not the first historical occurrence or the production trigger.Evidence
The retained-lease regression fails on base
2cc6988bc28bdthroughdrainGlobalSingletonLifecycleState("shared-state")with the reported error, while direct database close passes. It passes with the fix and verifies that accepted work settles and the lease row is removed.Focused broker, lifecycle, capacity, state-lease and Gateway state-ownership tests passed (73 tests). A production-shaped synthetic owner harness uses real SQLite workers, an admitted lease, final singleton drain and the Gateway cleanup exit classifier: base exits 1 with the exact cleanup error; candidate exits 0. No live data was used. Fixture: 5,000 sessions, 35.1 GiB SQLite database, 62,000 workspace files / 1.1 GB on APFS. This does not claim Linux/systemd or full channel-drain proof.
The same synthetic harness also reproduces the failure on
4bce7604, confirming that this defect predates the supplied release range.Five alternating pairs: base/fixed median owner elapsed 9.814/51.674 ms, process CPU 13.768/54.821 ms, sampled main-isolate allocation 2.26/2.95 MB. All seven base runs (two controls plus five measured) exit 1; all seven fixed runs exit 0. A/A elapsed controls were base 40.836/8.753 ms and fixed 37.268/53.203 ms. One fixed outlier was 598.619 ms under shared-host load. These are failing-path versus completed-cleanup measurements, not a speedup claim.
Production delta: +3 lines (25 added, 22 removed). The shared sealing loop preserves queued-write cancellation; successful registry clearing remains with the lifecycle owner. No new policy/state/cache was introduced. The implementation and final bookkeeping change passed independent Codex autoreview at P0–P2; the final braces-only measurement-script lint follow-up also passed scoped review.
pnpm check:changedcompleted: types, lint, format, import cycles and all structural/schema/worker guards pass. Its sole remaining failure is the unused-export scan: 115 identical findings on exact parent2cc6988bc28bdand this PR; zero PR-only findings. The initial baseline scan lacked workspace dependency links and was discarded; the qualified rerun has no resolution errors. No skip or allowlist was added.These are recorded main regressions, not noise. The historical consumer-removal patches account for 100 findings across #198933 (
9bfad2b180b4d), #198936 (a0423637196f7) and #198943 (b90c5739fa5cb). The remaining 15 exports trace to compaction472cd0a2f542, Talk thinking94e34f956969a, package release directories #198835 (b868ed4c21ba0), desktop protocol movement #193487 (8af714898fa6e), subagent presentation #198133 (18136c960eaf7), and browser approval #200088 (1ce9df608b43b). This PR leaves those unrelated owners unchanged. Exact-head PR CI remains the broad landing gate.