Skip to content

perf(sessions): batch input acceptance and run adoption - #168607

Merged
steipete merged 116 commits into
mainfrom
dbasync/actorb2
Oct 11, 2026
Merged

steipete merged 116 commits into
mainfrom
dbasync/actorb2

Conversation

@steipete

@steipete steipete commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Chat acceptance and run adoption repeatedly fetch the same session state and issue separate durable writes before acknowledging input or starting a run.

User Impact

No intended user-visible change. Accepted input remains durable before the started acknowledgement; retries adopt canonical input rather than append it twice. Restart recovery still verifies its source/run, and a handled hook cannot restart the model or broader tool surface. No schema, retention, permission, stored-byte, or operator migration change is intended.

Why This Change Was Made

This is the B2 cutover, originally stacked on B1 and now targeting main after the actor core landed. The latest conflict-only main integration is pinned to 5d6cf7424de268b0354e3b1c4bfae81e20bdd99c. Gateway recorder acceptance uses acceptInput; run adoption and before/after-hook checkpoints use adoptRun. Input and lifecycle adoption share a transaction where no external effect separates them. MAIN reads the actor's published replica, while cold history, canonical retry bodies, Goals, and complex source predicates retain their bounded readers. A post-restart-abort readiness check retains its terminal reader because public actor disclosure is already revoked.

The existing admission owns actor retention and settlement. Following the landed actor core, native-incognito acquisition declines until P12; those sessions retain their original memory owner and compatibility paths, never a replacement file or durable database. Durable and worker-backed actor calls do not run the legacy writer as well. The superseded restart-admission operation is deleted. Exact committed receipts are captured before fallible publication, preserving committed-error custody and synchronous SDK completion semantics.

Compromises and size

The implementation reuses the existing admission, writer, idempotency keys, and commit receipts. It does not add a retry journal, fencing token, nonce protocol, or a second settlement owner. Integration removed the adoption preflight/retry loop, the separate accepted-only replica reader, and the legacy outer FIFO reservation around actor staging (which reproduced a self-deadlock). Unknown worker outcomes retain the existing owner's contract; this cutover does not blindly replay them or create new reconciliation machinery. Optional cleanup warnings retain their existing best-effort behavior.

The remaining three actor reads per warmed turn are an explicit limit, not a hidden saving. Canonical retry payloads are read when needed rather than duplicating all transcript bodies in memory. Hook side-effect ambiguity across a process crash remains governed by the existing durable checkpoints; this PR does not promise exactly-once external hook execution.

Small additive contract changes carry an input-only transcript turn without a pending row, allow adoptRun to commit that turn with its lifecycle, and distinguish a lost response from a failed publication on an already-captured commit. These preserve existing recorder and SDK results; they are not new writers or retry protocols.

Diff against the integrated main 5d6cf7424de2: production/tooling +1,670 / −457, tests/support +1,322 / −450, docs +17 / −1. Growth is principally the compatibility-preserving actor binding/commit bridge and regressions at recovery and Gateway boundaries. The repair removes the obsolete native-incognito adapter and its adapter-specific tests instead of rebuilding an owner main deliberately deferred. No line-cap or lint suppression was loosened. Existing publication, source-redelivery, and recorder-persistence units were extracted to cohesive siblings, and two existing ACK tests moved to the preparation-ACK suite to satisfy the mandatory static gate. Actor acquisition stays lazy, and its factory-owned recorder binding lives with the actor rather than making shared admission-receipt contracts depend on actor code. An unused actor accessor and its redundant test assertions were removed.

Evidence

SQL and requests

Three alternating pairs: B1 cc65e9aacc50 → B2 4f076e633cb8. Each cell is B1 → B2, median [min–max]. Warmed summary uses each run’s ten-turn mean; individual warmed phases are also shown. Counts include every thread and helper process, not just the Gateway thread. The final B1 integration after these measurements removes duplicate MAIN replica validation; it does not change SQL or phase commands. Measurement pins are not relabeled as final-head measurements.

Metric, warmed per turn B1 B2
Native statements, all threads 657.1 [656.7–659.1] 594.8 [593–599.3]
Native statements, MAIN 8.6 [8.6–8.6] 8.6 [8.6–9.5]
Logical requests, all threads 164.7 [164.6–165.2] 162.4 [161.9–163.3]
Logical requests, MAIN 161.7 [161.6–162.2] 159.4 [158.9–160.3]
SQLite-broker requests 59.9 [59.7–60.6] 62.5 [61.9–63.7]
Actor phase commands 0 [0–0] 3 [3–3]
Actor reads 0 [0–0] 3 [3–3]
Committed transactions 65.1 [65–65.2] 63.3 [63.2–63.4]
Every phase: statements, requests, actor commands, transactions, and transport

Native statements and logical requests

Phase Statements, all Statements, MAIN Requests, all Requests, MAIN
01.boot 2150 [2150–2150] → 2150 [2149–2150] 1925 [1925–1925] → 1925 [1925–1925] 59 [59–59] → 59 [59–59] 59 [59–59] → 59 [59–59]
01.connect 1004 [994–1011] → 994 [974–1043] 94 [94–100] → 100 [94–100] 48 [44–49] → 43 [38–44] 46 [42–47] → 41 [36–42]
02.first-turn 1901 [1885–1941] → 1787 [1749–1885] 83 [83–83] → 83 [74–89] 325 [320–335] → 322 [311–333] 318 [313–328] → 315 [304–326]
03.turn-01 606 [604–630] → 559 [541–625] 2 [2–2] → 2 [2–11] 152 [150–159] → 155 [149–168] 149 [147–156] → 152 [146–165]
03.turn-02 602 [602–602] → 537 [537–538] 2 [2–2] → 2 [2–2] 150 [150–150] → 147 [147–148] 147 [147–147] → 144 [144–145]
03.turn-03 778 [773–783] → 713 [713–713] 24 [24–24] → 24 [24–24] 198 [197–200] → 195 [195–195] 195 [194–197] → 192 [192–192]
03.turn-04 609 [605–610] → 546 [539–546] 2 [2–2] → 2 [2–2] 153 [151–153] → 150 [149–150] 150 [148–150] → 147 [146–147]
03.turn-05 597 [597–597] → 532 [525–532] 2 [2–2] → 2 [2–2] 148 [148–149] → 145 [143–145] 145 [145–146] → 142 [140–142]
03.turn-06 784 [784–786] → 719 [717–720] 24 [24–24] → 24 [24–24] 199 [199–199] → 196 [195–196] 196 [196–196] → 193 [192–193]
03.turn-07 608 [606–608] → 543 [542–545] 2 [2–2] → 2 [2–2] 151 [151–151] → 148 [148–149] 148 [148–148] → 145 [145–146]
03.turn-08 603 [597–603] → 538 [538–539] 2 [2–2] → 2 [2–2] 150 [148–150] → 147 [147–147] 147 [145–147] → 144 [144–144]
03.turn-09 785 [785–785] → 720 [713–726] 24 [24–24] → 24 [24–24] 197 [197–198] → 194 [192–196] 194 [194–195] → 191 [189–193]
03.turn-10 600 [600–600] → 540 [535–540] 2 [2–2] → 2 [2–2] 149 [149–149] → 147 [146–147] 146 [146–146] → 144 [143–144]
03.warmed-per-turn 657.1 [656.7–659.1] → 594.8 [593–599.3] 8.6 [8.6–8.6] → 8.6 [8.6–9.5] 164.7 [164.6–165.2] → 162.4 [161.9–163.3] 161.7 [161.6–162.2] → 159.4 [158.9–160.3]
04.second-session 2571 [2568–2579] → 2459 [2452–2459] 91 [91–91] → 91 [91–91] 588 [588–590] → 588 [587–589] 579 [579–581] → 579 [578–580]
05.control-plane 18 [18–21] → 18 [18–20] 0 [0–0] → 0 [0–0] 5 [5–6] → 5 [5–6] 5 [5–6] → 5 [5–6]
06.cron 985 [985–997] → 997 [983–997] 41 [41–48] → 48 [41–48] 202 [202–205] → 205 [203–205] 199 [199–202] → 202 [200–202]
07.compaction 267 [267–267] → 267 [267–267] 24 [24–24] → 24 [24–24] 71 [71–71] → 71 [71–71] 69 [69–69] → 69 [69–69]
08.shutdown 118 [118–118] → 118 [114–118] 62 [62–62] → 62 [62–62] 15 [15–16] → 15 [14–16] 15 [15–16] → 15 [14–16]
all.workload 15604 [15585–15623] → 14783 [14726–14797] 2412 [2406–2413] → 2418 [2413–2419] 2964 [2961–2968] → 2932 [2929–2934] 2911 [2908–2915] → 2879 [2876–2881]

Actor execution and committed transactions

Phase Phase commands, all Reads, all Committed transactions, all Committed transactions, MAIN DB broker requests, all
01.boot 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 35 [35–35] → 35 [35–35] 12 [12–12] → 12 [12–12] 21 [21–21] → 21 [21–21]
01.connect 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 33 [31–34] → 31 [30–31] 4 [4–4] → 4 [4–4] 24 [20–25] → 20 [20–20]
02.first-turn 0 [0–0] → 3 [3–3] 0 [0–0] → 3 [3–3] 123 [122–128] → 123 [121–125] 3 [3–3] → 3 [3–3] 159 [153–168] → 160 [148–166]
03.turn-01 0 [0–0] → 3 [3–3] 0 [0–0] → 3 [3–3] 61 [61–63] → 60 [59–64] 0 [0–0] → 0 [0–0] 50 [48–57] → 58 [52–70]
03.turn-02 0 [0–0] → 3 [3–3] 0 [0–0] → 3 [3–3] 62 [62–62] → 60 [60–60] 0 [0–0] → 0 [0–0] 48 [48–48] → 50 [50–50]
03.turn-03 0 [0–0] → 3 [3–3] 0 [0–0] → 3 [3–3] 74 [73–74] → 72 [72–72] 1 [1–1] → 1 [1–1] 86 [86–87] → 88 [88–88]
03.turn-04 0 [0–0] → 3 [3–3] 0 [0–0] → 3 [3–3] 62 [62–62] → 60 [59–60] 0 [0–0] → 0 [0–0] 49 [48–49] → 51 [51–51]
03.turn-05 0 [0–0] → 3 [3–3] 0 [0–0] → 3 [3–3] 61 [61–61] → 59 [58–59] 0 [0–0] → 0 [0–0] 48 [48–48] → 50 [50–50]
03.turn-06 0 [0–0] → 3 [3–3] 0 [0–0] → 3 [3–3] 73 [73–73] → 71 [71–71] 1 [1–1] → 1 [1–1] 88 [88–88] → 90 [90–90]
03.turn-07 0 [0–0] → 3 [3–3] 0 [0–0] → 3 [3–3] 62 [62–62] → 60 [60–60] 0 [0–0] → 0 [0–0] 48 [48–48] → 50 [50–50]
03.turn-08 0 [0–0] → 3 [3–3] 0 [0–0] → 3 [3–3] 62 [61–62] → 60 [60–60] 0 [0–0] → 0 [0–0] 48 [48–48] → 50 [50–50]
03.turn-09 0 [0–0] → 3 [3–3] 0 [0–0] → 3 [3–3] 73 [73–73] → 71 [70–72] 1 [1–1] → 1 [1–1] 86 [86–86] → 88 [88–88]
03.turn-10 0 [0–0] → 3 [3–3] 0 [0–0] → 3 [3–3] 61 [61–61] → 60 [59–60] 0 [0–0] → 0 [0–0] 48 [48–48] → 50 [50–50]
03.warmed-per-turn 0 [0–0] → 3 [3–3] 0 [0–0] → 3 [3–3] 65.1 [65–65.2] → 63.3 [63.2–63.4] 0.3 [0.3–0.3] → 0.3 [0.3–0.3] 59.9 [59.7–60.6] → 62.5 [61.9–63.7]
04.second-session 0 [0–0] → 6 [6–6] 0 [0–0] → 6 [6–6] 250 [250–251] → 249 [248–249] 3 [3–3] → 3 [3–3] 241 [241–242] → 245 [245–245]
05.control-plane 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 3 [3–3] → 3 [3–3] 0 [0–0] → 0 [0–0] 1 [1–1] → 1 [1–1]
06.cron 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 82 [82–82] → 82 [82–83] 1 [1–1] → 1 [1–1] 111 [111–113] → 113 [111–113]
07.compaction 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 15 [15–15] → 15 [15–15] 1 [1–1] → 1 [1–1] 19 [19–19] → 19 [19–19]
08.shutdown 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 9 [9–9] → 9 [9–9] 4 [4–4] → 4 [4–4] 8 [8–8] → 8 [7–8]
all.workload 0 [0–0] → 39 [39–39] 0 [0–0] → 39 [39–39] 1201 [1201–1205] → 1180 [1179–1180] 31 [31–31] → 31 [31–31] 1186 [1184–1187] → 1212 [1209–1212]

Transport observations, counted separately

Phase Generic send/receive, all Generic reply, all Generic send, MAIN Native commit send Native settlement send
01.boot 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 6 [6–6] → 6 [6–6] 18 [18–18] → 18 [18–18]
01.connect 6 [6–6] → 6 [6–6] 6 [6–6] → 6 [6–6] 0 [0–0] → 0 [0–0] 8 [8–9] → 8 [8–8] 24 [20–26] → 20 [20–20]
02.first-turn 23 [23–23] → 23 [23–23] 21 [21–21] → 21 [21–21] 2 [2–2] → 2 [2–2] 39 [39–40] → 39 [38–40] 157 [151–167] → 158 [147–165]
03.turn-01 9 [9–9] → 9 [9–9] 9 [9–9] → 9 [9–9] 0 [0–0] → 0 [0–0] 21 [21–22] → 22 [21–23] 50 [48–58] → 59 [52–70]
03.turn-02 9 [9–9] → 9 [9–9] 9 [9–9] → 9 [9–9] 0 [0–0] → 0 [0–0] 21 [21–21] → 21 [21–21] 48 [48–48] → 50 [50–50]
03.turn-03 9 [9–9] → 9 [9–9] 9 [9–9] → 9 [9–9] 0 [0–0] → 0 [0–0] 25 [25–25] → 25 [25–25] 86 [86–87] → 88 [88–88]
03.turn-04 9 [9–9] → 9 [9–9] 9 [9–9] → 9 [9–9] 0 [0–0] → 0 [0–0] 21 [21–21] → 21 [21–21] 49 [48–49] → 51 [51–51]
03.turn-05 9 [9–9] → 9 [9–9] 9 [9–9] → 9 [9–9] 0 [0–0] → 0 [0–0] 21 [21–21] → 21 [21–21] 48 [48–48] → 50 [50–50]
03.turn-06 9 [9–9] → 9 [9–9] 9 [9–9] → 9 [9–9] 0 [0–0] → 0 [0–0] 25 [25–25] → 25 [25–25] 88 [88–88] → 90 [90–90]
03.turn-07 9 [9–9] → 9 [9–9] 9 [9–9] → 9 [9–9] 0 [0–0] → 0 [0–0] 21 [21–21] → 21 [21–21] 48 [48–48] → 50 [50–50]
03.turn-08 9 [9–9] → 9 [9–9] 9 [9–9] → 9 [9–9] 0 [0–0] → 0 [0–0] 21 [21–21] → 21 [21–21] 48 [48–48] → 50 [50–50]
03.turn-09 9 [9–9] → 9 [9–9] 9 [9–9] → 9 [9–9] 0 [0–0] → 0 [0–0] 25 [25–25] → 25 [25–25] 86 [86–86] → 88 [88–88]
03.turn-10 9 [9–9] → 9 [9–9] 9 [9–9] → 9 [9–9] 0 [0–0] → 0 [0–0] 21 [21–21] → 21 [21–21] 48 [48–48] → 50 [50–50]
03.warmed-per-turn 9 [9–9] → 9 [9–9] 9 [9–9] → 9 [9–9] 0 [0–0] → 0 [0–0] 22.2 [22.2–22.3] → 22.3 [22.2–22.4] 59.9 [59.7–60.7] → 62.6 [61.9–63.7]
04.second-session 28 [28–28] → 28 [28–28] 27 [27–27] → 27 [27–27] 1 [1–1] → 1 [1–1] 90 [90–90] → 90 [90–90] 241 [241–242] → 245 [245–245]
05.control-plane 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 1 [1–1] → 1 [1–1] 1 [1–1] → 1 [1–1]
06.cron 9 [9–9] → 9 [9–9] 9 [9–9] → 9 [9–9] 0 [0–0] → 0 [0–0] 33 [33–33] → 33 [33–33] 111 [111–113] → 113 [111–113]
07.compaction 8 [8–8] → 8 [8–8] 6 [6–6] → 6 [6–6] 2 [2–2] → 2 [2–2] 3 [3–3] → 3 [3–3] 19 [19–19] → 19 [19–19]
08.shutdown 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 0 [0–0] → 0 [0–0] 1 [1–1] → 1 [1–1] 6 [6–6] → 6 [5–6]
all.workload 164 [164–164] → 164 [164–164] 159 [159–159] → 159 [159–159] 5 [5–5] → 5 [5–5] 404 [404–404] → 404 [404–404] 1180 [1178–1181] → 1206 [1203–1206]

Actor phase commands execute in the worker: MAIN command-execution count is 0 in both revisions in every phase. These are execution counters, not a claim that MAIN submits no actor work. Actor reads are tracked separately from phase commands.

Generic send and receive observations match; reply observations are separate. Generic MAIN receive/reply are zero throughout. Native commit-send = commit-receive; sends are worker-side and receives MAIN-side. Settlement send/receive totals match over each full workload; candidate run 2 crosses the connect/first-turn boundary by one receive (connect 20 sends/19 receives, first turn 158/159). Other phases match. These are transport observations, not unique-transfer or exactly-once delivery proof.

Maximum per-phase candidate/baseline median duration ratio: 1.041 (<1.5). No duration-skew waiver.

The shared SQL harness is unchanged; invocation/census adaptation lives only in the task's proof directory. Alternating baseline/candidate pairs run on one AWS Crabbox lease after Testbox fallback, with isolated synthetic state. Native statements, logical requests, broker requests, actor commands/reads, transport observations, and explicit committed transactions are counted independently across all threads and MAIN. Warmed summary is the median of each run's ten-turn mean; individual warmed phase medians are also checked and reported.

Attribution and retained costs

The direct warmed-path change removes 88 statements and adds 24, a net −64 statements/turn. The observed median is −62.3; the remaining difference is background scheduling variation, not claimed as actor savings. No main-to-worker move is counted as a saving.

Removed/added work, warmed turn Δ statements Δ logical requests
Legacy session.turn.commit −41 −1
Legacy session.turn.prepare −13 −1
Folded entry lifecycle patch −12 −1
Legacy pending-input mutation −11 −1
Membership facts reread −6 −1
Pending-input reread −5 −1
acceptInput (two phases) +16 +2
adoptRun +4 +1
Actor reads +3 +3
Remaining exact entry read +1 +1
Removed session-target task requests 0 −2
Removed resource closes 0 −2

Broker requests therefore increase: the direct broker delta is +2/turn, while removed task requests and resource closes reduce overall logical requests. Observed request variation comes from existing domain/background work. The branch does not reach the campaign's under-500 warmed-statement aim; it makes a verified incremental reduction.

Cron statements rise 985 → 997 (+1.22%), within the non-turn 2% tolerance, with zero actor commands; existing database.domain work accounts for the timing shift. The first individual warmed phase has 152 → 155 logical requests, while statements decrease 606 → 559.

The required extra entire-workload pair ran on then-current candidate a713ec374710 against the same B1 base, on the same AWS lease (run run_56d2618c678a46187e913525a52c18b5). Both builds and both workloads passed. This is supplemental one-pair evidence, not a replacement three-run median series:

Window All-thread statements B1 → B2 MAIN statements B1 → B2 All-thread requests B1 → B2 MAIN requests B1 → B2
Warmed per turn 658.3 → 591.2 8.6 → 8.6 165.1 → 161.5 162.1 → 158.5
First turn 1,765 → 1,861 89 → 83 323 → 331 316 → 324
Startup + connect + first 5,001 → 5,001 2,114 → 2,108 425 → 432 416 → 423
Startup through shutdown 15,553 → 14,766 2,425 → 2,419 2,962 → 2,929 2,909 → 2,876

The supplemental first turn rises by 96 statements; whole-workload totals fall by 787 statements and 33 requests. This is redistribution, not an unmeasured attribution waiver. Every memory-domain subtype has identical workload requests/statements in B1 and B2: cache.prune 8/8, cache.read 8/8, cache.stage.start 8/0, cache.write 8/98, database.publish 1/59, match 14/70, participant 13/71, schema.admit 1/130, session.current 8/8, source.chunks 7/7, source.hash 8/8, source.refresh 1/5, source.replace 7/158, source.state 8/8, stage.append 15/22, stage.start 7/0, sweep 1/4. The original early-warm request rise reverses to 158 → 149 in this pair. Maximum phase duration ratio is 1.074. Actor diagnostics are 78 begins/78 settlements, no pending/duplicate/mismatched commands. The two uncorrelated boot-only requests (workerEnvironments.snapshot, userProfiles.catalog) are identical in both revisions; they are disclosed, not assumed settled. Native transfer send/receive totals match over each workload.

Correctness and verification

Final conflict-only integration

Head 6b8cb0751123ba6d5e6a8f187bc66c5ce5e48e02 integrates main 5d6cf7424de268b0354e3b1c4bfae81e20bdd99c for the actual conflict with the reply-admission simplification. Exact tested tree: 8e3ecba3d5c1782ea50d1d5973e9e4e2427f45cf. It retains main's direct reader and reduced bookkeeping checks, plus B2's actor retention, target handoff, and actor-before-claim settlement. The redundant reader wrapper stays deleted; no fencing or database work was added.

Conflict-owner proof on the task-owned Hetzner lease passed 98 tests across six admission/registry/authority files (121.132 s including wrapper setup), type-aware oxlint over all 60 changed TypeScript files with zero warnings/errors (39.474 s), and export-name collisions (94.857 s). Formatting and git diff --check passed. Prior changed-test and mock-consumer proof below is reused for unaffected inputs; no plugin SDK or extension runtime/API path changed.

Knip's script scan passes. Production/full-tree scans have 29 identical findings on candidate and pinned main across 13 unchanged paths: captureAgentRunTerminalWriteContext, loadSubagentMaintenanceCandidatesInDatabase, and the MCP UI component exports. The independent main scan ran after a frozen in-tree install and reproduced the exact sorted rule/file/export list (97.662 s; candidate 96.274 s). There are no B2-added findings. A first baseline attempt lacked UI workspace dependencies, discarded its findings, and is not counted as proof. These inherited static failures are disclosed, not represented as a passing global Knip scan.

Native preparation completed on the prior head, but native merge refused twice before dispatch because of the recorded CI failures. No merge request or uncertain merge outcome exists. This conflict-only successor uses the coordinator-authorized exact-head REST squash fallback under RELAXED LANDING v4; it does not relabel the earlier review/CI artifacts as current-head passes. No additional SQL measurement is required for this no-SQL ordering/conflict repair.

Exact-head CI follow-up

Prior-head CI run 38124772342 (536d9d4fa54c) has two independently confirmed inherited failures on main d7eb93a787251dbcb6871a7919ad85c5521b2c81: the responses/in-history prompt-cache cases fail with the identical SqliteTranscriptMutationConflictError stack in main job 114418744592, and stopped-file inspection fails at the identical invalid-payload assertion in main job 114418744591. B2 changes neither those tests nor the implicated SessionManager append and repository-file modules. These failures are not represented as passing proof.

The same PR run also failed chat.send persists optional connection identity per turn: Alice/Bob attribution remained intact, but the third unattributed input was absent. This is not labeled inherited: main job 114418744767 passed it. Bounded exact-head investigation on Hetzner could not reproduce it: the isolated diagnostic observed all three started ACKs and no Gateway warnings/errors; the complete instrumented file passed 77 tests (195.385 s); then instrumentation was removed, the original tree 7bb01c861566a01f64d6a4bd79a9d57c8f13b255 verified, and all four original CI-group files passed 118 tests (200.516 s). The hosted failure remains unexplained; shared-worker timing or cross-suite state is possible, but no root cause or fix is claimed. The original failed CI remains red. Under the coordinator's RELAXED LANDING v4 and investigated-test-failure policy, this bounded uncertainty is recorded rather than adding speculative synchronization or rerunning hosted CI for green. No source change followed this investigation, and the mandatory static proof remains valid.

The diagnostic Testbox stayed queued without a runner for 15 minutes and was stopped. AWS quota fallback supplied only a 2-GiB instance, also stopped before proof. One Hetzner lease supplied all diagnostic runs; it is stopped at handoff. No additional SQL measurement was run because the callback repair introduces no statements, requests, or transactions.

The final P2 review concern is a follow-up under RELAXED LANDING v4: unbound callers still await accepted asynchronous completions before returning, but those completions can outlive the physical writer reservation and overlap a successor. The existing FIFO turn/reset tests pass; the review establishes no demonstrated data loss, security hole, or money risk. This internal interleaving is an explicitly accepted edge case for this landing, not a claimed fixed behavior. No extra fencing or synchronization was added.

CI run 38118090958 exposed one additional runtime contract and several fixtures that bypassed the new admission owner. Pending-input staging again performs its initial aborted/incognito checks synchronously before returning the actor-acquisition promise; the existing Gateway-close regression remains unchanged. This adds no statements or requests.

The runner fixtures now obtain their actual admitted operation through onReplyOperationOwned, retaining manual completion only where the test owns it, and the shared fixture preserves upstream cancellation through the real lightweight abort resolver. The cohort wrapper now forwards the owner's live fileIdentity getter instead of snapshotting its pre-preparation undefined value. Released-admission tests expect the explicit refusal while still asserting no successor transcript write. The transcript-alias regression uses the supported main alias: the old fixture fabricated a live entry under a missing arbitrary key, which the production key-based loader cannot return (session-utils-store.ts and session-utils-store-selection.ts). No production target/authority guard was weakened.

Two existing recorder assertions acquired SAFETY comments documenting their actual invariants after extraction into a new file. The old file's assertion allowance shrinks exactly from four to two; no baseline or limit was raised. The combined actor-worker test file also exceeded the static line cap after the later main integration, so its unchanged database fixture moved to a test-support sibling; test bodies and hoisted mocks remain unchanged. The observer inventory failure is independently present on main d4e9d09e9422 in run 38115181393: the same test expects one inventory and sees zero. This is not used to excuse the PR's cohort failures, whose fixture is fixed here.

One repair-only Codex P0/P1 review of the follow-up was scoped-clean. While this proof was being prepared, landed actor phases created four real conflicts. Conflict-only integration with main 90e1bc0a0a0f1fe1e931287aaba48453cfc8e620 retains main's delivery/bookkeeping reducers, B2's acceptance/adoption cases, and both regression sets. All obsolete patch-operation cases retired by either cutover remain removed. Main's no-op comparison preserves the empty-patch statement saving. No new fencing or database calls were introduced by this resolution.

Prior prospective landing tree 7bb01c861566a01f64d6a4bd79a9d57c8f13b255 passed 345 distinct tests across 16 files, combining the Gateway and runner-sibling proof with the actor and memory-delivery proof. Gateway: 148 tests, 87.20 s; actor/compound/patch/cohort: 80 tests, 80.19 s; memory-delivery: 66 tests, 59.69 s; 51 other runner tests passed in the earlier combined runner run. The exact pending-input callback regression passed in 1.219 s. The initial memory-deferral assertion observed the idle helper while real foreground admission still held priority; moving the same assertion after foreground clearance and before delivery settlement proves the intended barrier without changing production behavior.

On that prior tree, type-aware changed-file oxlint passed with zero warnings/errors (36.01 s). The unchanged export graph passed export-name collision checking (65.27 s) and all three Knip export scans (100.20 s); the shrink-only assertion ratchet passed (31.42 s). Formatting and diff checks passed. All changed tests retain the prior 578-test proof for unaffected inputs; affected conflict owners and newly corrected fixtures were rerun above. No full final-head hosted CI pass or fresh SQL census is claimed.

Follow-up proof used one Hetzner ccx33 lease after Testbox stayed queued without a runner and AWS quota fallback returned a 2-GiB t3.small. Both rejected leases were stopped. The raw Hetzner image needed the repository's Node 24.21.0 and pnpm 12.9.0 toolchain installed before testing; the proof verified the exact package-manager pin and complete merged Git tree. The first two runtime failures were corrected expectations: supported aliases are canonicalized before the mocked loader, and a previously committed pre-ACK receipt can be replayed after revocation without a new successor write. No authority check was weakened, and no static limit was raised.

Landing repair: committed callback ordering

The exact-head CI failure at session-compound-worker.test.ts:600 was reproduced locally: the committed-message callback observed pending input as queued, where the existing contract requires consumed. The batched turn had committed correctly, but onAcknowledged published custody in its finally block, after invoking public committed-message callbacks. The repair publishes the committed custody postimage first, then installs transcript sequences and invokes those callbacks. Index reconciliation still runs in finally. No SQL, worker request, transaction, fencing token, or new retry mechanism was added, so the coordinator-requested repair does not require remeasurement; the tables above remain explicitly pinned historical evidence.

The existing regression is retained unchanged. It verifies queued during commit admission, consumed for committed observers, zero MAIN SQL, and the request budget. The local negative control took 256.30 s in Vitest / 316.68 s including cold worker compilation and wrapper setup. A first integration attempt instead exposed a missing pending-owner construction; the resolved merge now constructs that owner from the actual committed stagedInput postimage before publication, matching main.

The conflict integration follows merged actor core #168602: native-incognito actor acquisition declines until P12. Existing native transcript, pending-input, and recovery ownership remain in use; the obsolete native adapter and its adapter-specific tests were removed (1,064 lines), rather than adding a replacement owner. One fresh repair-only Codex P0/P1 review was scoped-clean. Subsequent changes correct a union-shaped acquisition argument, extract unchanged helper bodies for the static gate, and relocate documentation to avoid the concurrent Phase C insertion.

The repaired branch tree b3f08afde3d4d06152fb40aa4ea1bbdbd081dbda, combined with main 33827c2fcc426bc5c3113592cc41be10fe303bdc, produced clean prospective landing tree 52b52f61c356758184abb23ca727488390a5eb86. Remote repair proof on AWS Crabbox passed 578 tests in 27 files: Gateway 124 (232.39 s), infra/recovery/recorder 164 (125.86 s), actor/compound-worker 63 (43.89 s), and runner E2E 227 (147.31 s). Total wrapper time including clean worker/declaration builds was 821.34 s. The unchanged compound-worker regression passed in 1.162 s. Type-aware oxlint passed all changed TypeScript files with zero warnings/errors (37.44 s); local 53-file formatting and diff checks passed. These are merged-tree runtime results, not a claim of a fresh SQL census or full hosted CI pass.

Mandatory static gates also passed on that same prospective landing tree: export-name collisions (29.25 s), and Knip script, production, and full-tree export scans with zero entries (75.54 s total). No plugin-SDK or extension runtime/API surface path was changed by the repair; the prior SDK diff remains applicable. All changed test files and the affected mock-consumer tests are included in the 578-test run.

Testbox acquisition/sync did not reach a test run, so the authorized AWS fallback was used. Initial AWS build caught the acquisition type error; initial lint caught four line caps, all fixed. Unrelated export-collision/Knip diagnostics in the older integration parent were fixed by main's 3f08ea94a337 and d4e9d09e9422; both scans pass independently on main 33827c2f. A scratch-quota failure interrupted the first prospective-tree dependency install before tests; redundant task-owned dependency/build copies were removed and the matched frozen install then passed. None of these failed setup attempts is counted as runtime proof.

Remote evidence: the three alternating pairs ran in the measurement run. Focused/static/SDK checks ran on AWS Crabbox lease cbx_e814e91655e1 in the final gates run. The 27-graph typecheck, first targeted completion, Gateway completion, and final custody/type completion used the same lease.

Removed statement class Regression protecting the replacement
Turn preparation / commit Native recorder direct/destructured methods retain custody before ACK and adopt one canonical input; worker publication failure retains the same committed receipt
Lifecycle entry patch Worker adoption refuses a mismatched lifecycle and revoked transaction/commit authority; recovery hook checkpoint tests exercise the real controller
Pending-input read / mutation Queued ACK test observes durable custody; failed-custody retry keeps the same request identity without acknowledging lost input; final-commit refusal rolls back the pending row
Membership / session facts reread Worker/native tests apply native entry, sharing, participant and transcript writes, then verify resident replica invalidation without replacing the owner
Target-task / resource-close requests Persistent and incognito reply-admission tests retain one actor and hold successor admission until accepted work drains
  • At 0f45c9fd725e, runtime build and 506 selected tests passed: 124 infra/recovery (57.98 s), 39 actor/store (17.84 s), one runner context (1.12 s), 227 runner E2E (156.60 s), and 115 Gateway acceptance/creation (174.02 s). At 2b9fb2094228, 62 native/incognito tests passed (16.66 s Vitest / 41.21 s wrapper), and core production types passed. These are prior-head results, not a claim of full latest-head CI.
  • Regressions cover durable input before ACK, idempotent retry adoption, recovery source/run/lifecycle refusal, hook checkpoints, native-incognito original-owner identity, FIFO progress, committed publication failure, final pending-custody rollback, and accepted-work drain. The final pending-custody regression failed before its fix with a queued row left behind, then passed with neither pending row nor transcript committed (21.56 s single-case Vitest / 58.97 s including wrapper setup).
  • Three fresh Codex P2 review rounds completed. Round two found an unacknowledged hook checkpoint in the staged version; it was fixed. Round three was scoped-clean for the six-file custody diff. Later integrations and the lazy-import repair are not covered by that exact review scope. No fourth round under the campaign's review-convergence rule.
  • At 09c3e2b0149f, 42 focused tests in five files passed, using node scripts/run-vitest.mjs … --maxWorkers=1: 29 infra cases (38.49 s), 13 replica/custody cases (20.68 s), 83.59 s total wrapper time. Core production types passed (76 s), formatting passed (1 s), Madge found zero runtime cycles (16 s), and T1 had no call-count growth against B1 6e8a0034934c (26 s). Knip exactly matches the baseline's 18 diagnostics; dead exports have only the four inherited entries below. Lint has only the four disclosed line caps.
  • All 27 canonical test-type graphs have passing results. The initial full invocation ran 536 s and passed 14 graphs before finding optional recorder calls in a test. Targeted completions ran 278 s, 77 s, and 85 s, preserving passed graphs while fixing the remaining test-only optional calls and staged-snapshot discrimination. The final three graphs passed at def5d6d30baf; no production changes followed 09c3e2b0149f. Follow-up runtime proof passed 27 recorder tests at 955ce1a44183 (18.68 s Vitest / 24.51 s wrapper), 38 Gateway pending-input tests at 7f87bdf310b4 (104.51 s / 107.67 s), and 16 native/custody tests at final def5d6d30baf (25.85 s wrapper). Final four-file formatting passed; lint reports only the already-disclosed Gateway test line cap, 1,038/1,000 lines, in 27 s. An earlier invocation's flag placement was rejected before any graph ran. These are pinned, composited results, not a claim of one full final-head CI run.
  • Runtime builds and both full workloads passed on a713ec374710 (baseline build 63.3 s, candidate 82.6 s). The subsequent B1 merge only simplifies replica validation; the final focused run above covers that change. No final-head full build or CI run is claimed.
  • Final SDK comparison 6e8a0034934c → 09c3e2b0149f passed in 581 s, digest 3bdfe2fa: 148 reachable affected exports, seven declaration groups, zero entrypoint additions/removals and zero direct exported-signature changes. Full declaration inspection found actor completion keys/payload results, optional committed-receipt callbacks, internal reply/admission actor bindings, and removal of the superseded restart-admission variant. Existing two-argument transcript callbacks remain valid with the optional third argument. Actor-contract narrowing is against the unreleased B1 contract; the removed internal variant was introduced October 8, after published stable 2026.9.9 and beta 2026.10.1-beta.2. No removed or narrowed released writable SDK input was identified; this is not a zero-diff claim.
  • Published-driver × candidate update cell: not required under the coordinator's relaxed landing scope: this cutover changes no update, Doctor, migration/schema, plugin-loading, or service-lifecycle behavior. No new update success is claimed.

Known inherited check failures and proof limits

The native changed-check plan was executed against B1 at 3f348fd8a8d2: 33 commands, plus the separately disclosed line-growth advisory. The passing checks include SQLite-worker T1 (no call-count growth), assertion SAFETY, timeout/mock ratchets, boundaries, imports/Madge, schema/version, database-first legacy-store, and pairing guards. Integration lint/test-type errors found there were fixed; final successor results are reported above rather than calling that old run green.

The remaining inherited diagnostics are pinned to the stacked B1 base, not mislabeled as current-main failures:

  • Environment count 456/455, reached through the max-lines suppression check. It reproduced on B1 and main 8be3518e4787; main later fixed the owner-approved budget in 434fc09bf24f.
  • UI-e2e graph 722/720 roots. B1 and the earlier main had identical inventories; current main splits the graph in 471035c7b7c8. Canonical test-type execution is separate from this inventory-budget failure.
  • Knip's 18 inherited diagnostics: 16 dormant/deployed files, one unused Solid dependency, and one compiler dependency classification. The B1 baseline has the exact set. Main later corrected the entries/classification in 61621f7b5941 and 7ad362fec9fb.
  • Four inherited dead exports: solid-lint default, two session-channel fixture helpers, and POST_ACTIVATION_INSPECTIONS_STEP. Main already makes the latter three private; solid-lint and its checker remain byte-identical. B2's extra unused actor accessor was removed rather than allowlisted.
  • Four historical changed-file line caps were resolved during landing by extracting existing cohesive helpers and moving two ACK tests to their existing suite owner. No suppressions, budgets, or checker rules were relaxed.

The parent-only unused MockConfig lint warning was fixed on main and is not claimed as a current-main failure. The latest landing repair integrates main at 5d6cf7424de268b0354e3b1c4bfae81e20bdd99c for the actual conflict; older B1 diagnostics above are historical and do not substitute for the mandatory merged-candidate static gates.

No local Docker, live operator Gateway, or real user data was used. Test wall times above are observed proof-host times; GitHub CI seconds and a separate single-worker cost run were not measured. The PR targets main and is being landed under the coordinator's RELAXED LANDING v4 order after the callback regression repair and mandatory static gates.

…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.
@steipete
steipete deleted the dbasync/actorb2 branch October 11, 2026 10:08
@steipete

Copy link
Copy Markdown
Contributor Author

Merged as 929bfc04f52953173748ac6c04881754b0b7514e from exact head 6b8cb0751123ba6d5e6a8f187bc66c5ce5e48e02. Verified the commit is on origin/main and its tree exactly matches the merge of the submitted head with its actual main parent.

The regression was publication ordering, not a failed database commit: committed-message callbacks ran before pending-input custody was published. The owner now publishes the consumed postimage first. The existing regression passes unchanged. No SQL, worker request, transaction, or fencing was added.

The final conflict-only integration passed 98 admission/registry/authority tests, changed-file type-aware lint, and export-name collision checks. Knip's 29 findings match the independently tested main baseline exactly across 13 unchanged files. Earlier actor/compound-worker and changed-test proof remains recorded in the body. Exact-head security-sensitive and dependency review statuses passed before merging.

Used the coordinator-authorized RELAXED LANDING v4 head-pinned REST squash after two native pre-dispatch refusals. Full current-head CI was not claimed green; inherited failures, the unexplained optional-identity hosted failure and bounded passing replays, and the P2 completion-ordering follow-up remain explicitly documented.

Pinned historical warmed medians: 657.1 → 594.8 statements and 164.7 → 162.4 logical requests per turn. Broker requests increase 59.9 → 62.5. No remeasurement was needed for this no-SQL repair. The remote proof lease is stopped and the campaign slot released.

steipete added a commit that referenced this pull request Oct 11, 2026
…169107)

* fix(sessions): rebase stale input actor admissions

Rebase explicitly refused actor versions once for input staging, transcript acceptance, and run adoption. Retain the original lifecycle and pending-input predicates, prepared bytes, live authority checks, and native commit custody.

Fix the regression from #168607 when deferred participant recording invalidates the captured actor version before admission. Concurrent owner regressions fail on the original production code and prove exactly-once input persistence plus lifecycle and authority refusals.

* fix(sessions): retain writer admission across actor rebases

Keep durable actor snapshot selection, command settlement, and the single
stale-version rebase in one physical writer admission. Concurrent metadata
writers can no longer invalidate the returned postimage ahead of its retry.
Use the same owner for transcript appends and terminal accounting while
preserving input predicates, prepared bytes, authority, and native receipts.

Fix Gateway initial inputs that fail persistence and dispatch, and terminal
delivery or usage failures during concurrent session traffic. Regressions
exercise real participant writes, actor transfers, and Gateway dispatch.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
)

Batch durable session input acceptance and run adoption through the session actor while preserving input custody before ACK and idempotent recovery.

Publish committed pending-input custody before message callbacks so observers see consumed rather than queued. Preserve synchronous initial staging rejection and native-incognito ownership.

Focused actor, compound-worker, Gateway and runner proof plus mandatory static gates passed. The callback repair adds no database work. Historical warmed medians decreased from 657.1 to 594.8 SQLite statements and from 164.7 to 162.4 logical requests per turn; broker requests increased from 59.9 to 62.5.

Landed under the coordinator-approved relaxed policy. The PR records inherited CI failures, the unexplained optional-identity CI failure with passing bounded diagnostic replays, and the P2 unbound completion-ordering follow-up.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…penclaw#169107)

* fix(sessions): rebase stale input actor admissions

Rebase explicitly refused actor versions once for input staging, transcript acceptance, and run adoption. Retain the original lifecycle and pending-input predicates, prepared bytes, live authority checks, and native commit custody.

Fix the regression from openclaw#168607 when deferred participant recording invalidates the captured actor version before admission. Concurrent owner regressions fail on the original production code and prove exactly-once input persistence plus lifecycle and authority refusals.

* fix(sessions): retain writer admission across actor rebases

Keep durable actor snapshot selection, command settlement, and the single
stale-version rebase in one physical writer admission. Concurrent metadata
writers can no longer invalidate the returned postimage ahead of its retry.
Use the same owner for transcript appends and terminal accounting while
preserving input predicates, prepared bytes, authority, and native receipts.

Fix Gateway initial inputs that fail persistence and dispatch, and terminal
delivery or usage failures during concurrent session traffic. Regressions
exercise real participant writes, actor transfers, and Gateway dispatch.
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 19, 2026
First-parent upstream f4f4868..069a5b8 (11 commits: openclaw#168607 batch
input acceptance and run adoption, 7158f2b, openclaw#168815, openclaw#168882 update
and service lifecycle, ec5fe47, openclaw#169036 test batch d049, 4db95aa,
cedb310 web-search split, openclaw#169056, openclaw#169061, and openclaw#169064 release
settled writes behind read cursors).

Conflicts:
- user-turn-transcript.ts: upstream moved persistUserTurnTranscript into
  user-turn-transcript.persistence.ts. Our earlier line-cap move
  (user-turn-transcript.persist.ts) was a pure move, so it is retired in
  favour of upstream's module. Our session-delivery ack replacement is
  kept and now also refuses once upstream's committedInput is set (the
  same state upstream's hasPersisted counts).
- agent-runner-execute.context-read.test.ts: both import additions kept.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 19, 2026
…mission

Upstream openclaw#168607 (absorbed at step 50) has reply restart recovery acquire
the session actor through the reply operation's database claim. Our
work-span suites replaced loadSessionEntryForAdmission with a fake,
actor-less claim, so every store-backed turn now throws "Reply operation
has no session actor admission" (10 cases across the two files).

Only store-backed turns reach that loader, and each of them already
upserts its real row, so drop the override and admit through the real
accessor, as upstream's own runner suites do. The other mocked reads are
unchanged.

RED at 7baa17d (sweep s54 b-005: 6 + 4 failures), 16/16 GREEN after.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 19, 2026
…recorder

Upstream openclaw#168607 (absorbed at step 50) grew user-turn-transcript.ts to
692 lines; with our session-delivery ack replacement inline it reached
709 counted lines, over the 700-line cap (type-aware lint max-lines and
the line-cap ratchet both red since step 50).

Move the ack-id set, its normalization and the metadata rewrite into
user-turn-transcript.delivery-acks.ts. The recorder keeps the decision of
when replacement is still allowed (including upstream's committedInput
state), so behaviour is unchanged: recorder, persistence, admission and
continuation durability suites 107/107 green.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 19, 2026
…ion (#1475 D1)

Carry adaptation for 454e86e on the 19fe879 absorb. Upstream
openclaw#168607 (929bfc0) made the actor's final commit admission carry the
kernel's commit publication (`turn ?? commitPublication`), which
session-turn's authority uses to recheck pending-input custody at commit
(operation.assertCandidate). The D1 carry was written against 855242b,
where that admission had no publication, so its framed commit envelope
omits it.

Pin, through the real host actor, worker kernel and native admission: an
adopted turn discloses exactly one "session-turn" publication to its commit
authority whether or not its outcome is framed. On this commit the oversized
case sees none ("expected [] to deeply equal [ 'session-turn' ]"); the
inline case passes.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 19, 2026
…omes (#1475 D1)

Carry adaptation for 454e86e on the 19fe879 absorb. The framed
commit admission now carries `publication: turn ?? commitPublication`
inside its outcome envelope, as the inline admission does since upstream
openclaw#168607 and as upstream's own openclaw#169843 (ca0a172) shapes it. The host
already hands `outcome.publication` to the caller's authority, so an
oversized session's turn keeps its commit-stage custody recheck.

No D2 code is involved; upstream openclaw#169064 is untouched.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 19, 2026
…d commit (#1475 D1)

Carry adaptation for 6d79105 on the 19fe879 absorb. That commit
restored upstream openclaw#169843's commit-stage revocation case but expected
"SQLite transaction admission was refused", the generic error 855242b
surfaced. Upstream openclaw#168607 (929bfc0, in the absorb) now settles a refused
admission as rolled-back with the admission's recorded failure, which is the
authority's own error. Restore upstream's exact expectation,
"synthetic live authority revocation" (ca0a172's session-actor.test.ts).

The invariant is unchanged and still asserted: the refused commit grant
rolls the transfer back and leaves the entry untouched, framed or inline.
At 06386fa the inline variant already reports this message; at
7bd11d9 both variants failed only on the stale message text.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
RomneyDa added a commit that referenced this pull request Oct 26, 2026
…iter reservation

Control UI follow-ups in an existing session stage pending input with the
request's session authority. Stable held a staging-wide agent-database write
admission across store preparation, the snapshot read, and authority refresh.
Authority refresh reads every candidate store for the session. When the agent
also has rows in a second database (for example an absolute per-agent
`session.store` outside the state dir, or the cwd-relative store from #181660),
that read spans two databases. The reentry guard then refuses it with
"Session read batch cannot reenter an active SQLite writer admission", so
every follow-up fails.

Authorized, non-incognito staging now runs without the outer reservation. The
snapshot read and the staging mutation each take their own write admission.
Incognito and unauthorized staging keep the existing reservation.

This accepts per-message ordering between concurrent follow-ups to the same
session in place of one staging-wide reservation. Each row is still validated
inside its transaction: a changed snapshot is rejected ("Pending input changed
before staging committed"), session authority is rechecked at transaction and
commit, and idempotency keys prevent double staging. Main instead replaced the
reservation with the session input actor's FIFO (#168607), which is too large
to backport.

Refs #182744, #181660.
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…iter reservation

Control UI follow-ups in an existing session stage pending input with the
request's session authority. Stable held a staging-wide agent-database write
admission across store preparation, the snapshot read, and authority refresh.
Authority refresh reads every candidate store for the session. When the agent
also has rows in a second database (for example an absolute per-agent
`session.store` outside the state dir, or the cwd-relative store from #181660),
that read spans two databases. The reentry guard then refuses it with
"Session read batch cannot reenter an active SQLite writer admission", so
every follow-up fails.

Authorized, non-incognito staging now runs without the outer reservation. The
snapshot read and the staging mutation each take their own write admission.
Incognito and unauthorized staging keep the existing reservation.

This accepts per-message ordering between concurrent follow-ups to the same
session in place of one staging-wide reservation. Each row is still validated
inside its transaction: a changed snapshot is rejected ("Pending input changed
before staging committed"), session authority is rechecked at transaction and
commit, and idempotency keys prevent double staging. Main instead replaced the
reservation with the session input actor's FIFO (#168607), which is too large
to backport.

Refs #182744, #181660.

(cherry picked from commit d99892d)

Release adaptation: Use the release session input actor rather than removing its legacy reservation for other callers. Port the cross-store Gateway regression against the current admission fixture.

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

docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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. 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