Skip to content

fix(gateway): settle restart intents and update reports in workers - #167572

Merged
steipete merged 11 commits into
mainfrom
dbasync/w6restartsettle
Oct 9, 2026
Merged

steipete merged 11 commits into
mainfrom
dbasync/w6restartsettle

Conversation

@steipete

@steipete steipete commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Restart-intent consumption could block the Gateway signal thread behind a SQLite writer, then return an intent whose separate deletion failed. A later signal could consume it again. Update-report receipts also used main-thread SQLite and needed accepted work to settle before their transport and storage owners closed.

Runtime intent consumption, handoff writes, report receipt transitions, and cleanup now use their existing workers. Intent consumption is atomic DELETE … RETURNING; duplicate suppression, current publication authority, and accepted-work settlement remain intact.

The schema-cache parent #167001 merged and its branch was deleted, so this PR targets main. Approved-head lane proof below compares c786f4d4c4ea27630466a529630e56071845a682 → b48f88f9f3f6eafedfce6b06bc227f38c3b209c6. Parent/cache improvements are inherited and are not credited to this change.

Ownership and restart readiness

The shared-state writer owns runtime intent consumption and handoff persistence. The sentinel writer owns receipt reservation, transitions, finalization, and cleanup; its read worker supplies receipt reads. Callers capture physical database identity before yielding. Authoritative rereads and writes remain synchronous inside worker transactions, with live authority checked again at transaction, commit, and publication boundaries. Commit receipts reconcile lost replies without replaying accepted writes. Reservation-bound artifact paths prevent delayed cleanup from deleting a successor's report.

The signal owner preserves FIFO and joins accepted intent work before close. The report RPC uses its existing execution join so connection retirement waits for receipt and cleanup settlement. Supervisor handoff persistence remains after canonical writer drain and the final restart decision.

Real restart proof showed that cold worker code loading was on the readiness critical path. Restart operations now use the existing lightweight registry, and an accepted supervised restart may preload code only while shutdown proceeds. Preparation opens no database and performs no schema admission, intent consumption, or handoff write. It uses existing broker capacity and can be preempted by ordinary work. Post-drain admission still obtains fresh physical identity and current grants; it never reuses a retiring database handle. Unavailable preparation retains cold admission; genuine capacity preemption permits a fresh cold open. Failed, stale, foreign, or reused preparation handles reject. Cleanup remains owned and joined.

Six alternating base/candidate pairs on one Hetzner Linux host, Node 24.21.0, passed real RPC restart, clean predecessor exit, successor identity, persisted handoff restoration, HTTP readiness, authenticated reconnect, first successful sessions.list, and process cleanup. All twelve runs passed. The first-accepted-request median increase is 193.778 ms, within the specified ≤200 ms gate.

Request to… Base ms, median [min–max] Candidate ms, median [min–max] Delta
Old-process exit 1217.636 [1198.114–1236.765] 1335.880 [1310.858–1345.592] +118.244 ms
HTTP ready 10799.374 [10738.711–11005.353] 11026.566 [10847.233–11132.587] +227.192 ms
First accepted authenticated RPC 11025.382 [10971.642–11221.799] 11219.160 [11068.497–11373.654] +193.778 ms

This pass has 6.222 ms of median headroom. HTTP readiness alone increased by 227.192 ms; the specified gate is the first accepted authenticated request. The observed handoff log span was 32.647 [30.057–45.109] → 123.319 [113.119–128.458] ms; that is a log-receipt diagnostic, not native-operation timing. These results cover normal capacity and an isolated external supervisor, not native macOS/Windows timing or a universal latency bound. Saturation can decline or preempt optional preparation and retain the correct cold fallback. Earlier candidates exceeded the readiness budget; the final result is the measured prewarming implementation.

Schema, durability, retention, permissions, configuration, and released synchronous SDK contracts are unchanged. Native boot/supervisor handoff consumption and service CLI lock primitives retain their documented synchronous contracts. An inherited unused internal ClientVoiceToolEffect type export was made private to satisfy Knip; it has no released SDK export path.

Final direct statements and requests

Three strictly alternating pairs exercise the real report handler with synthetic GitHub transport and current system-operator authority, then receipt/restart operations through their compiled shared writer. Counts include every observed thread/helper and zero-SQL requests. All count ranges below are deterministic across the three runs; full ranges remain in the phase table.

Flow ALL statements MAIN statements Worker requests
Created submit/finalize/cleanup 154 → 149 56 → 20 25 → 31
Reconcile/finalize/cleanup 40 → 38 20 → 4 5 → 8
Uncertain submission 140 → 136 42 → 20 25 → 29
Warm intent consumption 30 → 6 30 → 0 0 → 1
Post-drain handoff 87 → 83 87 → 0 0 → 2
Preparation + drain + handoff + release 93 → 89 92 → 5 2 → 4
Code preparation / preparation release 0 → 0 0 → 0 0 → 0
Product operations 652 → 612 368 → 64 70 → 106
All phases, including setup and verification 3369 → 3338 2830 → 2318 2055 → 2140

Worker placement is not an all-thread saving. This change reduces direct product statements by 40, while adding 36 product worker requests. The complete fixture reduces statements by 31 and adds 85 requests, including source-loader/initialization, setup, lifecycle, and verification requests. Preparation costs are included; none are hidden in an uncounted warm-up.

Cold handoff removes one timeout read (2→1), two timeout assignments (6→4), and the WAL-autocheckpoint read/disable (1+1→0+0), while retaining one additional combined version observation (2→3): −1−2−2+1=−4. Numeric timeout values are grouped within each run before taking medians. Requests add exactly open + handoff. Preparation's approximately 2 ms host phase only starts code loading; imports may continue through the fully counted drain/handoff phases.

  • Created submit/finalize/cleanup −5: five fewer ownership SELECTs (inspectOpenClawStateOwnershipFromDatabase / assertOpenClawStateWriteAllowed). Domain receipt transitions and their transaction envelopes remain. Added requests: receipt read, reserve, mark prepared, mark pending, finalize, complete cleanup.
  • Duplicate −2 and reconciliation −2: one ownership SELECT and one schema-content-version SELECT removed from each. Duplicate adds one receipt-read request; reconciliation adds receipt read, finalize, and complete cleanup.
  • Each preview −1: one ownership SELECT removed; requests unchanged.
  • Uncertain submission −4: five ownership SELECTs removed, offset by one required content-version read. Added requests: receipt read, reserve, mark prepared, mark pending.
  • Receipt/sweep-lease reads +1 each; artifact sweep +1: the current read-only worker retains one schema-content-version SELECT through readStateSchemaContentVersionRow → readContentVersionMarker → assertSupportedStateSchemaVersion. The actual receipt SELECT and foreign-commit observation remain. This is an explicit required-freshness cost, not unrelated noise. The current base reuses the previously separate schema/user-version observations; stale cleanup remains 7→7.
  • Warm intent −24: separate SELECT+DELETE becomes one DELETE ... RETURNING (−1 domain statement). Repeated native admission removes 24 statements—seven schema/user-version probes, six catalog reads, three table-existence reads, two integrity checks, two busy-timeout operations, and one each of direct data-version, schema metadata, ownership, and content-version reads—offset by one additional combined version observation. Net native admission −23; total −24. One restartLifecycle.consumeIntent request is added.
  • Cold handoff −4: the normalized timeout/WAL/version decomposition above.

The complete product SQL delta is −5−2−2−1−1−4−24−4+1+1+1 = −40. Ordinary reservation stays 6→6, ordinary receipt transitions stay 7→7, and warm handoff stays 6→6; each adds one worker request and moves MAIN work to its existing worker. File-only save/publish/discard stays zero SQL and zero requests. No unchanged operation is presented as an ALL-thread saving.

Every added product request

These counts sum to +36 per measured product cycle in each pair. All requests, including zero-SQL requests, are retained.

Family Request Added per product cycle
sqlite-broker open +1
sqlite-broker restartLifecycle.consumeIntent +1
sqlite-broker restartLifecycle.writeHandoff +2
sqlite-broker restartSentinel.beginCleanup +1
sqlite-broker restartSentinel.beginStaleCleanup +1
sqlite-broker restartSentinel.claimSweep +2
sqlite-broker restartSentinel.completeCleanup +5
sqlite-broker restartSentinel.finalizeReceipt +3
sqlite-broker restartSentinel.markPending +3
sqlite-broker restartSentinel.markPrepared +3
sqlite-broker restartSentinel.refreshPreparation +1
sqlite-broker restartSentinel.releaseSweep +2
sqlite-broker restartSentinel.reserve +3
task-worker restartSentinel.reportReceipt +8

Complete-window accounting

Initialization is −50 SQL/+38 requests: import SQL is unchanged, with one extra source-loader request; fixture warming is −50 SQL/+37 requests, including two source-loader requests and 35 domain requests. Warming exercises intent twice (−48 statements combined) and receipt paths (eight ownership reads removed, six content-version reads added, net −2). These initialization effects are separate from the product saving.

Fixture setup is −2 SQL/+2 requests: created and uncertain setup each remove one ownership SELECT; abort/stale setup reserves add their worker requests. Lifecycle is +1 SQL/+1 request, from one additional final wal_checkpoint(TRUNCATE) and its worker close; canonical drain and preparation release do not add SQL or requests.

Verification is +60 SQL/+8 requests: the same-process native boot verifier after worker-only handoff independently admits MAIN (13→92, +79); the second intent consume saves 24; receipt verification adds five content-version reads. +79−24+5=+60. Warm native boot verification is unchanged at13. The cold verifier is explicit fixture lifecycle work and is retained in all-phase totals; it is not a claim about a separately spawned successor process.

The complete conservation is −50−2−40+1+60=−31 SQL, and +38+2+36+1+8=+85 requests. Source-loader tooling accounts for three of those added initialization requests. Production/initialization/request differences are not silently discarded.

The inherited duplicate +267 schema-construction statements remain absent. On the current base, receipt/sweep-lease reads are 2 → 3, stale cleanup 7 → 7, and artifact sweep 18 → 19. Required freshness checks remain; subsequent base admission/cache improvements explain the difference from the previously accepted 2→5, 7→9, and 18→21 observations. Final direct runs have zero failed native executions, including intent consumption and exactly-once verification.

Complete final direct phase table: medians [min–max]
Phase ALL base → candidate MAIN base → candidate Requests ALL base → candidate Requests MAIN base → candidate C/B duration
00.import 401 [401–401] → 401 [401–401] 401 [401–401] → 401 [401–401] 818 [818–818] → 819 [819–819] 818 [818–818] → 819 [819–819] 1.019
00.warm 1973 [1973–1973] → 1923 [1923–1923] 1739 [1739–1739] → 1508 [1508–1508] 1163 [1163–1163] → 1200 [1200–1200] 37 [37–37] → 72 [72–72] 1.026
10.created.duplicate 26 [26–26] → 24 [24–24] 6 [6–6] → 4 [4–4] 5 [5–5] → 6 [6–6] 5 [5–5] → 6 [6–6] 1.019
10.created.preview 32 [32–32] → 31 [31–31] 8 [8–8] → 8 [8–8] 5 [5–5] → 5 [5–5] 5 [5–5] → 5 [5–5] 0.959
10.created.setup 108 [108–108] → 107 [107–107] 98 [98–98] → 98 [98–98] 1 [1–1] → 1 [1–1] 1 [1–1] → 1 [1–1] 0.948
10.created.submit-create-finalize-cleanup 154 [154–154] → 149 [149–149] 56 [56–56] → 20 [20–20] 25 [25–25] → 31 [31–31] 25 [25–25] → 31 [31–31] 1.104
10.created.verify-created 2 [2–2] → 3 [3–3] 2 [2–2] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 3.982
10.created.verify-preview 2 [2–2] → 3 [3–3] 2 [2–2] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 6.308
20.uncertain.preview 32 [32–32] → 31 [31–31] 8 [8–8] → 8 [8–8] 5 [5–5] → 5 [5–5] 5 [5–5] → 5 [5–5] 1.121
20.uncertain.reconcile-finalize-cleanup 40 [40–40] → 38 [38–38] 20 [20–20] → 4 [4–4] 5 [5–5] → 8 [8–8] 5 [5–5] → 8 [8–8] 1.071
20.uncertain.setup 107 [107–107] → 106 [106–106] 97 [97–97] → 97 [97–97] 1 [1–1] → 1 [1–1] 1 [1–1] → 1 [1–1] 1.020
20.uncertain.submit 140 [140–140] → 136 [136–136] 42 [42–42] → 20 [20–20] 25 [25–25] → 29 [29–29] 25 [25–25] → 29 [29–29] 1.099
20.uncertain.verify-pending 2 [2–2] → 2 [2–2] 2 [2–2] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 1.968
20.uncertain.verify-reconciled 2 [2–2] → 3 [3–3] 2 [2–2] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 3.452
30.owner.begin-cleanup 7 [7–7] → 7 [7–7] 7 [7–7] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 3.269
30.owner.begin-stale-cleanup 7 [7–7] → 7 [7–7] 7 [7–7] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 4.179
30.owner.check-sweep-lease 2 [2–2] → 3 [3–3] 2 [2–2] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 9.922
30.owner.claim-sweep 7 [7–7] → 7 [7–7] 7 [7–7] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 4.238
30.owner.complete-aborted-cleanup 7 [7–7] → 7 [7–7] 7 [7–7] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 4.529
30.owner.complete-created-cleanup 7 [7–7] → 7 [7–7] 7 [7–7] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 2.362
30.owner.complete-stale-cleanup 7 [7–7] → 7 [7–7] 7 [7–7] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 3.917
30.owner.discard-artifact 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 1.209
30.owner.finalize-created 7 [7–7] → 7 [7–7] 7 [7–7] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 2.364
30.owner.mark-pending 7 [7–7] → 7 [7–7] 7 [7–7] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 2.149
30.owner.mark-prepared 7 [7–7] → 7 [7–7] 7 [7–7] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 1.878
30.owner.publish-artifact 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0.855
30.owner.read-receipt 2 [2–2] → 3 [3–3] 2 [2–2] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 5.510
30.owner.refresh-preparation 7 [7–7] → 7 [7–7] 7 [7–7] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 1.860
30.owner.release-sweep 7 [7–7] → 7 [7–7] 7 [7–7] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 3.864
30.owner.reserve 6 [6–6] → 6 [6–6] 6 [6–6] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 1.973
30.owner.save-artifact 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 1.096
30.owner.setup-abort 6 [6–6] → 6 [6–6] 6 [6–6] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 2.660
30.owner.setup-prepared 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 1.042
30.owner.setup-stale 13 [13–13] → 13 [13–13] 13 [13–13] → 7 [7–7] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 3.338
30.owner.sweep-retired-artifacts 18 [18–18] → 19 [19–19] 18 [18–18] → 0 [0–0] 0 [0–0] → 4 [4–4] 0 [0–0] → 4 [4–4] 4.391
30.owner.verify-cleanup 4 [4–4] → 5 [5–5] 4 [4–4] → 0 [0–0] 0 [0–0] → 2 [2–2] 0 [0–0] → 2 [2–2] 8.185
30.owner.verify-stale-receipt 2 [2–2] → 3 [3–3] 2 [2–2] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 10.099
40.restart-warm.consume-intent 30 [30–30] → 6 [6–6] 30 [30–30] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 0.378
40.restart-warm.setup-native-intent 28 [28–28] → 28 [28–28] 28 [28–28] → 28 [28–28] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 1.535
40.restart-warm.verify-intent-exactly-once 30 [30–30] → 6 [6–6] 30 [30–30] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 0.254
40.restart-warm.verify-native-boot-consume 13 [13–13] → 13 [13–13] 13 [13–13] → 13 [13–13] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 1.082
40.restart-warm.write-handoff 6 [6–6] → 6 [6–6] 6 [6–6] → 0 [0–0] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 3.761
50.restart-after-close.canonical-drain 6 [6–6] → 6 [6–6] 5 [5–5] → 5 [5–5] 2 [2–2] → 2 [2–2] 2 [2–2] → 2 [2–2] 0.945
50.restart-after-close.runtime-preparation 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 19.598
50.restart-after-close.verify-native-boot-consume 13 [13–13] → 92 [92–92] 13 [13–13] → 92 [92–92] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 12.041
50.restart-after-close.write-handoff 87 [87–87] → 83 [83–83] 87 [87–87] → 0 [0–0] 0 [0–0] → 2 [2–2] 0 [0–0] → 2 [2–2] 7.992
89.release-runtime-preparation 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 1.717
90.close 5 [5–5] → 6 [6–6] 5 [5–5] → 5 [5–5] 0 [0–0] → 1 [1–1] 0 [0–0] → 1 [1–1] 5.433
total.all-phases 3369 [3369–3369] → 3338 [3338–3338] 2830 [2830–2830] → 2318 [2318–2318] 2055 [2055–2055] → 2140 [2140–2140] 929 [929–929] → 1012 [1012–1012] 1.065
total.fixture-setup 262 [262–262] → 260 [260–260] 242 [242–242] → 230 [230–230] 2 [2–2] → 4 [4–4] 2 [2–2] → 4 [4–4] 1.104
total.initialization 2374 [2374–2374] → 2324 [2324–2324] 2140 [2140–2140] → 1909 [1909–1909] 1981 [1981–1981] → 2019 [2019–2019] 855 [855–855] → 891 [891–891] 1.027
total.lifecycle 11 [11–11] → 12 [12–12] 10 [10–10] → 10 [10–10] 2 [2–2] → 3 [3–3] 2 [2–2] → 3 [3–3] 1.229
total.product 652 [652–652] → 612 [612–612] 368 [368–368] → 64 [64–64] 70 [70–70] → 106 [106–106] 70 [70–70] → 106 [106–106] 1.667
total.verification 70 [70–70] → 130 [130–130] 70 [70–70] → 105 [105–105] 0 [0–0] → 8 [8–8] 0 [0–0] → 8 [8–8] 2.238

Single-operation duration ratios are diagnostic under the accepted exclusion; they are not shared-workload duration gates or evidence of real restart readiness. The instrumented handoff call alone took 65.484 [48.797–67.145] → 523.373 [523.011–534.468] ms. The fixture introduces no extra sleep to wait for preparation; the real Gateway's overlapping shutdown is measured separately above. Complete fixture duration ratio is 1.065; the product subtotal is 1.667. The generic summarizer’s durationValid=false flags for individual operations/subtotals are preserved, not relabeled as timing passes. Disposition uses the accepted direct-operation exclusion and the independently measured real restart readiness gate. Native verification after worker-only handoff independently opens its MAIN connection (13 → 92 statements); those 79 statements remain in verification and total counts, not hidden as product savings.

Accepted shared chat and shutdown evidence

The coordinator accepted six alternating pairs at historical base b881e1423c4a10bfc338f823dccefadcf996261d and candidate a1cd0d8e3cc3ca8756be17250c028cac08a5837e. These are retained as historical W6 evidence, not measurements of the final head against current main. A final source audit confirms preparation requires an accepted supervised restart, so it is inactive in first/warmed chat and the fixture's SIGTERM stop. Ordinary broker SQL/request envelopes and the atomic intent kernel remain unchanged by preparation. Independent base freshness/admission changes prevent transplanting historical absolute totals onto the final base.

Warmed turns were 1513.45 → 1513.1 ALL, 6.5 → 6.5 MAIN, and 299 → 299.1 requests/turn. No chat-turn saving, global request reduction, or under-500-turn claim is made. Total shared requests were 4744.5 → 4754.5.

Raw first-turn statements were 3482 → 3505 (+23). The accepted deferred-startup window was boot+connect+first 6225.5 → 6222; conservatively retaining every other origin leaves 3448 → 3434.5 first-turn statements. Only post-ready plugin maintenance, pairing notification, outbound recovery, remote catalog refresh, and cron startup planning were classified as deferred startup. First/warmed traces had zero intersections with W6 files changed at that measured head. Connect uses boot+connect 2741 → 2763.5 (+0.8209%). Second-session +0.3735% and cron +0.2073% belong to unchanged owners and fit the non-turn allowance. Every shared phase has a duration ratio ≤1.5.

Alternating pair Base boot+connect+first Candidate boot+connect+first Base non-deferred first Candidate non-deferred first
1 6222 6254 3447 3462
2 6224 6209 3449 3358
3 6233 6228 3369 3353
4 6200 6216 3454 3444
5 6227 6203 3384 3455
6 6320 6285 3568 3425

Historical shutdown was 702 → 679.5 ALL, 202 → 150 MAIN, and 82 → 75 requests. The W6 saving is intent consumption 41 → 6 ALL, 41 → 0 MAIN, with one added worker request: SELECT+DELETE→DELETE RETURNING removes one domain statement; repeated native admission removes 34 others (11 schema/user-version probes, 11 catalog reads, three table-existence reads, two busy-timeout operations, two integrity checks, and one each of schema metadata, quarantine, ownership, content-version, and comparison-table work).

The median-supplying shutdown observations decompose as intent −37 plus unchanged owners +14.5 = −22.5; intent's standalone median is −35 because different observations supply those medians. Memory admission is the largest positive background component, offset by native closure/WAL, placement, session, and memory settlement. Thread movement and unrelated background decreases are not credited as W6 savings.

Historical shared traces had zero intent lock refusals. Their 13 other refusals belong to unchanged owners: 11 startup plugin-lease releases and two audit-prune refusals, one per side. Final direct runs had zero failed native executions; final readiness and driver logs had zero observed lock-refusal diagnostics. Readiness was uninstrumented and does not replace the historical all-thread refusal count. This is not a globally lock-free-shutdown claim.

Complete accepted historical shared table and combined windows

Base b881e1423c4a → candidate a1cd0d8e3cc3. ALL includes every observed thread/helper, MAIN is the Gateway thread. Counts are medians [min–max]. Warmed counts are each run’s ten-turn mean. Requests include zero-SQL operations.

Phase ALL base → candidate MAIN base → candidate Requests base → candidate C/B duration
01.boot 2425.5 [2424–2452] → 2424 [2424–2457] 2003 [2003–2005] → 2003 [2003–2007] 60 [60–63] → 60 [60–63] 0.966
01.connect 301.5 [254–437] → 323 [270–445] 51.5 [34–76] → 63.5 [39–76] 40.5 [34–62] → 40.5 [39–62] 0.993
02.first-turn 3482 [3372–3642] → 3505 [3359–3513] 117.5 [103–148] → 120.5 [103–142] 390 [371–402] → 395 [369–399] 0.915
03.turn-01 1531.5 [1524–1560] → 1534.5 [1518–1549] 11 [11–11] → 11 [11–11] 301 [299–303] → 301 [298–303] 0.885
03.turn-02 1512.5 [1503–1523] → 1514.5 [1507–1524] 6 [6–6] → 6 [6–6] 297.5 [297–299] → 298.5 [298–300] 1.136
03.turn-03 1512.5 [1500–1529] → 1510 [1503–1522] 6 [6–6] → 6 [6–6] 299 [297–302] → 298.5 [297–301] 1.010
03.turn-04 1510.5 [1506–1521] → 1513 [1504–1526] 6 [6–6] → 6 [6–6] 298 [295–301] → 299 [297–301] 1.076
03.turn-05 1511.5 [1496–1517] → 1511 [1496–1516] 6 [6–6] → 6 [6–6] 298.5 [297–303] → 297.5 [297–303] 1.049
03.turn-06 1506.5 [1496–1516] → 1505.5 [1501–1530] 6 [6–6] → 6 [6–15] 298.5 [297–301] → 298.5 [297–302] 0.968
03.turn-07 1516 [1511–1519] → 1507.5 [1499–1523] 6 [6–6] → 6 [6–6] 300.5 [297–303] → 297 [297–301] 0.993
03.turn-08 1508.5 [1503–1521] → 1518 [1505–1570] 6 [6–6] → 6 [6–10] 298.5 [298–299] → 301 [298–304] 0.954
03.turn-09 1511 [1496–1523] → 1505 [1492–1579] 6 [6–6] → 6 [6–29] 298 [297–301] → 298 [295–317] 1.004
03.turn-10 1506 [1497–1511] → 1509.5 [1503–1531] 6 [6–6] → 6 [6–6] 297 [297–301] → 299 [298–303] 1.038
03.warmed-mean 1513.45 [1511–1513.9] → 1513.1 [1511.4–1528.5] 6.5 [6.5–6.5] → 6.5 [6.5–10.1] 299 [298.3–299.5] → 299.1 [298.4–300.9] 0.992
04.second-session 5220.5 [5203–5247] → 5240 [5229–5272] 103 [103–103] → 103 [103–107] 879 [875–883] → 879 [878–891] 1.042
05.control-plane 51 [45–66] → 46.5 [45–50] 0 [0–9] → 0 [0–0] 5.5 [5–9] → 5 [5–5] 1.001
06.cron 1447 [1433–1494] → 1450 [1437–1480] 50 [43–54] → 50 [48–50] 203 [201–204] → 204 [203–207] 1.032
07.compaction 853.5 [825–924] → 850.5 [710–869] 45 [45–68] → 45 [45–54] 92 [90–110] → 92.5 [88–93] 0.990
08.shutdown 702 [395–890] → 679.5 [357–860] 202 [180–224] → 150 [139–161] 82 [38–107] → 75 [39–107] 0.915

All shared phase duration ratios are ≤1.5. First-turn work is assessed with the source-attributed deferred-startup window, not reported as a W6 turn saving. Warmed variation is also in unchanged owners.

Historical combined windows and complete shared total

These medians are calculated from the raw sums in each run; they are not sums of independently selected phase medians.

Window ALL base → candidate, median [min–max] MAIN base → candidate Requests base → candidate C/B duration
Boot + connect 2741 [2678–2861] → 2763.5 [2694–2869] 2054.5 [2038–2079] → 2066.5 [2042–2082] 102 [94–122] → 101.5 [100–122] 0.971
Boot + connect + first 6225.5 [6200–6320] → 6222 [6203–6285] 2178 [2170–2186] → 2183 [2172–2197] 494.5 [489–496] → 495 [485–501] 0.954
Control + cron 1498.5 [1485–1560] → 1496.5 [1484–1529] 50 [43–63] → 50 [48–50] 208.5 [206–213] → 209 [208–212] 1.044
Compaction + shutdown 1544 [1243–1804] → 1461.5 [1206–1707] 247 [225–270] → 199.5 [184–206] 174 [130–215] → 165.5 [131–199] 1.030
All shared phases 29661.5 [29287–29971] → 29656.5 [29316–29798] 2647 [2613–2673] → 2601 [2585–2637] 4744.5 [4686–4789] → 4754.5 [4699–4777] 0.984

Evidence

Canonical node scripts/database-worker-inventory.mjs --json gives T1 784 → 770, T2 374→374, T3 252→254, W 1072→1076; the T1 ratchet passes without a baseline change. The 14 retired T1 sites are handoff 2, intent 2, sentinel-row read 1, receipt facade 6, and receipt kernel 3. Historical T1 was 797→779 (18 retired); current main had already consolidated five receipt transitions into one helper, accounting for four fewer raw sites.

The diff spans 63 files, +3434/−1232. Production: 34 files, +1830/−755, net +1075. Tests/support: 27 files, +1563/−474. Docs: +23; tooling: +18/−3. Growth carries physical identity, live admission, commit acknowledgement, accepted-work settlement, and bounded code-preparation custody through the existing owners. Superseded synchronous runtime paths are deleted; retained native contracts are documented.

Gate Final evidence
Focused owners/regressions Receipt/report/recovery/transport, intents/handoff, broker/preparation/run-loop, cold imports. Post-integration 145/145 in 304.25 s at 30f671da51b8; final broker/run-loop 209/209 in 234.18 s; final Talk store 9/9 in 44.69 s; cold-import correction 5/5 in 49.35 s. Runs overlap and are not summed as unique coverage.
Full check-changed Passed on final b48f88f9f3f6 vs c786f4d4, both local and Linux, no skip flags or baseline relaxation. Core lint reported eight warnings and zero errors; script lint zero warnings/errors.
Madge / Knip / ratchet Zero Madge cycles; full production/full-tree Knip and all three unused-export scans passed; canonical T1 ratchet passed.
Fresh Codex P2 review Full-branch review scoped-clean at 30f671da51b8 vs c786f4d4, with complete run-loop/lifecycle and broker-admission context. Later test-fixture and cleanup/lint corrections were separately scoped-clean before the final commit.
SDK API diff Canonical comparison completed on final head. No entrypoint additions/removals and no direct exported declaration/kind changes; all 131 reported changes are reachable internal declarations, including the extracted restart types, optional broker preparation, and private Talk type. This is not an empty diff. Digest f9f5b82033db9e5507a2e1162438f963279451c9bf71a11a89cce304a0ebab48. The tagged private QA qa-runtime intent writer stays synchronous, verified separately because it is outside the published SDK manifest.
Canonical package/integrity Passed on final head. SHA-256 7b314d7a98a6e02075db9fde174eb3e0f6acc5f26b33386c305d9643b577db78.
Published-driver update Published 2026.9.8 driver → candidate 2026.9.9, build commit b48f88f9f3f6eafedfce6b06bc227f38c3b209c6; update exit 0, run finished, readyz 200, running version and durable/incognito checks passed, cleanup passed. Update command took 564.665 s.

Original intent contention was red on the historical parent (intent returned while its row survived) and green on candidate (yield, join writer, atomically delete, second consume returns null). Coverage also protects physical replacement, foreign commits, lost replies after commit, revoked publication authority, reservation/sweep takeover, FIFO, capacity preemption, stale/foreign/reused preparation handles, native retirement, and late Stop decisions.

Measured test times are command/wrapper wall times, not CI seconds; CI seconds are unavailable at PR creation. The direct report fixture uses synthetic GitHub transport, not live GitHub authentication or network RPC admission. The real compiled Gateway readiness and published-driver tests establish their separate runtime boundaries. No final-head full shared-workload medians are claimed. Each direct fixture retains one initial warming snapshot send with unmatched receiver pairing; it is counted on both sides and does not affect product request totals. Missing-context rows and duplicate sends are zero.

Packaging reports a Control UI startup-JS gzip budget violation: 373702 B versus 373454 B (+248 B), despite canonical package/integrity exit 0. UI source is untouched, but this batch has no matching base full-UI build to establish inheritance; the UI budget is not claimed as passed. Startup CSS remained below its hard ceiling. The driver’s running-version probe establishes the exact handshake build identity; its separate status probe is scope-limited, not an operator-read RPC health claim. No UI budget or other baseline was changed. The initial SDK attempt failed creating a disposable worktree with Disk quota exceeded before comparison; its retry places checkout, temporary worktrees, and caches on verified disk-backed storage. The disk-backed SDK-only retry completed successfully on the same pinned revisions; successful runtime/package gates were not rerun.

Final successful runtime allocation waited approximately 107 minutes in the default lane queue. This continuation's seven attempts recorded 20/5/17/44/21/59/106 one-minute wait messages, two fleet refusals (21/20), and two 10-minute backoffs; interrupted waits are approximate, not exact summed wall time. An AWS quota fallback selected an unsuitable 2 GiB machine, which was released before heavy proof; a later inventory prerequisite failure was corrected in the proof adapter. Earlier distinct proof windows recorded roughly 175 and 29 minutes of waits. The final SDK-only retry obtained a normal lane slot without another wait. Both final Hetzner leases were released and provider cleanup verified complete; the initial asynchronous cleanup warning was resolved by the final lease inspection. The fleet cap stayed unchanged and at most one lease was held. Earlier queued attempts were cancelled for reviewed validation corrections. The final runtime run and SDK-only retry used the same pinned source; their tooling/environment recovery did not change product code.

Landing integration and startup bundle repair

Integrated main at 5c81678cb280e6aa871522b08dceef5e706af03e with a merge commit. Overlap with #167493, #167542, and #167552 is resolved: main's test pruning, shared report-cleanup helper, and admitted-writer owner remain. Report receipt operations retain their explicit transaction/commit grants and commit acknowledgments. One newly extracted hosted-stop fixture now uses the asynchronous intent mock. The compiled PR wrapper inventory includes the new memory-pressure subscription module.

The historical 248-byte Control UI overage was reproduced as 516 bytes after integration. Settings/sidebar-only navigation helpers now load with their consumers, and deferred Lit guard/unsafe-html directives no longer enter the forced startup chunk. Implementations, rendering, and behavior are unchanged. Startup JavaScript gzip is 373970 → 373236 bytes, below the unchanged 373454-byte cap, with 8 startup requests. The strict pnpm ui:check-performance gate passes. No size budget was raised.

The released SDK surface was rechecked against both v2026.9.9 and v2026.10.1-beta.1: qa-runtime keeps the synchronous writeGatewayRestartIntentSync contract; the changed consume/handoff/receipt functions are internal, and existing sqlite-runtime signatures remain. The approved-head SDK report and published 2026.9.8-driver update proof above remain valid for unchanged contracts. No SQL remeasurement was performed at landing: receipt statements and prewarming SQL behavior remain the reviewed implementation, while existing sentinel operations preserve main's admitted-write behavior.

Integrated diff: production +1956/-880 (net +1076), tests/support +1583/-446 (net +1137), docs +23, tooling +19/-3. ClawSweeper initially reviewed b48f88f9f3f6eafedfce6b06bc227f38c3b209c6 with zero findings. Its later f94c6cf17f0b review identified missing execution context in the direct report fixture and a Linux managed-stop fake-clock race. Both findings are addressed by the final fixture repairs below.

Landing validation: fresh Codex P2 review is scoped-clean for the integrated tree. pnpm tsgo:core, pnpm tsgo:core:test (all shards), and pnpm tsgo:ui pass. Madge reports the pre-existing prepared-model-catalog-fingerprints.ts ↔ prepared-model-catalog-worker.ts cycle. Both files are byte-identical to main ae64a98a4eb1bc45765290f5b9988c75ce7eb8ca, outside this PR's delta; no cycle edge is introduced here. The main CI census included successful run https://github.com/openclaw/openclaw/actions/runs/37877146172 on that SHA; this is source-based inheritance evidence, not a claim that the run executed Madge.

Final landing head: 6e8377a8acd8015c177f619b52a63db0f8a4bc95, tree 31060dd6f244ae422945f1f6b9da15ee8f42a2e5. Both report fixtures use the canonical execution-owning context; the WebSocket fixture joins database workers before raw reads and teardown. The Linux managed-stop fixture waits for actual restart-drain ownership before advancing its unchanged 29,999 + 1 ms deadline. No production behavior, assertion, timeout, or budget was relaxed.

The final three-fixture P2 review is scoped-clean. Focused verification passes: direct report handler 10/10, WebSocket authority 18/18, sentinel/recovery 55/55, run-loop 138/138, UI navigation/search/chunking 155/155. The last integration batch took 630.37s wrapper wall time (Vitest phases 255.23s, 295.82s, 54.28s); this loaded macOS host spent substantial time transforming sources. Prior completed transport 26, daemon 15, report 21, cold-import 5, wrapper 17, build-graph/import-boundary 11 and reply-import 1 cases are retained as separate evidence, not summed as unique coverage.

The real report suite passed 45/46, including accepted transport, receipt and cleanup settlement. Its first unknown Doctor-check case timed out at 120s; the exact case independently reproduced on main ca31b89d2217e952a7d59f68f511e4c652e5d4a3 (152525ms, 586.14s wrapper). The catalog-loading owner is byte-identical; cold Doctor-catalog loading under host contention is the likely cause, while the precise stalled stage remains uninstrumented. This inherited timeout is recorded, not claimed fixed.

CI on f94c6cf17f0b found the repaired direct/WebSocket fixture omissions and managed-stop timer race, plus two inherited main failures: the Madge cycle above and the pending-admission read in sessions.initial-transfer-custody.test.ts. The latter comes from main-added session-transcript-worker-read-admission.ts in #167515: it asserts writable admission before the test’s read-only lookup, before reaching this PR’s worker dispatch. Final-head CI run 37884748337 completed with every selected job green except this independently inherited session-transfer case and its aggregate; there were no cancellations. The Linux managed-stop case passed in 2350 ms in job 113672444383. Required security checks are green. Landing uses the native pre-existing-failure exception with the exact tested merge, complete job accounting, source-blob equality and scoped passing proof; the CI failure is not relabeled green. The separate Testbox request timed out before execution and was cleaned up; completed GitHub CI supplies the Linux proof.

@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime cli CLI command changes scripts Repository scripts size: XL labels Oct 9, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 9, 2026
@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The branch moves restart intents, successor handoffs, and update-report receipts into existing SQLite workers, joins accepted work during shutdown, and reduces eager Control UI imports.

Example: An operator restarts the Gateway while SQLite has a competing writer.

  • Before: The Gateway can return the gateway.restart intent even when its separate deletion fails, allowing a later signal to reuse it.
  • After: The worker atomically consumes the intent, so a later signal cannot reuse it.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful owner-level repair with production restart and upgrade evidence, resolved prior findings, and no newly identified actionable defect.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Recorded compiled-Gateway Linux runs exercise restart RPC through predecessor exit, persisted handoff restoration, successor readiness, and authenticated sessions.list; the central restart code remains unchanged through this head. Report settlement and revocation have production-owner harness coverage with synthetic GitHub I/O. Published-updater evidence and unchanged stored formats support upgrade compatibility; historical measurements are not presented as exact-head runs.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A restart can reuse an already-returned intent, and shutdown can close storage before an accepted failure report finishes.
Reason: The branch repairs established consumption and shutdown contracts through existing owners. Prior area ownership supports this direction, with no new user setting or stored format.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary: current main retains non-atomic restart-intent consumption. Both prior fixture findings are resolved, and no new actionable patch defect was identified. The remaining CI failure is in inherited session-admission code.

Priority: P2
Reviewed head: 6e8377a8acd8015c177f619b52a63db0f8a4bc95

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Gateway lifecycle coordinates restart signals, storage shutdown, and successor startup. Failure reporting uses the same storage infrastructure to record consented submissions and finish accepted cleanup before shutdown.

flowchart TD
  A[Restart signal] --> B[Gateway lifecycle]
  C[Confirmed failure report] --> D[Current authority checks]
  B --> E[Shared SQLite workers]
  D --> E
  E --> F[Atomic writes and commit receipts]
  F --> G[Report submission and cleanup]
  F --> B
  B --> H[Successor startup]
Loading

Technical review

Best possible solution:

Complete the worker cutover through the existing lifecycle owners while preserving live publication authority, accepted-work settlement, and released synchronous SDK contracts.

Do we have a high-confidence way to reproduce the issue?

Yes, source establishes the read/delete failure mechanism on current main, and the PR records a failing historical contention case. This read-only review did not execute a reproduction.

Is this the best way to solve the issue?

Yes, atomic consumption and settlement belong in the existing shared writer and lifecycle owners; the branch removes the competing synchronous runtime paths while retaining documented native contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0ffd46b94dd3.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current main still needs the repair: Current main reads the intent and separately invokes cleanup before returning it; cleanup failure can leave the returned row available for another signal. (src/infra/restart-intent.ts:491, 0ffd46b94dd3)
  • Atomic consumption and settlement: The introduced worker operation uses DELETE RETURNING inside the existing write transaction, obtains transaction and commit grants, and retains a commit receipt for lost-reply reconciliation. (src/infra/restart-lifecycle.worker.ts:19, 6e8377a8acd8)
  • Accepted report work joins shutdown: The report handler tracks submission through the connection execution owner, covering transport, receipt finalization, and artifact cleanup. (src/gateway/server-methods/update-report.ts:226, 6e8377a8acd8)
  • Final publication authority: Pending admission receives the live publisher assertion, and the returned synchronous callback checks authority again immediately before the existing GitHub transport starts its request. (src/infra/update-failure-report.ts:407, 6e8377a8acd8)
  • Transport boundary: The existing issue transport awaits preparation, invokes its synchronous final-effect guard, and starts issue creation without another intervening await. (src/infra/github-issue.ts:254, 6e8377a8acd8)
  • Recorded production and upgrade proof: The complete PR body records twelve compiled-Gateway Linux runs covering restart RPC, predecessor exit, persisted handoff restoration, successor readiness, and authenticated sessions.list, plus a published 2026.9.8 updater run with durable/incognito checks. These measurements belong to candidate b48f88f; comparison confirms the central restart implementations remain unchanged through the reviewed head. The direct report harness uses synthetic GitHub transport. The body SHA-256 matches the captured ad6fde171e75afdb27f0206f877f020de7c6a715191223d8e5e3daca5c3b5ee7. (b48f88f9f3f6)

Likely related people:

  • Peter Steinberger: Raw commit d8b18a6 adds src/infra/restart-sentinel.ts:96 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d8b18a62a3c6; files: src/infra/restart-sentinel.ts)
  • Jason (Json): Raw commit bf00dc5 adds src/infra/update-failure-report-receipt-store.ts:186 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bf00dc5c98e9; files: src/infra/update-failure-report-receipt-store.ts)

PR surface

Source +1076, Tests +1139, Docs +23, Other +14. Total +2252 across 75 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 41 1956 880 +1076
Tests 30 1583 444 +1139
Docs 1 23 0 +23
Config 0 0 0 0
Generated 0 0 0 0
Other 3 19 5 +14
Total 75 3581 1329 +2252

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded restart and shutdown-settlement repair without evidence of an urgent widespread outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-09T02:32:40.607Z sha b48f88f :: needs changes before merge. :: none
  • reviewed 2026-10-09T03:43:23.464Z sha f94c6cf :: needs changes before merge. :: [P2] Supply an execution context in the direct report fixture | [P2] Synchronize the managed-stop test before advancing fake time
  • reviewed 2026-10-09T04:44:51.022Z sha 6e8377a :: needs maintainer review before merge. :: none
  • reviewed 2026-10-09T04:55:17.077Z sha 6e8377a :: needs maintainer review before merge. :: none

Reviewed October 9, 2026, 1:31 AM ET / 05:31 UTC (Revision 5).

Merge current main without rebasing, preserving admitted-worker ownership,
report cleanup consolidation, and test pruning. Keep atomic restart intent
consumption, current authority checks, and commit receipt settlement.

Complete the extracted PR wrapper dependency inventory and adapt the new
hosted-stop fixture to async intent consumption. Move Settings-only helpers
out of eager navigation and keep deferred Lit directives out of startup;
the unchanged startup gzip budget now passes at 373236 bytes.

Fresh Codex P2 autoreview found no actionable findings. Focused runtime and
type verification continue on this integrated tree before landing.
@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Oct 9, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 9, 2026
Supply the canonical execution-owning request context in direct and
WebSocket update-report fixtures. Join shared database workers before raw
receipt inspection and teardown.

Wait for restart-drain ownership before advancing the managed-stop test's
fake clock, preserving its original deadline and lease-settlement assertions.
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 9, 2026
@steipete
steipete merged commit 40d57f8 into main Oct 9, 2026
180 of 183 checks passed
@steipete
steipete deleted the dbasync/w6restartsettle branch October 9, 2026 05:46
@steipete

steipete commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 10, 2026
…penclaw#167572)

* fix(gateway): settle restart intents and update reports in workers

Consume restart intents atomically through the shared-state writer, preserve signal ordering and shutdown budgets, and join accepted update-report receipt work before shutdown. Keep physical-source and live-authority fences, reconcile committed replies without replay, and retain native CLI and boot contracts. No schema, retention, or permission changes.

* test: synchronize update report receipt races

* test: preserve restart lifecycle mock exports

* fix: break restart lifecycle import cycles

* fix: make asynchronous signal settlement loops explicit

* fix(gateway): avoid loading unrelated commands during restart handoff

* perf(gateway): preload restart worker code during shutdown

* test(state): preserve the cold import isolation fixture

* fix(gateway): await restart preparation cleanup in its owner

* test(gateway): join async restart and report fixture work

Supply the canonical execution-owning request context in direct and
WebSocket update-report fixtures. Join shared database workers before raw
receipt inspection and teardown.

Wait for restart-drain ownership before advancing the managed-stop test's
fake clock, preserving its original deadline and lease-settlement assertions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant