Skip to content

perf(agents): run per-turn session-entry patches through the worker - #164514

Merged
steipete merged 5 commits into
mainfrom
dbasync/agenttx
Oct 4, 2026
Merged

steipete merged 5 commits into
mainfrom
dbasync/agenttx

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Warmed Gateway chat turns still execute native session-entry patch transactions on the main thread for writer claims, model-switch bookkeeping, and final-delivery custody.

Why This Change Was Made

Explicitly select the existing worker patch path at the audited callers. The host prepares each reduction once; the existing agent executor rereads and compares authoritative rows in its synchronous transaction, publishes acknowledged commit facts inside the physical writer FIFO, and preserves unknown outcomes without replay. Both live-model-switch clear paths use the same owner.

The general patch default is unchanged. Opaque SDK updaters retain their nested-callback contract, and incognito and maintenance scopes retain their native owner. The writer claim's initial admission read remains separate migration debt.

Scope exclusions: lifecycle start/end persistence remains native while #142236 changes timeout history; cron preparation remains with #161105 and its separate authority-design work. The related umbrella #162433 remains separate from this bounded caller change. After this cutover, the only observed warmed native session-entry patch caller is persistGatewaySessionLifecycleEvent, twice per turn. Follow-up: migrate it after the timeout-history fix lands. Cold session creation and subagent paths remain separately scoped debt.

User Impact

The paired workload reduces native patch transactions 8 → 2 per warmed turn, target-site statements 48 → 12, and overall main-thread statements 648.5 → 493.4 per turn. This preserves schemas, retention, durability, public SDK signatures, permissions, and update behavior. No database opener, admission, transport, or lifecycle owner changes; the published-driver update cell is not applicable to this caller-only cutover. No new OPENCLAW_* environment names.

Production changes: +19 / -9 / net +10 lines across five files. Documentation explains the remaining native paths. Host-broker tests use the repository's existing forked test group.

Evidence

Paired agent transaction measurement

Baseline: task-start origin/main at f7d9a968f278aab97f470c387fc22e81fad012b8. Candidate measurement used staged tree d2480806a0c287595e44315ce38253ff6536bae8, now verified identical to commit 87a2537b5772d7810248b6a46f28521f7d816d3c. The measurement preceded that commit; its exact source tree was checked.

Same checkout, Node 26.10.0, SQLite 3.53.4, macOS arm64; gateway-only qaRuntime builds with source maps. Both runs used identical harness/observer bytes, 100-frame stack depth, fresh isolated state, the loopback mock provider, and the original workload. Prepares and failed native executions are excluded.

Phase All main SQL before → after Target :62 before → after Helper-stack SQL before → after Native patch transactions before → after
Boot until ready 2,967 → 2,962 0 → 0 0 → 0 0 → 0
Connect / settling 52 → 47 0 → 0 0 → 0 0 → 0
New session + first chat 1,917 → 1,767 60 → 24 202 → 86 10 → 4
Ten warmed turns 6,485 → 4,934 480 → 120 1,590 → 420 80 → 20
Second session + spawn + child 1,856 → 1,628 150 → 74 537 → 283 25 → 12
List / history / Inbox / dismiss 0 → 44 0 → 0 0 → 0 0 → 0
Cron run 530 → 465 78 → 72 270 → 247 13 → 12
Manual compaction 208 → 349 0 → 0 0 → 0 0 → 0
Graceful shutdown 467 → 328 0 → 0 0 → 0 0 → 0
Total 14,482 → 12,524 768 → 290 2,599 → 1,036 128 → 48
Warmed turn All main SQL before → after Target :62 before → after Helper-stack SQL before → after
1 637 → 493 48 → 12 159 → 42
2 637 → 495 48 → 12 159 → 42
3 637 → 493 48 → 12 159 → 42
4 637 → 493 48 → 12 159 → 42
5 637 → 493 48 → 12 159 → 42
6 646 → 495 48 → 12 159 → 42
7 640 → 493 48 → 12 159 → 42
8 667 → 493 48 → 12 159 → 42
9 710 → 493 48 → 12 159 → 42
10 637 → 493 48 → 12 159 → 42

Warmed mean: 648.5 → 493.4 main-thread statements/turn, 155.1 fewer (23.9%). Median: 637 → 493. Every warmed turn has 8 → 2 native patch transactions, 48 → 12 statements at openclaw-agent-db-transaction.ts:62, 64 → 16 across all helper source lines, and 159 → 42 statements with the helper anywhere in their stack.

The only remaining warmed native patch caller is the excluded persistGatewaySessionLifecycleEvent, twice per turn. Writer claim, final preparation, queue custody, delivered settlement, and final clear have direct preparation stacks. The queued exact live-switch patch loses its upstream async stack here; the original artifact stack and focused negative control identify that caller. Queued work is not attributed from a stale preceding stack.

Both runs completed 13 top-level turns, the child turn, a successful Cron run, committed compaction, and clean shutdown [0, null]. The Inbox was empty, so dismissal was a no-op. All resolved on-disk database paths were inside each synthetic fixture; null/in-memory locations retain their original unknown labels.

Phase counts include concurrent maintenance, so unrelated SQL can shift between phases. Timings are not a latency benchmark. The historical 546/turn artifact used a different baseline/runtime and is not this pair’s comparator.

Excluded failed BEGIN admission attempts were all SQLITE_BUSY: baseline 2 main-thread connection attempts and 3 worker shutdown attempts; candidate 2 worker shutdown attempts. All workload receipts succeeded. Both builds emitted the existing worker-deploy sourcemap warning; target helper/lifecycle source frames match their source.

Baseline negative control used the corrected existing fork inventory plus candidate live-model-switch.worker.test.ts on original production. Both cases failed on native session SQL / BEGIN / COMMIT as expected: 186.689s wall, 84.07s Vitest.

Baseline gateway setup/build: 612.506s wall including isolated install. Candidate gateway rebuild: 303.362s. Workload: 156.718s before and 107.035s after. No full build, broad gate, or SDK run is claimed by this measurement.

Static inventory: T1 1,198 → 1,198 (316 files); pnpm check:database-worker-ratchet --base f7d9a968f278aab97f470c387fc22e81fad012b8 passed. The shared native kernel remains for excluded and compatibility callers, so static site counts do not express this caller cutover. Madge reports 0 cycles (158.74 s).

All Vitest commands used --maxWorkers=1.

Proof Result Command wall time
Live-model worker boundary 2 passed 290.275 s
Delivery completion 10 passed 174.677 s
Pending-final cleanup 3 passed 105.328 s
Accounting + delivery integration 97 + 9 passed in the initial three-file batch; its writer observer exposed cold lease setup, corrected below 514.80 s for the batch
Corrected writer claim + patch owner + model selection 4 + 12 + 33 passed 385.42 s
Real Gateway close-prelude, existing scheduled-plugin case 1 passed 234.26 s
Runtime build graph + get-reply imports + eager import closure 28 passed 159.62 s

These are loaded-host macOS command times, including transformation, worker preparation, and verification. The long close test reuses the existing real Gateway fixture to prove server shutdown ordering; a helper-only test cannot establish that order. CI timings are pending when this PR opens.

Landing validation: the coordinator assigned full build, changed-file checks, and the released SDK comparison to the lander. Final receipts below satisfy those preconditions. The original source-mapped qaRuntime measurement builds are separate evidence.

The existing patch-owner regressions cover FIFO, publication ordering, authority revocation, opaque SDK nested admission, and unknown outcomes without replay. The conflict regression explicitly checks error-class identity. The real Gateway close regression queues accepted final-delivery persistence behind a preceding worker patch, begins the close prelude, rejects newly scheduled work, and verifies committed state before database teardown.

Validation corrections: the first new observer test ran in Vitest's thread pool, where the product intentionally retains native execution; its host-broker routing was corrected without weakening the observer. The custom-root delivery fixture had reused a live executor under a different shared-state namespace; the corrected fixture creates its custom store under the intended root from the outset. The writer observer also now warms unchanged cold admission before observing the moved claim transaction; SQL assertions remain intact. Initial setup's final build stamp refused concurrent source edits and is not counted as a successful build.

Fresh Codex autoreview against the pinned merge base completed scoped-clean through P2, exit 0. Formatting and git diff --check passed.

Landing review: compatibility

The lander checked the latest local release tags (v2026.9.8, v2026.9.7, v2026.9.6), the v2026.9.8 session accessor and plugin runtime contracts, current src/plugin-sdk/session-store-runtime.ts, and src/plugins/runtime/runtime-agent.ts. This PR changes no exported signature, sync/async behavior, callback shape, or export inventory. Released opaque updater callbacks remain on their existing native path; no compatibility record or new type test is required for this caller-only selection. The released SDK diff completed locally on final candidate 36667aaf51b0f897b4e94dafe02184fee6e77e3f against both published beta/latest predecessors, v2026.9.8. Its acknowledgement digest is e9f58e0a. The cumulative release-to-head report is not empty: 8 removed entrypoints, 1 added entrypoint, and 2,307 affected export pairs; this is a cumulative report, not an assertion of zero release-to-head changes. These are inherited main changes: the PR delta from integrated main bf761b0fcafcb0e014dc8e481bdd10bf34b274f0 leaves package/SDK manifests, src/plugin-sdk, src/plugins/runtime, SDK documentation, accessor types and patch owner byte-identical, and leaves all six touched internal function signatures unchanged. No PR-introduced released contract change was found.

ClawSweeper completed its fresh review of b13daf4 at 21:20 UTC with no remaining actionable code findings and confirmed that the fixture correction resolves its prior finding. Its data-model heuristic names session-bootstrap.ts, but inspection shows only the existing patch API selection changes: the stored activeWriterRunId field, reducers, schema, serialization, migrations, and retention are unchanged. No migration or upgrade behavior changes. The documented full build, changed checks, and SDK report remain landing gates.

Landing CI repair

Pushed fixture correction b13daf453d09cf42f09a5881fb33b99e1dbe4480: the producer-recovery tests created sessions with the ambient shared-state owner, then recovered queue deliveries with an explicit custom root. The worker path correctly rejected that mismatch. Session creation and readback now use the same queue state environment; production code, durable payloads, and all assertions are unchanged.

Attribution used Node 24.21.0 and node scripts/run-vitest.mjs src/infra/outbound/delivery-queue.producer-recovery.test.ts --maxWorkers=1: merge base f7d9a968f278aab97f470c387fc22e81fad012b8 passed all ten tests in 5/5 runs, while original head 87a2537b5772d7810248b6a46f28521f7d816d3c reproduced the same five ownership failures in 5/5 runs. The correction passes all ten tests (147.61s wall, 115.73s Vitest). P2 autoreview of the correction completed scoped-clean; formatting and diff sanity passed. These loaded-host timings are not a latency benchmark.

The original UI failure is independently present in scheduled main CI: board-mcp-app.e2e.test.ts:527 reports the same 602-pixel bottom/body gap. Its test and rendering inputs are identical between that main checkout and the original PR CI main parent, and this PR changes no UI files. The layout change entered through main after this branch forked. Five full-file UI runs passed on each pre-regression branch head and fork base (50 cases); the actual CI merge reproduced the same 602-pixel gap with four sibling cases passing. Relevant UI/runtime/style/test/helper source is identical in the fixed-head CI merge. The comparison used matched Node 24.21.0 and Chromium 153, taking 864 seconds overall. No UI source or assertion was changed.

Previous-head b13daf CI completed with every selected job passing except the independently attributed UI job and its aggregate gate; no jobs were cancelled. The fixture suite passes all ten cases in its hosted shard: 17.34 seconds per-file shard, including 16.28 seconds Vitest.

The required CLOSE-PRELUDE case, joins scheduled plugin work before closing stores while retaining a deleted agent store, passes in hosted job 111294423398, taking 1.978 seconds. The complete server-close.agent-databases.test.ts file passes 5/5 without a test-name filter (49.50 seconds shard / 48.14 seconds Vitest). CI tested merge 0be01bdcb3d47c74ffbb08879637bace00745ea2, with ordered parents 10955cf09b4e43133eb23d6d8a25e7f880846a2b and the fixed PR head.

Final candidate gates

Candidate 9e07b0e3e9ea69cb342434e5f526b6eec2716ec1 includes fixture extraction 7ea7c5161e11aee85c6fb6355feaf26936da99b7 and a conflict-free merge of main 711e57e41b37fd3667cace1fc82572687903da39, bringing in the released SDK comparison fix from #164466. The accounting test had grown from 1,000 to 1,016 counted lines; its existing builders and diagnostic helper now live in a test-support module. Suite ownership, mocks, cleanup timing, every case and every assertion are preserved. All 97 accounting cases pass (303.36s command wall, 129.84s Vitest, including 133.18s cold worker preparation). The integrated line-cap ratchet passes. P2 autoreview of the complete integrated PR delta is scoped-clean.

Full build passed on b13daf in Testbox; its combined build/check command then exposed the accounting line-cap failure fixed above. On the final candidate, the released SDK comparison is complete, changed-file checks are still running, and a fresh full build is required. The first final-candidate Testbox lease failed during warmup with WaitDelay expired before I/O complete before executing the payload (commandMs 0); it is completed. The first AWS source freeze stopped before provisioning because a temporary lint-limit file changed while the changed checks were running. No candidate failure was observed. Changed checks subsequently completed successfully on 9e07.

Final candidate 36667aaf51b0f897b4e94dafe02184fee6e77e3f merges main bf761b0fcafcb0e014dc8e481bdd10bf34b274f0 to incorporate the exact inherited UI fixture repair, #164535 (3d66dd51b57d8e16acf481d6425c7b95ad3d264b). The previous inherited-failure exception is therefore not requested. Main's same-file overlap is the type-only LiveSessionModelSelection extraction from #164286; it merged cleanly. The normalized PR patch is identical before/after integration, and fresh P2 autoreview is scoped-clean. Main integration is a merge commit, not a rebase.

The final-head released SDK comparison is complete (digest above). Final CI run 37161276479 completed successfully with all 70 jobs terminal and no failures. It tested merge b3fc95e37b3e2e15a4c59cd2a6ee06147990567c, parents df24e6de4b2976e2f5c043eb3db5d41d0b8a2f1f and 36667aaf51b0f897b4e94dafe02184fee6e77e3f.

Final producer recovery passes 10/10 in job 111315210643, 18.85s per-file shard / 17.69s Vitest. Final CLOSE-PRELUDE passes in job 111315210675, exact required case 2.123s; complete file 5/5, 51.33s shard / 49.92s Vitest. No test-name filter, rerun, or assertion change was used.

Trusted ClawSweeper workflow 37161303607 completed successfully and reviewed this exact head at 23:21:47.773 UTC, with no code or security findings. Its manual validation reminder is handled by these final receipts. Its serialized-state heuristic is not a data-model change: session-bootstrap only selects the existing patch API; the reducer, stored activeWriterRunId field, serialization, schemas and migrations are unchanged. No migration or upgrade compatibility change is introduced.

Changed-file verification is complete. The complete node scripts/check-changed.mjs --base 711e57e41b37fd3667cace1fc82572687903da39 pass succeeded on 9e07; final-head hosted CI passed the selected format, core/scripts lint, core and all 27 core-test type graphs, conflict/Doctor registries, ratchets, config docs, duplicate coverage, coercion, package-patch/temp-output/webhook/pairing/cycle guards, native schema, runtime topology, deprecated API, wrapper-shadowing, and dead-export checks. An owner/source audit identified seven remaining contracts outside hosted CI; all seven passed locally on 36667: check:changelog-attributions, lint:extensions:no-guarded-wildcard-reexports, lint:extensions:no-plugin-sdk-wildcard-reexports, deps:pins:check, plugins:boundary-report:ci, check:media-download-helpers, and check:runtime-sidecar-loaders. No new environment names are introduced.

Final full build passed on exact head 36667aaf51b0f897b4e94dafe02184fee6e77e3f, using Hetzner standard lease cbx_82647f9c1508, run run_237cd51c828a912dbd031d71bc8060f4, Node 24.21.0 and pinned pnpm 12.5.1. The clean PR checkout verified its exact SHA before install and pnpm build. Build phases took 11m 58.5s; bootstrap/install/build command 12m 21.693s, exit 0. This includes AI/package/core/plugin declarations, all six unified declaration groups, SDK entrypoint declarations and export checks, plugin assets, runtime metadata, Control UI and startup metadata. Testbox warmup failure, AWS provisioning failure, and the first raw Hetzner image missing pnpm were infrastructure/setup failures before build execution; the successful run bootstrapped the repository toolchain. The lease release was accepted and cleanup is being verified. All required validation is complete; no inherited-CI admin exception or CI rerun is needed.

Route audited writer claims, live-model-switch bookkeeping, and pending-final
preparation, settlement, and cleanup through the existing agent executor.
Preserve native opaque SDK callbacks and the excluded lifecycle and cron paths.

The paired isolated Gateway workload reduces native patch transactions from
8 to 2 per warmed turn and target-site SQL from 48 to 12. Overall main-thread
SQL averages 648.5 to 493.4 statements per warmed turn. Lifecycle persistence
remains follow-up work after #142236; cron preparation remains with #161105.

Local caller, settlement, error identity, import-boundary, cycle, and database
ratchet proof passes. Full build, changed checks, and released SDK diff remain
explicit merge preconditions under the maintainer's validation instruction.
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

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

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: M labels Oct 3, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 3, 2026, 7:21 PM ET / 23:21 UTC (Revision 6).

ClawSweeper review

What this changes

This PR moves writer claims, model-switch bookkeeping, and final-reply persistence onto the existing database worker and adds boundary regressions.

Merge readiness

⛔ Blocked before merge - 2 items remain

The change remains useful, with sufficient runtime evidence and no actionable introduced defect found. Explicitly deferred final-candidate validation remains incomplete.

Likely related people: steipete (medium-confidence routing from prior merged session-worker and model-switch work).

Priority: P2
Reviewed head: 36667aaf51b0f897b4e94dafe02184fee6e77e3f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful patch with strong runtime measurements and meaningful boundary coverage; final validation receipts remain outstanding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The paired isolated Gateway workload exercises the changed session patch callers through real SQLite owners and records reduced host SQL with successful turns and clean shutdown. Boundary regressions supplement this evidence; later integration preserves the production cutover. Stored formats, reducers, schemas, and migration contracts are unchanged.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The paired isolated Gateway workload exercises the changed session patch callers through real SQLite owners and records reduced host SQL with successful turns and clean shutdown. Boundary regressions supplement this evidence; later integration preserves the production cutover. Stored formats, reducers, schemas, and migration contracts are unchanged.
Evidence reviewed 8 items Pinned introduced production change: The merge-base-to-head production hunks select workerGuard at the existing patch callers; updateSessionEntry already delegates directly to patchSessionEntryCore. Reducers, stored fields, and public signatures are preserved.
Existing worker preserves mutation ownership: Worker selection retains native paths for unsupported scopes. Preparation runs once; the worker applies the existing snapshot comparison and mutation owner, validates admission through transaction and commit grants, publishes acknowledged results within writer custody, and reports uncertain outcomes without replay.
Real Gateway performance evidence: The complete PR body matches captured SHA-256 20827a29f7b4489ecf043f959bc4b3e2e5c1bfb1c79265a5904e22e45311c41a. It records paired isolated macOS Gateway runs with the real SQLite owners and a loopback provider: ten warmed turns reduced native patch transactions from 80 to 20 and main-thread SQL from 6,485 to 4,934, with successful workload receipts and clean shutdown. These are SQL measurements, not a latency benchmark.
Findings None None.
Security None None.

How this fits together

Agent turns and reply delivery update session records in per-agent SQLite databases. The existing worker performs those updates and publishes committed results back to the Gateway before subsequent work proceeds.

flowchart TD
  A[Agent turn] --> C[Session patch preparation]
  B[Reply delivery outcome] --> C
  C --> D[Existing database worker]
  D --> E[Validate current rows]
  E --> F[Commit session update]
  F --> G[Publish acknowledged result]
  G --> H[Continue turn or delivery]
Loading

Before merge

  • Complete next step (P2) - Record passing final-candidate pnpm build and released Plugin SDK comparison receipts, retaining the applicable completed changed-file checks.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +10, Tests +275, Docs +10. Total +295 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 5 19 9 +10
Tests 10 626 351 +275
Docs 1 10 0 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 655 360 +295

Review metrics

Metric Value Why it matters
Observed warmed-turn SQL Native patch transactions 8 → 2; main-thread statements 648.5 → 493.4 per turn The paired Gateway workload measures the intended reduction without claiming a latency improvement.

Stored data model

Persistent data-model change detected: serialized state: src/agents/embedded-agent-runner/run/session-bootstrap.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Land the bounded caller cutover while preserving the existing worker owner, native compatibility paths, and separately scoped lifecycle work.

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

Not applicable as a correctness bug reproduction; the paired Gateway workload establishes the existing main-thread SQL cost and its reduction.

Is this the best way to solve the issue?

Yes: selecting the existing worker path at audited internal callers is a narrow solution that preserves public callbacks and storage semantics.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded runtime performance improvement with measured benefit and no demonstrated urgent user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The paired isolated Gateway workload exercises the changed session patch callers through real SQLite owners and records reduced host SQL with successful turns and clean shutdown. Boundary regressions supplement this evidence; later integration preserves the production cutover. Stored formats, reducers, schemas, and migration contracts are unchanged.
  • proof: sufficient: Contributor real behavior proof is sufficient. The paired isolated Gateway workload exercises the changed session patch callers through real SQLite owners and records reduced host SQL with successful turns and clean shutdown. Boundary regressions supplement this evidence; later integration preserves the production cutover. Stored formats, reducers, schemas, and migration contracts are unchanged.

Evidence

What I checked:

  • Pinned introduced production change: The merge-base-to-head production hunks select workerGuard at the existing patch callers; updateSessionEntry already delegates directly to patchSessionEntryCore. Reducers, stored fields, and public signatures are preserved. (src/agents/embedded-agent-runner/run/session-bootstrap.ts:426, 36667aaf51b0)
  • Existing worker preserves mutation ownership: Worker selection retains native paths for unsupported scopes. Preparation runs once; the worker applies the existing snapshot comparison and mutation owner, validates admission through transaction and commit grants, publishes acknowledged results within writer custody, and reports uncertain outcomes without replay. (src/config/sessions/session-accessor.sqlite-entry.ts:499, 36667aaf51b0)
  • Real Gateway performance evidence: The complete PR body matches captured SHA-256 20827a29f7b4489ecf043f959bc4b3e2e5c1bfb1c79265a5904e22e45311c41a. It records paired isolated macOS Gateway runs with the real SQLite owners and a loopback provider: ten warmed turns reduced native patch transactions from 80 to 20 and main-thread SQL from 6,485 to 4,934, with successful workload receipts and clean shutdown. These are SQL measurements, not a latency benchmark. (87a2537b5772)
  • Shutdown boundary regression: The existing real Gateway fixture now holds an earlier worker patch, queues accepted final-delivery settlement, starts shutdown, rejects newly scheduled work, and verifies committed state before database teardown. The body records the complete five-case file passing in prior-head hosted job https://github.com/openclaw/openclaw/actions/runs/37154236800/job/111294423398; the close-prelude case took 1.978 seconds. (src/gateway/server-close.agent-databases.test.ts:261, 36667aaf51b0)
  • Re-review continuity: The GitHub comparison from the previous reviewed head to this head shows only inherited type extraction in live-model-switch.ts among the five production files. The previous producer-recovery fixture concern remains corrected through consistent queue-state environments; the accounting extraction preserves suite-owned operation registration and cleanup. (src/agents/live-model-switch.ts:16, 36667aaf51b0)
  • Final validation remains explicitly deferred: The hash-matched body records passing changed-file checks and released SDK comparison on 9e07, but says a fresh full build and released SDK comparison are still running for 36667 and claims no final-build pass. This preserves the concrete validation follow-up from the previous completed review. (36667aaf51b0)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record completion of the explicitly deferred final-candidate full build and released Plugin SDK comparison, retaining applicable completed changed-file checks.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (5 earlier review cycles)
  • reviewed 2026-10-03T20:25:37.323Z sha 87a2537 :: blocked before merge. :: none
  • reviewed 2026-10-03T20:46:08.432Z sha 87a2537 :: blocked before merge. :: [P2] [P2] Bind producer-recovery fixtures to their queue state root
  • reviewed 2026-10-03T21:20:00.186Z sha b13daf4 :: blocked before merge. :: none
  • reviewed 2026-10-03T21:54:59.969Z sha b13daf4 :: blocked before merge. :: none
  • reviewed 2026-10-03T23:12:46.592Z sha 9e07b0e :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 3, 2026
Create and read producer-recovery sessions under the same explicit shared-state root as their delivery queue. Worker-backed pending-final settlement correctly rejects the previous fixture ownership mismatch. Preserve durable payloads and all existing assertions.
@steipete

steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 3, 2026
Keep the accounting persistence suite within its line cap by moving fixture construction into a dedicated test-support module. Preserve suite-owned state, immediate operation registration, and every test case and assertion.
@steipete

steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 892f6cc into main Oct 4, 2026
141 of 142 checks passed
@steipete
steipete deleted the dbasync/agenttx branch October 4, 2026 00:05
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

* perf(agents): run per-turn session-entry patches through the worker

Route audited writer claims, live-model-switch bookkeeping, and pending-final
preparation, settlement, and cleanup through the existing agent executor.
Preserve native opaque SDK callbacks and the excluded lifecycle and cron paths.

The paired isolated Gateway workload reduces native patch transactions from
8 to 2 per warmed turn and target-site SQL from 48 to 12. Overall main-thread
SQL averages 648.5 to 493.4 statements per warmed turn. Lifecycle persistence
remains follow-up work after openclaw#142236; cron preparation remains with openclaw#161105.

Local caller, settlement, error identity, import-boundary, cycle, and database
ratchet proof passes. Full build, changed checks, and released SDK diff remain
explicit merge preconditions under the maintainer's validation instruction.

* test(outbound): align recovery fixtures with queue state

Create and read producer-recovery sessions under the same explicit shared-state root as their delivery queue. Worker-backed pending-final settlement correctly rejects the previous fixture ownership mismatch. Preserve durable payloads and all existing assertions.

* test(agents): extract accounting persistence fixture

Keep the accounting persistence suite within its line cap by moving fixture construction into a dedicated test-support module. Preserve suite-owned state, immediate operation registration, and every test case and assertion.
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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant