Skip to content

feat(sessions): add inactive session actor and scoped receipts - #168602

Merged
steipete merged 65 commits into
mainfrom
dbasync/actorb1
Oct 11, 2026
Merged

steipete merged 65 commits into
mainfrom
dbasync/actorb1

Conversation

@steipete

@steipete steipete commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Related: #168316 (stacked parent)

What Problem This Solves

Chat turns repeatedly read and update the same session state through separate database requests.

User Impact

There is no intended user-visible change: this PR supplies an inactive session actor for later input, transcript, and delivery cutovers, with no production caller switched. A supporting SQL-classification fix also avoids false invalidation in existing readers. Storage format, durability, retention, permissions, and released SDK contracts are preserved.

Why This Change Was Made

The existing writer owns each actor by captured physical database identity and session key. Phase commands reuse its synchronous transaction kernels and held preimages; cold commands hydrate inside that transaction. Retained handles cover accepted descendants until actual drain, while FIFO is held only for synchronous work. Durable and worker-backed incognito targets delegate to their current workers. Contract update 2: native incognito: actor declines; existing owner until P12. Acquisition returns not-actor-owned before constructing an actor. Accepted edge case: native incognito sessions get no actor savings until Phase E/P12 moves incognito onto the actor as its memory-only backend. Follow-on B3 #168539 and B4 #168592 must honor the decline.

Exact receipts capture complete postimages, adopted IDs/parents, custody, and reducer results before fallible publication. MAIN installs them before acknowledgement. Known commits stay known after publication failure; unknown outcomes fence and reconcile without replay. Live authority remains checked at effects. Session-scoped receipts preserve unrelated snapshots while related windows and aliases invalidate together; explicit broad events still fence all affected keys.

The persistence interface contains typed commands, explicit version/domain predicates, and complete postimages; native database handles and SQL dialect operations remain within the storage adapters. The actor's write path uses in-process receipt counters and bypasses the legacy TEMP generation read. This does not claim removal of legacy callers' reads before their cutovers.

Following “Choose good compromises,” the replica no longer clones and validates command IDs, phases, and before/after versions a second time, or repeats freshness checks around synchronous cloning. It trusts the existing command owner and keeps one freshness check before installation. This removes 33 production lines and 17 test lines. Accepted edge: the private replica does not independently reject a fabricated receipt after the owner has already validated it. Generic unknown-outcome replay remains disabled because additive usage reducers lack durable deduplication; no new retry ledger or recovery protocol is added.

Commands accept an optional expected version and return an authorized stale-version postimage on mismatch, so callers can retry once without a separate read request. Native admission callbacks cannot mutate the preimage. Shared SQL helpers preserve one mutation implementation, and the worker transport no longer imports host configuration capture. Inactive API roots remain explicitly audited until the cutovers make them reachable.

Final comparison base: 1d4f42e8f3852c8804da09edf2e81ed848762d78 on dbasync/w11entrycache. Five real conflicts required one parent integration, preserving its steer-only rewrites, empty-cleanup skip, expanded incognito facts, and admission lifetime fixes. Parent savings are not credited to this PR.

Evidence

Statement and request measurements

Passed: 14 complete alternating baseline/candidate pairs, stopped at the first duration-valid series. Warmed all-thread statements are 678.1 → 672.5, DB requests 148.05 → 145.05, and logical requests 171.25 → 168.10 per turn. The first-turn increase is 1.5 statements (+0.0713%), with fewer requests and attributed existing work. The additional whole-workload check is lower by 48 statements and 32.5 logical/DB requests. The actor remains inactive; only the supporting SQL-classifier fix receives causal savings credit.

Measurements compare parent 1d4f42e8f3852c8804da09edf2e81ed848762d78 with frozen cc65e9aacc50bfd2e86a8edc0eb89d561e571b3a artifacts. Final source 6e8a003 has separate focused cleanup proof described below. The shared harness is unchanged. A lane-owned observer defers stack symbolization until after each run, equally on both revisions, preserving the 512 MiB worker heap limit. Transfer frames count once, independently of logical/DB requests and admission/control frames. Successful explicit COMMIT/END counts are separate from autocommit statements. All native statements, including work not joined to a logical request, remain in the totals.

All phases: all-thread and MAIN medians [min–max], requests, frames, transactions and duration

14 alternating pairs; each cell is median [min–max]. Warmed observations are the per-run ten-turn means. MAIN requests and frames originate on Gateway thread 0; MAIN statements execute there. Explicit committed transactions count successful COMMIT/END statements separately from autocommit statements.

Native statements

Phase Base all-thread Candidate all-thread Base MAIN Candidate MAIN
01.boot 2,160 [2,148–2,167] 2,148 [2,135–2,171] 1,923 [1,922–1,926] 1,922 [1,895–1,923]
01.connect 727.5 [155–1,324] 713.5 [136–1,601] 35 [16–137] 20 [5–155]
02.first-turn 2,105 [1,461–2,679] 2,106.5 [1,199–2,643] 159 [57–211] 156.5 [47–192]
03.warmed-per-turn 678.1 [655.4–721.2] 672.5 [655.7–718.8] 10.8 [8.6–17.8] 10.15 [8.6–17]
04.second-session 2,734.5 [2,439–2,969] 2,766 [2,451–2,908] 109 [82–139] 113.5 [89–135]
05.control-plane 19 [18–334] 20.5 [18–334] 0 [0–31] 0 [0–31]
06.cron 854 [795–1,405] 820.5 [771–1,097] 26 [19–173] 26 [6–62]
07.compaction 271.5 [267–393] 267.5 [267–531] 24 [24–46] 24 [24–155]
08.shutdown 123.5 [118–138] 121 [115–133] 69 [66–82] 69 [63–69]
done 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
total 15,788.5 [15,395–16,878] 15,740.5 [15,378–16,624] 2,471.5 [2,403–2,673] 2,440 [2,417–2,658]

All logical worker requests

Phase Base all-thread Candidate all-thread Base MAIN Candidate MAIN
01.boot 60 [58–61] 58 [58–62] 60 [58–61] 58 [58–62]
01.connect 26 [19–77] 25 [18–102] 26 [19–77] 25 [18–101]
02.first-turn 328.5 [270–361] 326.5 [250–353] 326.5 [268–359] 325.5 [250–352]
03.warmed-per-turn 171.25 [165.7–182.9] 168.1 [163.8–180.9] 171.25 [165.7–182.9] 168.1 [163.8–180.9]
04.second-session 628.5 [559–705] 644 [559–673] 628.5 [559–705] 644 [559–673]
05.control-plane 5 [5–79] 6 [5–79] 5 [5–79] 6 [5–79]
06.cron 174.5 [157–294] 166.5 [153–243] 174.5 [157–294] 166.5 [153–243]
07.compaction 72 [71–104] 71 [71–120] 72 [71–104] 71 [71–120]
08.shutdown 16 [14–18] 15.5 [14–17] 16 [14–18] 15.5 [14–17]
done 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
total 3,037 [2,946–3,294] 3,004.5 [2,911–3,226] 3,035 [2,944–3,292] 3,003.5 [2,910–3,225]

Database worker requests

Phase Base all-thread Candidate all-thread Base MAIN Candidate MAIN
01.boot 58 [56–59] 56 [56–60] 58 [56–59] 56 [56–60]
01.connect 26 [19–70] 25 [18–94] 26 [19–70] 25 [18–93]
02.first-turn 291.5 [237–323] 289.5 [221–315] 289.5 [235–321] 288.5 [221–314]
03.warmed-per-turn 148.05 [142.8–159] 145.05 [140.9–156.9] 148.05 [142.8–159] 145.05 [140.9–156.9]
04.second-session 552.5 [485–624] 565 [485–594] 552.5 [485–624] 565 [485–594]
05.control-plane 5 [5–77] 6 [5–77] 5 [5–77] 6 [5–77]
06.cron 157.5 [140–268] 149.5 [137–223] 157.5 [140–268] 149.5 [137–223]
07.compaction 59 [58–90] 58 [58–100] 59 [58–90] 58 [58–100]
08.shutdown 8 [7–10] 7 [7–10] 8 [7–10] 7 [7–10]
done 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
total 2,651.5 [2,564–2,890] 2,619 [2,530–2,823] 2,649.5 [2,562–2,888] 2,618 [2,529–2,822]

CPU worker requests

Phase Base all-thread Candidate all-thread Base MAIN Candidate MAIN
01.boot 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
01.connect 0 [0–1] 0 [0–1] 0 [0–1] 0 [0–1]
02.first-turn 3 [2–4] 3 [2–4] 3 [2–4] 3 [2–4]
03.warmed-per-turn 1.4 [1.3–1.6] 1.35 [1.3–1.6] 1.4 [1.3–1.6] 1.35 [1.3–1.6]
04.second-session 7 [5–8] 7.5 [5–8] 7 [5–8] 7.5 [5–8]
05.control-plane 0 [0–2] 0 [0–2] 0 [0–2] 0 [0–2]
06.cron 1 [1–4] 1 [1–2] 1 [1–4] 1 [1–2]
07.compaction 0 [0–0] 0 [0–1] 0 [0–0] 0 [0–1]
08.shutdown 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
done 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
total 25 [24–30] 25.5 [24–29] 25 [24–30] 25.5 [24–29]

Native execution errors

Phase Base all-thread Candidate all-thread Base MAIN Candidate MAIN
01.boot 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
01.connect 0 [0–2] 0 [0–3] 0 [0–2] 0 [0–3]
02.first-turn 1 [0–3] 0 [0–3] 1 [0–3] 0 [0–3]
03.warmed-per-turn 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
04.second-session 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
05.control-plane 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
06.cron 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
07.compaction 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
08.shutdown 2 [1–3] 1 [1–4] 1 [0–2] 1 [1–1]
done 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
total 3 [2–6] 3 [1–5] 2 [1–4] 1 [1–4]

Native prepare errors

Phase Base all-thread Candidate all-thread Base MAIN Candidate MAIN
01.boot 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
01.connect 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
02.first-turn 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
03.warmed-per-turn 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
04.second-session 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
05.control-plane 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
06.cron 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
07.compaction 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
08.shutdown 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
done 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
total 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]

Resource cleanup requests

Phase Base all-thread Candidate all-thread Base MAIN Candidate MAIN
01.boot 2 [2–2] 2 [2–2] 2 [2–2] 2 [2–2]
01.connect 0 [0–6] 0 [0–7] 0 [0–6] 0 [0–7]
02.first-turn 34 [28–34] 34 [27–34] 34 [28–34] 34 [27–34]
03.warmed-per-turn 21.8 [21.6–22.3] 21.7 [21.6–22.4] 21.8 [21.6–22.3] 21.7 [21.6–22.4]
04.second-session 70 [69–73] 71 [69–72] 70 [69–73] 71 [69–72]
05.control-plane 0 [0–1] 0 [0–0] 0 [0–1] 0 [0–0]
06.cron 16 [16–22] 16 [15–18] 16 [16–22] 16 [15–18]
07.compaction 13 [13–14] 13 [13–19] 13 [13–14] 13 [13–19]
08.shutdown 8 [7–8] 8 [7–9] 8 [7–8] 8 [7–9]
done 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
total 360 [358–374] 360.5 [356–374] 360 [358–374] 360.5 [356–374]

Transfer frames

Phase Base all-thread Candidate all-thread Base MAIN Candidate MAIN
01.boot 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
01.connect 0 [0–12] 0 [0–7] 0 [0–6] 0 [0–1]
02.first-turn 75 [63–75] 44 [37–44] 33 [27–33] 20 [19–20]
03.warmed-per-turn 18 [18–18] 18 [18–18] 9 [9–9] 9 [9–9]
04.second-session 55 [55–55] 55 [55–55] 28 [28–28] 28 [28–28]
05.control-plane 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
06.cron 18 [18–24] 18 [18–18] 9 [9–12] 9 [9–9]
07.compaction 14 [14–14] 14 [14–20] 8 [8–8] 8 [8–11]
08.shutdown 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
done 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
total 342 [342–348] 311 [311–317] 168 [168–171] 155 [155–158]

Admission and control frames

Phase Base all-thread Candidate all-thread Base MAIN Candidate MAIN
01.boot 16 [14–16] 14 [14–16] 0 [0–0] 0 [0–0]
01.connect 27 [21–55] 26 [19–76] 0 [0–0] 0 [0–0]
02.first-turn 293.5 [236–326] 291 [246–327] 0 [0–0] 0 [0–0]
03.warmed-per-turn 164.2 [159–174.5] 162.3 [158–173.8] 0 [0–0] 0 [0–0]
04.second-session 624.5 [537–677] 630 [536–673] 0 [0–0] 0 [0–0]
05.control-plane 2 [2–92] 2 [2–92] 0 [0–0] 0 [0–0]
06.cron 171 [171–278] 171 [171–223] 0 [0–0] 0 [0–0]
07.compaction 32 [32–48] 32 [32–49] 0 [0–0] 0 [0–0]
08.shutdown 2 [2–2] 2 [2–2] 0 [0–0] 0 [0–0]
done 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
total 2,816 [2,746–3,025] 2,817.5 [2,731–2,968] 0 [0–0] 0 [0–0]

Actor commands

Phase Base all-thread Candidate all-thread Base MAIN Candidate MAIN
01.boot 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
01.connect 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
02.first-turn 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
03.warmed-per-turn 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
04.second-session 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
05.control-plane 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
06.cron 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
07.compaction 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
08.shutdown 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
done 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
total 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]

Explicit committed transactions

Phase Base all-thread Candidate all-thread Base MAIN Candidate MAIN
01.boot 36 [35–37] 35 [35–38] 12 [12–12] 12 [12–12]
01.connect 18.5 [13–41] 18 [11–50] 0 [0–5] 0 [0–6]
02.first-turn 128 [104–137] 131 [94–136] 7 [2–7] 7 [1–7]
03.warmed-per-turn 66.1 [64.5–68.8] 66.05 [64.7–69.1] 0.4 [0.3–0.6] 0.35 [0.3–0.6]
04.second-session 262.5 [240–280] 263 [241–276] 3.5 [3–5] 4 [3–5]
05.control-plane 3 [3–28] 3 [3–28] 0 [0–1] 0 [0–1]
06.cron 73.5 [68–111] 69 [67–92] 0 [0–1] 0 [0–1]
07.compaction 15 [15–25] 15 [15–28] 1 [1–2] 1 [1–2]
08.shutdown 10 [10–10] 10 [9–10] 5 [5–5] 5 [4–5]
done 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
total 1,213 [1,186–1,280] 1,213 [1,185–1,267] 32.5 [31–36] 32 [31–36]

Frame direction and control class (all threads)

Phase Base send Candidate send Base reply Candidate reply Base worker control Candidate worker control Base admission Candidate admission
01.boot 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0] 16 [14–16] 14 [14–16]
01.connect 0 [0–6] 0 [0–4] 0 [0–6] 0 [0–3] 0 [0–0] 0 [0–1] 27 [21–55] 26 [19–75]
02.first-turn 39 [33–39] 23 [19–23] 36 [30–36] 21 [18–21] 3 [3–3] 2 [1–2] 290.5 [233–323] 289 [245–325]
03.warmed-per-turn 9 [9–9] 9 [9–9] 9 [9–9] 9 [9–9] 0 [0–0] 0 [0–0] 164.2 [159–174.5] 162.3 [158–173.8]
04.second-session 28 [28–28] 28 [28–28] 27 [27–27] 27 [27–27] 1 [1–1] 1 [1–1] 623.5 [536–676] 629 [535–672]
05.control-plane 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0] 2 [2–92] 2 [2–92]
06.cron 9 [9–12] 9 [9–9] 9 [9–12] 9 [9–9] 0 [0–0] 0 [0–0] 171 [171–278] 171 [171–223]
07.compaction 8 [8–8] 8 [8–11] 6 [6–6] 6 [6–9] 2 [2–2] 2 [2–2] 30 [30–46] 30 [30–47]
08.shutdown 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0] 2 [2–2] 2 [2–2]
done 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0] 0 [0–0]
total 174 [174–177] 158 [158–161] 168 [168–171] 153 [153–156] 6 [6–6] 5 [5–5] 2,810 [2,740–3,019] 2,812.5 [2,726–2,963]

Instrumented phase duration

Phase Base seconds Candidate seconds Candidate / base median
01.boot 26.28 [9.33–65.93] 22.88 [7.86–82.01] 0.87
01.connect 1.27 [1.12–9.17] 1.27 [1.11–4.01] 1.00
02.first-turn 11.14 [7.35–26.77] 15.52 [5.55–32.03] 1.39
03.warmed-per-turn 2.2 [1.63–3.62] 2.12 [1.54–3.63] 0.96
04.second-session 8.93 [6.65–16.46] 9.56 [6.48–17.87] 1.07
05.control-plane 1.16 [1.07–1.53] 1.15 [1.08–1.43] 0.98
06.cron 8.12 [5.28–11.95] 7 [5.28–11.64] 0.86
07.compaction 1.39 [1.23–2.66] 1.39 [1.22–2.24] 1.00
08.shutdown 0.44 [0.28–1.13] 0.57 [0.24–1.79] 1.31
done 0.01 [0.01–0.03] 0.02 [0.01–0.26] 1.71
total 82.25 [49.97–164.28] 79.59 [46.41–171.55] 0.97

Statement and request attribution

The active saving is the SQL mutation classifier repair in src/infra/sqlite-schema-mutation.ts, covered by src/infra/sqlite-schema-facts.test.ts. The prior keyword regex matched update inside quoted openclaw.system-update in read-only transcript projections and invalidated the retained entry facts. The quote-aware classifier removes that false invalidation. Neither moving work to a worker nor the inactive actor is credited.

Across 140 warmed turns, baseline observes 700 affected projection SELECTs: database.domain.publish:session.metadata.append=280, model-context=140, transcript-hydration=280.
In the request interval after model-context and before the next transcript hydration, one-statement entry reads are session-exact-entries: 140 → 3; session.entry.read: 147 → 10. These are temporal attribution counts; all statements and requests remain in the raw phase totals.

Removed/reduced request class Baseline requests per ten-turn window Candidate Cost
session-exact-entries 93 83 Reduced variants execute one statement; larger variants retained
session.entry.read 49 38 Reduced variants execute one statement; larger variants retained

Transcript identity/header extraction preserves the same SQL; source-location moves are not counted as savings. Transfer frames are independently observed but no causal frame saving is credited.

Candidate-only request types observed across all 14 pairs: []. Earlier seven-pair observations included deviceAuth.prepare/read and moved anchor/model-context forms; later baseline samples exercise those same existing paths. This is a statement about the final observed set, not an assertion that earlier one-sided observations never occurred.

  • Observed candidate-only SQL form (196 executions), session.pendingInputs.mutate at src/config/sessions/session-pending-input-operations.kernel.ts: insert into "session_pending_inputs" ("input_id", "session_key", "session_id", "idempotency_key", "run_id", "request_hash", "message_json", "lifecycle_generation", "state", "accepted_at") values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) returning *
    Pending-input request cost histograms: baseline {'11': 182, '9': 14}; candidate {'11': 182, '9': 14}. RETURNING captures the custody postimage in the existing statement; it does not add a statement or request.

Whole-workload median-contribution decomposition (largest 16 contributors plus remainder, from middle total-ranked run(s), so contributions sum exactly; independent per-operation medians are also retained in attribution-series.json):

Operation Baseline contribution Candidate contribution Delta
unassigned 2,623.5 2,569.5 -54
database.domain.execute:source.replace 142 174 32
pluginState.compareDelete 144 171 27
pluginState.compareUpdate 112 133 21
pluginCatalog.read 52 32 -20
database.domain.execute:cache.write 91.5 109.5 18
session-corpus-inventory 104 87.5 -16.5
session.entry.read 234.5 219.5 -15
session-membership-facts 78 90.5 12.5
pluginState.observe 64 76 12
session.maintenance.read 122 110 -12
database.domain.execute:source.refresh 15 5 -10
prewarm 0 9 9
session-tombstones 74 66 -8
session-exact-entries 413.5 406 -7.5
session-row-backfill 103.5 111 7.5
Remaining existing operations — — -44

Final gate disposition

The first-turn increase is +1.5 statements (+0.0713%), below the +0.5% noise floor; requests decrease by 2. Its complete contribution table is in sql-attribution.md. Positive native sites are existing admission/lease/maintenance work: sqlite-schema-admission.ts +6, openclaw-agent-db-lease.ts +5, sqlite-busy-timeout.ts +5, sqlite-transaction.ts +5, sqlite-wal.ts +4, sqlite-staging-token.ts +4, and sqlite-pinned-read-snapshot.ts +3. Those source files are byte-identical to baseline. Transcript identity/presence helpers contain the same statement forms previously in the store/header modules; moving those source locations is not new SQL. Participant projection changes only a type export. The per-site audit includes every positive site in positive-owner-attribution.json. These are contributions from the median-ranked runs, not independent causal saving estimates.

The extra whole-workload comparison is also lower (−48 statements, −32.5 logical/DB requests), satisfying the RAW TURN INCREASE redistribution check. All actual phase-duration ratios are ≤1.5; empty done has zero statements/requests and is excluded from that gate. No actor operation ran, no new logical request type appears across the full series, and the only new normalized SQL form is pending-input INSERT RETURNING with unchanged command cost.

The second-session increase is +31.5 statements (+1.152%), within the 2% non-turn tolerance. Its positive non-moved sites are unchanged memory publication/chunk/cache workers, entry revision reads, maintenance/health reads, and type-only participant projection. The control-plane increase is +1.5, within the 10-statement absolute allowance: unchanged plugin-state-store.reads.ts, delivery-queue-storage.kernel.ts, and openclaw-state-ownership.ts. Other nonempty phases are lower.
For context, second-control is 2833 → 2897.5 (+2.2767%); per-run sums appear below.
For context, second-control-cron is 3703 → 3718.5 (+0.4186%); per-run sums appear below.

Native SQL unassigned to a logical request is fully included in all-thread/MAIN totals. All 28 included workloads pass native/request conservation and phase coverage; no observed event falls outside a named workload phase, and SQL after its logical request’s terminal reply remains included in its named workload phase and native totals. See final-sql-conservation-and-drain.json.

Exact operation contributions for increasing phases and whole-workload family costs

02.first-turn: exact median-contribution decomposition

These values use the middle total-ranked run(s) for each side. They sum to the phase median delta; independently computed per-operation medians need not sum.

Existing operation Baseline contribution Candidate contribution Delta
unassigned 137 165 28
pluginCatalog.read 52 32 -20
open 148.5 165.5 17
session-membership-facts 6 18.5 12.5
session.maintenance.read 16 26 10
session.entry.patch.commit 185.5 177.5 -8
agentDatabaseDeletion.snapshot 6.5 13.5 7
session-entry-list 36 30 -6
prewarm 4.5 0 -4.5
auth-profile-rows 14 10 -4
sessionState.prune 4 0 -4
model-context 19.5 16 -3.5
lifecycle-artifact-plan 3.5 0 -3.5
plugins.catalogSnapshot.write 6 3 -3
transcript-stats 7 4 -3
session-tombstones 19 16 -3
catalog 8 5 -3
session-store-projection 9 6 -3
session-entry 21 18 -3
session-target-inventory 15.5 18 2.5
restartSentinel.snapshot 2 0 -2
session-corpus-inventory 58 57 -1
database.prepareWrite 65.5 66 0.5
session.entry.read 23.5 23 -0.5
acpSessions.metadata 0 0.5 0.5
session-pending-archives 0.5 0 -0.5
trajectory-retention 2.5 3 0.5
session-row-facts 22.5 22 -0.5
restartSentinel.admit 0.5 0 -0.5
sessionState.pendingNotices 0.5 0 -0.5
session.lifecycle.project 22.5 22 -0.5
history-page 19 19.5 0.5

04.second-session: exact median-contribution decomposition

These values use the middle total-ranked run(s) for each side. They sum to the phase median delta; independently computed per-operation medians need not sum.

Existing operation Baseline contribution Candidate contribution Delta
database.domain.bind 133.5 140 6.5
session-tombstones 12 16 4
session.maintenance.read 20 24 4
secrets.purge 3.5 0 -3.5
database.domain.execute:source.replace 62 65.5 3.5
session-corpus-inventory 15 18 3
history-page 52 54.5 2.5
session-row-backfill 22.5 20 -2.5
session-row-facts 74 76 2
pluginState.sweep 0 2 2
database.domain.execute:stage.append 7 8.5 1.5
sessionRows.sharedFacts 13.5 15 1.5
unassigned 110.5 112 1.5
bootstrap.prune 0 1 1
deliveryQueue.outbound 5 4 -1
deliveryQueue.countFailed 0 1 1
database.domain.close 21 22 1
database.domain.execute:cache.write 36 36.5 0.5
session.entry.read 38.5 39 0.5
database.domain.execute:cache.prune 1.5 2 0.5
channelIngress.pressureHealth 0 0.5 0.5
database.domain.execute:source.state 1.5 2 0.5
open 3 3.5 0.5
session-exact-entries 109.5 109 -0.5
channelIngress.failedHealth 0 0.5 0.5
pluginState.entries 2 2.5 0.5

05.control-plane: exact median-contribution decomposition

These values use the middle total-ranked run(s) for each side. They sum to the phase median delta; independently computed per-operation medians need not sum.

Existing operation Baseline contribution Candidate contribution Delta
deliveryQueue.outbound 0 1 1
pluginState.entries 0 1 1
open 1 0.5 -0.5

Whole-workload families used for attribution

Family Baseline request median Candidate request median Baseline cost median Candidate cost median
agentDatabaseDeletion.snapshot 3 3 10 10
database.domain.execute:cache.write 8 8.5 12 12
database.domain.execute:source.replace 7 8 21 21
open 3 3 15 15
pluginCatalog.read 5 2 16 16
pluginState.compareDelete 34 36 4.5 4.5
pluginState.compareUpdate 17 18 7 7
session-exact-entries 155.5 145.5 1 1
session-membership-facts 13 13 6 6
session.entry.read 73.5 61 4 4
session.maintenance.read 23 23 4 4
Every positive native-source contribution in increasing phases

These contributions use the same median-ranked runs as the operation decomposition above. Extracted source locations are paired with the retired location and are not new statements.

Phase Native source Contribution delta Source comparison to baseline
02.first-turn src/infra/sqlite-schema-admission.ts +6 Byte-identical
02.first-turn src/config/sessions/session-accessor.sqlite-transcript-identity.ts +5 Existing SQL extracted; same normalized form
02.first-turn src/state/openclaw-agent-db-lease.ts +5 Byte-identical
02.first-turn src/infra/sqlite-busy-timeout.ts +5 Byte-identical
02.first-turn src/infra/sqlite-transaction.ts +5 Byte-identical
02.first-turn src/config/sessions/session-accessor.sqlite-transcript-presence.ts +4 Existing SQL extracted; same normalized form
02.first-turn src/infra/sqlite-wal.ts +4 Byte-identical
02.first-turn src/infra/sqlite-staging-token.ts +4 Byte-identical
02.first-turn src/infra/sqlite-pinned-read-snapshot.ts +3 Byte-identical
02.first-turn extensions/memory-core/src/memory/manager-database-context.ts +2.5 Byte-identical
02.first-turn src/state/agent-deletion-journal.ts +2 Byte-identical
02.first-turn src/state/openclaw-state-db-schema-helpers.ts +2 Byte-identical
02.first-turn src/config/sessions/session-accessor.sqlite-entry-revision.ts +1.5 Byte-identical
02.first-turn src/infra/sqlite-wal-write-admission.ts +1 Byte-identical
02.first-turn src/state/openclaw-quarantine-store.ts +1 Byte-identical
02.first-turn src/state/openclaw-agent-db-registry.ts +1 Byte-identical
02.first-turn src/state/openclaw-agent-db-registry.read.ts +1 Byte-identical
02.first-turn src/state/openclaw-state-db-operator-approval-migration.ts +1 Byte-identical
02.first-turn src/state/openclaw-state-db-session-watch-migration.ts +1 Byte-identical
02.first-turn src/state/agent-deletion-journal.snapshot.worker.ts +0.5 Byte-identical
02.first-turn src/state/openclaw-agent-db-validation-cache.ts +0.5 Byte-identical
02.first-turn src/config/sessions/session-accessor.sqlite-participant-projection.ts +0.5 Type export only
02.first-turn src/acp/runtime/session-meta-keys.ts +0.5 Byte-identical
02.first-turn src/state/openclaw-agent-db-schema.ts +0.5 Byte-identical
02.first-turn src/config/sessions/session-accessor.sqlite-entry-cache-projection.ts +0.5 Byte-identical
02.first-turn src/trajectory/runtime-retention.sqlite.ts +0.5 Byte-identical
02.first-turn src/state/openclaw-agent-db.ts +0.5 Byte-identical
02.first-turn src/state/openclaw-state-ownership.ts +0.5 Byte-identical
02.first-turn src/state/agent-deletion-journal.read.ts +0.5 Byte-identical
04.second-session src/config/sessions/session-accessor.sqlite-transcript-identity.ts +16 Existing SQL extracted; same normalized form
04.second-session src/config/sessions/session-accessor.sqlite-transcript-presence.ts +11 Existing SQL extracted; same normalized form
04.second-session extensions/memory-core/src/memory/manager-publication.worker.ts +8.5 Byte-identical
04.second-session src/config/sessions/session-accessor.sqlite-entry-revision.ts +5.5 Byte-identical
04.second-session extensions/memory-core/src/memory/manager-database-context.ts +2.5 Byte-identical
04.second-session extensions/memory-core/src/memory/manager-sqlite-lease.ts +2.5 Byte-identical
04.second-session extensions/memory-core/src/memory/manager-chunk-writer.ts +2 Byte-identical
04.second-session src/state/openclaw-state-db-schema-helpers.ts +1.5 Byte-identical
04.second-session src/config/sessions/session-accessor.sqlite-participant-projection.ts +1.5 Type export only
04.second-session src/acp/runtime/session-meta-keys.ts +1.5 Byte-identical
04.second-session src/state/openclaw-agent-canonical-validation-receipt.ts +1 Byte-identical
04.second-session src/state/openclaw-quarantine-store.ts +1 Byte-identical
04.second-session extensions/memory-core/src/memory/manager-embedding-cache.ts +1 Byte-identical
04.second-session src/config/sessions/session-accessor.sqlite-entry-cache-projection.ts +1 Byte-identical
04.second-session src/channels/message/ingress-queue-health.kernel.ts +1 Byte-identical
04.second-session src/config/sessions/session-accessor.sqlite-entry-inventory.ts +1 Byte-identical
04.second-session src/config/sessions/session-canonical-key.ts +1 Byte-identical
04.second-session extensions/memory-core/src/memory-entry-origin-reads.ts +1 Byte-identical
04.second-session extensions/memory-core/src/memory/manager-vector-write.ts +1 Byte-identical
04.second-session src/infra/delivery-queue-sqlite.kernel.ts +0.5 Byte-identical
04.second-session extensions/memory-core/src/memory/manager-source-state.ts +0.5 Byte-identical
04.second-session extensions/memory-core/src/memory/manager-db-kernel.ts +0.5 Byte-identical
04.second-session src/config/sessions/session-accessor.sqlite-entry-read.ts +0.5 Existing queries unchanged; actor branch inactive
04.second-session extensions/memory-core/src/memory/manager-sync-base.ts +0.5 Byte-identical
04.second-session src/plugin-state/plugin-state-store.reads.ts +0.5 Byte-identical
04.second-session extensions/memory-core/src/memory/manager-source-index-kernel.ts +0.5 Byte-identical
04.second-session extensions/memory-core/src/memory/manager-retrieval-read.ts +0.5 Byte-identical
04.second-session src/infra/sqlite-wal-checkpoint.ts +0.5 Byte-identical
04.second-session src/plugin-state/plugin-state-store.kernel.ts +0.5 Byte-identical
04.second-session src/infra/device-pairing-store.ts +0.5 Byte-identical
05.control-plane src/plugin-state/plugin-state-store.reads.ts +1 Byte-identical
05.control-plane src/state/openclaw-state-ownership.ts +0.5 Byte-identical
05.control-plane src/infra/outbound/delivery-queue-storage.kernel.ts +0.5 Byte-identical

Combined-window per-run sums

The following are contextual combined windows; they do not replace or hide individual first/warmed phase totals. Run order is the complete alternating pair order.

boot-connect
Metric Baseline per-run sums Candidate per-run sums Baseline median Candidate median
statements 3257, 3250, 3069, 3068, 3491, 2335, 2436, 2318, 2770, 2367, 2688, 2440, 3476, 3003 3069, 2338, 2980, 3227, 2997, 2384, 2301, 2340, 2327, 3759, 2743, 3033, 2309, 3096 2,886.5 2,861.5
logicalWorkerRequests 95, 98, 84, 84, 137, 86, 86, 80, 88, 86, 87, 87, 136, 82 84, 86, 83, 99, 86, 86, 79, 87, 83, 161, 83, 81, 81, 98 86.5 85
databaseWorkerRequests 91, 94, 82, 82, 129, 84, 84, 78, 86, 84, 85, 85, 127, 80 82, 84, 81, 93, 84, 84, 77, 85, 81, 151, 81, 79, 79, 92 84.5 83

Duration ratio: 0.8457.

boot-connect-first
Metric Baseline per-run sums Candidate per-run sums Baseline median Candidate median
statements 5030, 4711, 5105, 4901, 5051, 4974, 5064, 4997, 4944, 5017, 4933, 5019, 4951, 5034 5063, 4981, 4947, 4781, 5030, 5019, 4943, 4690, 4964, 4958, 4923, 4953, 4945, 4844 5,007 4,950
logicalWorkerRequests 437, 368, 444, 392, 439, 416, 417, 416, 414, 421, 412, 414, 416, 443 437, 414, 412, 382, 436, 411, 412, 372, 415, 411, 408, 412, 406, 382 416 411.5
databaseWorkerRequests 397, 331, 404, 355, 399, 377, 378, 377, 375, 382, 373, 375, 377, 403 397, 375, 373, 345, 396, 372, 373, 334, 376, 372, 369, 372, 367, 345 377 372

Duration ratio: 0.9946.

second-control
Metric Baseline per-run sums Candidate per-run sums Baseline median Candidate median
statements 2590, 2722, 2927, 2909, 2600, 2926, 2987, 2821, 2579, 2845, 2638, 2908, 2963, 2583 2900, 2895, 2905, 2793, 2928, 2924, 2985, 2470, 2794, 2768, 2905, 2777, 2910, 2578 2,833 2,897.5
logicalWorkerRequests 597, 628, 676, 674, 601, 676, 710, 654, 596, 661, 606, 673, 698, 594 670, 669, 675, 644, 679, 675, 695, 564, 653, 646, 673, 642, 674, 591 657.5 669.5
databaseWorkerRequests 522, 552, 597, 595, 526, 597, 629, 577, 521, 582, 531, 594, 618, 519 592, 590, 596, 568, 600, 596, 616, 490, 574, 567, 594, 564, 595, 516 579.5 591

Duration ratio: 1.0692.

second-control-cron
Metric Baseline per-run sums Candidate per-run sums Baseline median Candidate median
statements 3385, 3526, 3766, 3718, 3511, 3813, 3836, 3688, 3378, 4250, 3497, 3725, 3835, 3559 3708, 3799, 3726, 3603, 3748, 3831, 3839, 3567, 3822, 3539, 3711, 3604, 3729, 3387 3,703 3,718.5
logicalWorkerRequests 754, 789, 848, 835, 785, 864, 885, 838, 754, 955, 780, 837, 883, 798 830, 858, 842, 805, 843, 874, 869, 807, 868, 799, 834, 809, 840, 752 836 837
databaseWorkerRequests 662, 696, 752, 739, 693, 767, 787, 743, 662, 850, 688, 741, 785, 705 735, 761, 746, 712, 747, 776, 773, 713, 771, 704, 738, 714, 744, 660 740 741

Duration ratio: 1.0281.

control-cron
Metric Baseline per-run sums Candidate per-run sums Baseline median Candidate median
statements 813, 822, 857, 1143, 931, 905, 867, 923, 818, 1455, 1058, 836, 911, 994 1142, 933, 1020, 1040, 840, 925, 973, 1116, 1049, 790, 826, 845, 840, 827 908 929
logicalWorkerRequests 162, 166, 177, 240, 190, 193, 180, 204, 163, 304, 221, 169, 197, 209 239, 195, 209, 218, 170, 204, 200, 248, 221, 158, 168, 172, 172, 166 191.5 197.5
databaseWorkerRequests 145, 149, 160, 221, 173, 175, 163, 185, 146, 278, 203, 152, 179, 191 220, 177, 192, 200, 153, 185, 183, 228, 203, 142, 151, 155, 155, 149 174 180

Duration ratio: 0.8868.

compaction-shutdown
Metric Baseline per-run sums Candidate per-run sums Baseline median Candidate median
statements 394, 396, 394, 388, 473, 396, 398, 394, 389, 399, 531, 400, 385, 433 388, 382, 389, 389, 396, 480, 654, 396, 393, 505, 396, 466, 388, 388 396 394.5
logicalWorkerRequests 90, 88, 88, 86, 103, 94, 89, 86, 87, 89, 122, 90, 85, 96 86, 86, 85, 86, 88, 105, 136, 87, 87, 111, 88, 103, 87, 86 89 87
databaseWorkerRequests 69, 67, 67, 65, 83, 72, 68, 66, 66, 68, 100, 70, 65, 75 65, 65, 65, 65, 67, 85, 108, 67, 66, 90, 67, 82, 65, 65 68 66.5

Duration ratio: 1.1142.

Execution diagnostics

Side Phase Owner Native error count
base 01.connect state lease release (plugin startup/cleanup) 5
base 02.first-turn agent database writer admission 3
base 02.first-turn state lease release (plugin startup/cleanup) 9
base 08.shutdown agent database lease release on idle close 14
base 08.shutdown audit writer prune 15
candidate 01.connect agent database writer admission 4
candidate 01.connect state lease release (plugin startup/cleanup) 3
candidate 02.first-turn agent database writer admission 4
candidate 02.first-turn state lease release (plugin startup/cleanup) 3
candidate 08.shutdown agent database lease release on idle close 14
candidate 08.shutdown audit writer prune 11

Native execution and prepare errors are reported separately in the phase tables. SQL after a logical request’s terminal reply is included in its named phase; the workload’s done phase has zero SQL. Exact SQL, error text and stacks are retained in native-error-attribution.json; do not ascribe observed lease-release/audit-prune errors to the older restart-intent campaign issue. All included workloads completed successfully.

One baseline11 attempt failed before a turn: Gateway readiness 114.941 seconds, handshake timeout at auth_validated (16.649 seconds handshake, 16.933 seconds connection); zero completed turns, boot/connect phases only. Its five fixture PIDs were confirmed exited before retry. failed-base-11/ retains logs, environment, timing, native raw hashes and process-drain proof. The retry used unchanged workload and timeouts. Baseline11’s completed trace then needed a proof-only classifier entry for existing session-maintenance-read; the same raw workload was re-aggregated, not resampled.

A candidate14 attempt also completed no turns: sessions.create returned UNAVAILABLE while discovery read a newly created database before its first schema transaction committed. Initialization BEGIN was 335792770397958ns; discovery SELECT was 335792774968958ns; initialization COMMIT was 335793138231666ns. The five direct path modules are byte-identical on baseline 1d4, final source 6e8 and origin/main b794062 (startup-schema-edge-parity.json). This is source parity, not a baseline behavioral replay. This is an existing visible/retryable startup edge, recorded as a follow-up, not fixed by retrying. All five fixture PIDs exited; completed baseline14 was retained and candidate14 retried with identical runtime/workload/timeouts. failed-candidate-14/ retains sanitized failure RPC, logs, hashes, exact timing and drain proof.

Included harness elapsed time (excludes build, aggregation and waits): base 1242.7s, candidate 1276.5s, total 2519.3s. First/last included phase timestamps: 2026-10-10T16:44:30.457000+00:00 → 2026-10-10T18:41:00.308000+00:00. Host load varied substantially; no unloaded-host or latency-saving claim is made.

Validation

Final source candidate: 6e8a0034934cc2c914562f7bade42cf1d2c49a3e, tree d4ba7ae64fff2257e6d86370c6a2877f748bc648; baseline 1d4f42e8f3852c8804da09edf2e81ed848762d78. The duration, statement and request gates pass with the attribution above. Proof is composed with explicit revision provenance; overlapping test counts are not added together.

Completed proof Result Measured wall time
Integrated runtime at c47a8541 234 tests / 19 files / 5 shards passed 931.838 s
Entry-reader repair at ebdb1bc Two kernel tests passed 315.599 s
SDK history import repair at ebdb1bc Two filtered incognito-history tests passed 408.543 s
Native fixture at cb20b6 Five tests passed 109.271 s
Canonical test-type graphs 27/27 passed: 23 at ebdb1bc, four remaining at cb20b6 Final four: 47.578 s
Core production types at cb20b6 Passed 12.885 s
Changed formatting / four-file lint at cb20b6 Passed 1.042 s / 14.839 s
Madge at c47a8541 Passed, zero cycles 62.830 s including slot wait
T1 ratchet against 1d4 at c47a8541 Passed, 707 → 707 calls 10.842 s including slot wait
Native changed-check selection All 35 accounted for: 31 passed/composed; four inherited failure classes below Per-command receipts retained
Final assertion / pairing-account guards at cc65e9a Passed 39.780 s / 39.009 s
Full build at cc65e9a Passed; nonfatal UI budget warnings below 631.039 s
SDK diff at cc65e9a Passed; semantic classification below 384.019 s
qaRuntime build at cc65e9a Passed with source maps 75.227 s
Final replica cleanup at 6e8a003 17 host/replica tests; core and affected test types; format/lint passed 360.189 / 25.970 / 20.72 / 1.94 / 49.95 s
Database dialect ratchet at 6e8a003 Passed: mechanical 3→3, design 25→25, engine-maintenance 7→7 6.87 s
Candidate startup / SQL pairs 14 complete alternating pairs; duration and statement/request gates passed 2,519.3 s harness time; aggregation/waits excluded

Unless marked otherwise, wall time excludes capacity admission wait. Runtime uses the native wrapper with --maxWorkers=1. Actual GitHub CI seconds were not measured. The integrated selection covers actor commit/rollback/unknown outcomes, authority and actual drain, scoped receipts and replicas, the former native adapter and worker incognito, and legacy sharing, cold-storage, archive, replacement, lifecycle, custody, metadata, and generation-copy owners.

The earlier integrated cleanup reuses the exact-entry helper, repairs native-fixture types, adds the relocated assertion's invariant comment, and removes the unused pending-write revision export/callback. cc65e9a changes only its corresponding assertion baseline from 2 to 1; runtime source is unchanged from cb20b6. The final assertion guard passed after that shrink. The pairing-account guard was rerun successfully because its earlier exit was not captured during the explicit pre-build drain.

Inherited findings are recorded without claiming those checks passed:

Check Candidate finding Baseline / main evidence
Knip 16 unused files, unused @solidjs/signals, unlisted @solidjs/compiler All 18 diagnostics exactly reproduce on 1d4; no diagnosed file is touched. Source blobs match inspected main 01238a50.
Environment-name budget 456 names versus 455 budget; suppression ratchet itself passes at 573 Reproduces on 1d4 and exact main 8be3518e with the unchanged native checker and an isolated index.
Test-graph boundary UI-e2e has 722 roots versus advisory 720 limit Reproduces on 1d4; main 8be3518e has identical root inventory, config, and checker.
Unused exports Two session fixture stubs, POST_ACTIVATION_INSPECTIONS_STEP, and solid-lint default Final candidate exactly matches four parent diagnostics. Diagnosed source/checker blobs match main 8be3518e.
Full core lint Unused MockConfig in untouched agents-mutate.test.ts; 16 untouched cap warnings are advisory Reproduces on 1d4. Current main uses the type and fixes this parent-only error.

Main source parity for boundary/dead-export findings is not represented as a main scanner execution. Full core lint has a terminal failure log at ebdb1bc; the final changed files subsequently pass targeted lint. Its only error is the documented parent-only import. The native continuation passes scripts lint, schema/legacy-store guards, media and sidecar boundaries, import cycles, webhook and pairing-store guards, plus the earlier formatting, dependency, documentation, export-boundary and ratchet checks. All 35 selected commands are now accounted for by exact receipts and terminal logs, including the two final passing guards. Four inherited failure classes remain within this selection, plus standalone Knip; this is complete composed coverage, not a fully green check:changed invocation.

  • Frozen dependency install passed in 15.922 s (pnpm 12.9). Static inventory is 2,435 → 2,436 total calls across 689 → 692 files; T1 is 707 → 707 calls across 247 → 249 files. Source callsites are not runtime statement savings.
  • Full build passed in 631.039 s (native phases: 8m 55.3s). Untouched UI emitted nonfatal startup-JS budget output of 368.2 KiB versus 366.1 KiB, plus a startup-CSS warning with 491 bytes of hard-ceiling headroom. No UI source is changed.
  • Worker transport imports stay independent of host configuration capture, preserving the 512 MiB worker heap cap. The final qaRuntime build passed; every completed SQL workload started successfully and completed all synthetic operations.
  • Actor instrumentation calibration passed in 0.390 s: five commands/five settlements, including stale-version and duplicate-settlement suppression. Its owner source hash is unchanged. DB/CPU/resource requests remain separate from logical requests; actor requests recognize the domain-command envelope.
  • Fourteen completed SQL pairs include 140 warmed turns per revision. Two incomplete attempts are recorded above; they are not complete-workload samples. Final measurement and SDK artifacts are pinned to cc65e9a, with final cleanup reuse explained below.
  • SDK diff at cc65e9a passed against 1d4: 148 reachable-only changes, all direct declarations identical, zero entrypoints added/removed; digest 38ea5a5ee9ff1385c6c5b38878609a9db0f23cc5e4a88dd47ef77f79d75a5ecb. Matching declaration names across the 29 starred module pairs resolves moved aliases and unchanged helpers; this is not a zero-diff claim. New actor/receipt capabilities are additive. Two actual internal nuances are documented: the incognito facts constructor gains a required callback, and the internal pending-input snapshot narrows explicit-undefined assignment under exactOptionalPropertyTypes. Their raw execution adapters are private-local-only in both revisions; neither is a released writable SDK input. No removed or narrowed released contract was identified by source/declaration inspection. This does not claim exhaustive downstream compiler compatibility.
  • The dialect checker from build: add shrink-only SQLite dialect ratchet #168382 at b453af227b4ccf53475e8cba86c57733e06a14ad ran read-only against 1d4: all three construct groups are unchanged across 89 differing production files. No ratchet exception or baseline expansion is used.
  • Published-driver × candidate update cell: attempted on final head c098dab982890cccfd6b03d7aefb1bf7010f3ef4 on AWS after Testbox expiry. Candidate package build passed. The published 2026.10.1 driver stopped before candidate installation: the fixture uses legacy agents.list, while the driver requires keyed agents.entries (exit 78; before-ready failed). Update behavior remains unverified by this cell; this is a pre-candidate fixture failure. No schema migration is introduced.
  • Three Codex P2 review rounds completed. Final backend review found no P0/P1; two P2 findings were not accepted with recorded rationale. Timestamp behavior follows canonical validated rebase; receipt observation intentionally captures commit evidence before fallible publication. These remain documented follow-ups, with no fourth review under convergence.

Limits and follow-ups

Residency is bounded to 128 sessions with an 8 MiB soft budget. One oversized working set remains until another key displaces it, avoiding perpetual read-to-command epoch loss; large sessions can exceed that byte budget. Partial S1–S3 receipts invalidate the touched session’s full hot snapshot rather than claiming complete context/custody coverage; unrelated sessions remain resident.

Observed existing startup edge: read-only discovery can see a newly created database before another worker commits its first schema transaction, returning UNAVAILABLE from sessions.create before any session mutation. The five direct failure-path modules are byte-identical on the candidate, comparison parent, and inspected main b7940621; this is source parity, not a baseline replay of the race. The failed attempt and timing evidence are retained. A subsequent successful workload does not establish a fix. This lane leaves that visible, retryable startup condition to the admission owner instead of adding another handshake.

Regression coverage includes recovery terminal delivery, age maintenance, and the released SDK entry-patch path. It does not directly exercise every maintenance flavor, every SDK export, or the tombstone-successor clone entrypoint. Existing native mutation primitives remain shared. Subsequent caller-cutover PRs own production savings.

Diff at 6e8a0034934cc2c914562f7bade42cf1d2c49a3e against 1d4f42e8f3852c8804da09edf2e81ed848762d78: production/config +7,385 / −2,275 (net +5,110); tests/support +3,339 / −4; docs +87 / −0. Production includes audit-root configuration; tests/support includes the Vitest shard helper. Much of the textual churn scopes existing writers without changing their SQL. New code supplies the shared actor contract, transaction/hydration owner, retained host/replica, existing-owner adapters, and failure/authority regressions. Shared helpers preserve one mutation implementation.

Final proof reuse: 6e8a003 only removes duplicate validation in the inactive host/replica, updates the existing replica test and documents the interface. The full build/SDK proof and frozen SQL artifacts remain pinned to cc65e9a; final source types and focused behavior passed separately. No imports, dependencies, database statements or production callers change in that cleanup. Its internal beginCommand signature is absent from the SDK report; the public operation type receives only documentation. SQL traces record zero actor commands. This is explicit prior-artifact reuse, not a claim that the final source was rebuilt and remeasured.

Native incognito ownership correction

Contract update 2: native incognito: actor declines; existing owner until P12. The inactive native adapter, registrations, exports, and adapter-only tests are removed. Acquisition returns not-actor-owned before constructing an actor or allocating a worker. Worker-backed incognito stays supported. Native incognito gets no actor savings until Phase E/P12; B3 #168539 and B4 #168592 must honor the decline.

The database-worker ratchet caught a real new main-thread transaction in the removed adapter. The transcript-state helper's broadened admission guard also obscured its migration-only scope; that original guard is restored. No ratchet baseline or limit was edited. Integration with current main passes the existing admission record to the scoped exchange and keeps descriptor record construction in the existing registry owner.

Adapter-removal candidate tree 52f360d30459afc84da503eea3a528b5e482e8d5 passed 62 focused actor/incognito/admission tests (six files; 65.83 seconds total wrapper time), type-aware oxlint, export-name collisions, production Knip, and core tsgo on AWS Crabbox run run_2ff8b4c74d49802b3b1e7264e16db51b (201.30 seconds command time). The local database-worker ratchet passed against main 756b2650a8544f5c0b852a00024e58e54c40eb46 with no baseline edit. The initial post-merge test/type failure was the receipt exchange callback signature and is fixed. Earlier measurement and validation entries above retain their original head scope. Scoped P0/P1 autoreview passed for the removal and final integration repair. Adapter-removal repair head: 8dc7b6750795aa6778d81040dd2abecdcff38ee5. New-head CI remains required before landing; no static failure is waived.

Published-driver update proof remains incomplete: the 2026.10.1 driver rejected the fixture before candidate installation (agents.list moved to keyed agents.entries, requiring Doctor). Candidate packaging passed, but that failed before-ready cell is not update-success evidence. This correction removes the inactive native adapter and does not change the update path or schema.

Final architecture guard repair

Head 17569dbde0719e4ef4bb12aef91b839f179411f6 removes the explicit Kysely helper result generic by using the existing insert/on-conflict builder for both paths. It still executes one statement and updates only updated_at on conflict. No ratchet baseline was edited. A conflict-only merge of main 83b5f5425eab6021ff03104c9de1b4826f0c3d97 preserves main's degraded-compaction persistence inside the actor-aware append path.

On candidate tree caacb70b490fa7557919835743aa26f940917a53, the complete local pnpm check:architecture (including both import-cycle checks and Kysely guardrails) and pnpm check:database-worker-ratchet --base 83b5f5425eab6021ff03104c9de1b4826f0c3d97 passed. The 12 focused actor and degraded-compaction tests passed (94.05 seconds total wrapper time), as did type-aware oxlint, Kysely guardrails, and core tsgo on Hetzner Crabbox run run_bcdf2eb316a847df8e9e562de47c38b9 (356.26 seconds command time). Scoped P0/P1 autoreview found no actionable findings. Earlier export-name collision and production Knip proof remains applicable to the adapter removal; this final repair adds no exports or dependencies. New-head static CI must pass before landing.

Final worker-fixture repair and inherited CI qualification

The Kysely repair passed both check-guards-architecture and checks-fast-baseline-ratchets on 17569dbde0719e4ef4bb12aef91b839f179411f6. No ratchet baseline was changed.

The remaining PR-caused worker-test failure was traced to the fixture's simulated macOS platform on a real Linux host. After the admission registry refactor, the retained registry and reloaded identity helper captured different birthtime policies. The fixture now loads the identity helper under the physical host platform before simulating library selection. Production identity/admission checks and all test assertions remain intact. The unchanged test failed twice before the repair and all 14 cases passed afterward on Linux; test-wrapper wall time was 52.57 seconds. Type-aware oxlint and formatting passed. Candidate tree: b79b1f21e792fc5054767229402d244564ce252a.

Other observed CI failures are independently inherited: task-suggestion layout and the panel-loading-skeleton TSX import failure match main run 38103250398 jobs 114363496384 and 114363497233; the reconstructed transcript-anchor expectation matches job 114363497110. The compaction replay expectation was reproduced directly on main 83b5f5425eab6021ff03104c9de1b4826f0c3d97 (remote run run_a875f2e5056ba3c498406efe861c3107). The named failure files are unchanged by this PR.

Final landing evidence

Final head: f0607fa83adf7a338032944be5ad94c91139495e. In CI run 38108783953, check-guards-architecture, checks-fast-baseline-ratchets, the repaired worker shard, production types, and all other static checks passed. Security checks passed. No baseline was edited.

The remaining three failed jobs are independently inherited in unchanged sources: gateway TSX parsing and task-suggestion viewport tests match main run 38103250398; the compaction replay continuation expectation also fails on main 83b5f5425eab6021ff03104c9de1b4826f0c3d97 (remote run run_a875f2e5056ba3c498406efe861c3107). The aggregate CI gate remains red for those test failures. Landing uses the explicitly authorized pre-existing-failure admin exception; this is not a claim of fully green CI. The published-driver update fixture limitation recorded above remains unchanged.

…odules

Merge current main while preserving shared physical admission, cancellation, reader validation birthtime, and live deletion authority. Split worker usage, pool construction, failure settlement, and schema owner types to keep the existing line caps.
Checkpoint the single-owner cutover, cache invalidation regressions, and request-owned read transactions. Keep explicit migration verification. Paired measurement and final validation are still in progress.
Route retained existing-state writer coverage through the host-owned worker project, preserve first-admission incompatibility refusal, and match the final deletion-authority contract. Keep the gateway test under its inherited line count by moving existing pure fixture helpers. Regenerate assertion allowances without adding production assertions.
Include the thirteen transitive admission modules required by the native wrapper import-closure proof. Carry the existing birthtime through the worker validation fixture to preserve its physical-file identity.
Merge current main and preserve its optional settlement-only receipt delivery through the extracted owner. Keep the worker refusal error with the leaf contract to stay within the existing admission line cap. End the marker-free read-only fixture transaction normally; dedicated rollback and explicit revocation coverage remains unchanged.
Preserve snapshot-local reuse without freshness queries, publish dedicated archive writes, and remove Workboard polling. Retain native authority and settlement boundaries. Checkpoint reviewed corrections and focused regression repairs; final integrated proof remains in progress.
Define inactive typed durable phases, versioned hot snapshots, complete commit receipts, pure bookkeeping reducers, and unknown-outcome fencing. Share lifetime and settlement vocabulary with the existing incognito actor without changing routing or persistence.
RomneyDa pushed a commit that referenced this pull request Oct 14, 2026
… writer (#170077)

Backport note: production change only; the main regression test depends on the
session actor owner (#168602), which is not on this release line.

(cherry picked from commit 6b2bfd1)
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Oct 22, 2026
… writer (openclaw#170077)

Backport note: production change only; the main regression test depends on the
session actor owner (openclaw#168602), which is not on this release line.

(cherry picked from commit 6b2bfd1)
(cherry picked from commit 26c1509)
Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant