Skip to content

perf(state): move session RPC SQL off the Gateway main thread - #155740

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-main-thread-sql-leftovers-20260919
Sep 22, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-main-thread-sql-leftovers-20260919

Conversation

@steipete

@steipete steipete commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Session history RPCs and row refreshes still execute SQLite queries on the Gateway event loop after the worker migrations. A synthetic probe counted 1,700 host statement executions for 100 warm sessions.get calls and 1,000 for 100 publication-plus-sessions.list cycles.

User Impact

Durable session reads and background preview preparation keep database work off the Gateway event loop. Raw history messages, visibility, lifecycle checks, archive behavior, and response formats are preserved. There are no configuration, schema, durability, retention, or update changes.

Why This Change Was Made

Use the existing row projection for session selection and final authorization, and the retained history worker for raw recent messages, selected dirty/archived rows, previews, and terminal fallback facts. Prepare ACP metadata in the existing shared-state reader, carrying explicit absence through materialization. The projection's existing publications and revisions invalidate those facts. Hot reads rely on their atomic cold-storage check and restore only after a cold rejection.

Selected preparation rechecks row and membership readiness after placement waits; it does not wait for unrelated full-row materialization. The archive owner pins selected row identities only for each prepared-read lifetime, so concurrent disjoint pages cannot evict one another; release restores normal bounded eviction. Fixture cleanup joins accepted projection reads before its synchronous database-close assertions. Terminal transcript facts cross the worker boundary; fallback-notice and runtime-alias policy stays with the host owner, without transferring configuration.

Evidence

Baseline 41f119f66004c2944a79e1aaede0bc77dd35c4d2; the latest quantitative counter rerun below was measured at c0533e73e96b1d486123be096863b1ca33e50255. The current integration separately passes the permanent zero-host-SQL regression; the historical dirty-list counts have not been remeasured after the latest main update. One warmed durable-session fixture with an empty transcript; 100 serialized calls/cycles (before → after). Hooks count StatementSync.get/all/run/iterate executions on the host, excluding DatabaseSync.exec; these are not individual sqlite3_step counts. Dirty-list cycles include the row publication and background work during the cycle.

Statement Warm sessions.get Dirty sessions.list
Table existence 200 → 0 100 → 0
acp_sessions 0 → 0 200 → 0
session_key_contract 200 → 0 0 → 0
config_machine_state content version 0 → 0 100 → 0
Cold archive descriptor 100 → 0 0 → 0
Session row 200 → 0 0 → 100
Transcript projection (includes cold presence) 100 → 0 100 → 0
PRAGMA user_version 500 → 0 400 → 100
PRAGMA schema_version 200 → 0 0 → 0
PRAGMA data_version 0 → 0 100 → 0
Schema-version table-valued pragma 0 → 0 0 → 100
Participant reads 200 → 0 0 → 0
Observed StatementSync executions 1,700 → 0 1,000 → 300

Warm list/describe remain at zero in this fixture. A stronger permanent regression observes host data-database prepares, exec calls, and statement executions across 100 warm gets, 100 dirty gets, 100 dirty describes, and archived get/describe while preserving raw commentary/tool messages. It excludes the captured lifecycle coordinator database and clears publication activity before measuring dirty RPC reads. Participant/member owners are unchanged.

The remaining 300 dirty-list executions occur during publication: 100 PRAGMA user_version, 100 schema-version reads, and 100 exact session-row reads. The earlier pre-integration candidate measured 100; the table reports the final integrated rerun. Saved chat.metadata acquisition, incognito stores, and other legacy synchronous consumers remain separate migration work; this change covers get/describe/list and background row preparation. The unidentified 773-statement sample from the motivating profile was not reproduced or identified, and is excluded from the claimed reduction. CPU samples varied; this PR claims the measured SQL relocation, not a stable end-to-end latency improvement.

Validation used Blacksmith Testbox (openclaw-check); no local test suites, typechecks, or builds ran.

Integration and CI repairs

The final candidate incorporates main through 9eec298184e08a6a3612016bca9932e30cbc2459, including #155471's placement batching and per-ID freshness. Placement reads are admitted before asynchronous selected-row preparation. The existing row refresh owner coalesces exact-row work by physical store, deduplicates keys, bounds retained input, and runs two read scopes so independently retained archive pages can both progress. Each batch makes one read attempt; the existing readiness loop requeues stale work at the FIFO tail. Disposal rejects queued work and preserves active native custody until settlement. A later fixture conflict takes main's observeGatewayRunExecution helper and agent test unchanged, removing this PR's superseded observer. Main's owned-worker cleanup remains intact.

The compact-small-15 failure was task-fixture teardown closing shared SQLite while accepted readers still held native borrowers. The fixture now awaits Gateway shutdown before resetting its registry. Seven session-handler suites likewise await their existing projection disposal before restoring mocks and closing shared SQLite. A session-status fixture now awaits disposeSessionReadContexts(). The repository replay's mid-test reopen uses the existing async close owner and preserves its request-context binding. No assertions, timeouts, retries, or expected-failure baselines were weakened.

The memory candidate-repair failure was upstream's polling race; this branch takes main's deterministic synchronization/cancellation fix from #155745 unchanged. The unrelated Knip unused export was reproduced on pure main and resolved upstream by 1619aff4781; no separate dependency fix is included here.

Validation

  • The permanent real-RPC regression covers zero host SQL across warm/dirty/archived get and describe while preserving raw commentary/tool messages. Restoring the original reader makes the regression fail; the candidate passes. The original single-worker test body cost was 2.972s, 29.14s wrapper wall including compiler preparation.
  • The final placement/archive/prepared-read/worker-read/RPC integration passed 30 tests in five files, 59.62s Vitest / 61.84s wrapper wall, including 160 concurrent descriptions, the 128-retained-batch overload boundary, per-ID freshness, FIFO, disposal, and independent held archived pages. Core typing passed. Final focused type-aware lint passed after removing redundant type arguments and annotating the extracted disposal method.
  • After integrating main's owned history-worker cleanup and unchanged agent-lifetime fixture, 79/79 tests in four files passed in 87.76s wrapper wall on Testbox, covering backfill, real RPC reads, request lifetime, and history cleanup/error ordering. Core typing and the Gateway-root test type graph also passed; full command wall was 4m50s. The lease is stopped.
  • The original 41-file compact CI group reproduced active-borrower teardown errors and 11 cascading failures. The repaired same group passed 575/575 tests, 352.77s wrapper wall. All seven changed session-handler suites passed 129/129 tests with one worker, 98.98s wrapper wall; focused lint passed (25.5s). Testbox run.
  • The task/memory baseline on pure main passed six tests. The first integrated repair passed 39 tests across seven files (120.19s wrapper wall). The session-status fix separately reproduced its no-floating-promises failure, then passed focused lint and all nine tests (39.70s wrapper wall).
  • Full check-changed on immutable 9e36564c passed in 33m42s, including core types, all 25 test graphs, all dead-code scans, scoped lint, formatting, storage guards, and zero runtime import cycles. Testbox run. Later fixture and concurrency deltas have the focused validation above; this earlier full result is not presented as final-head proof.
  • Earlier full builds passed runtime/plugin loading, SDK declarations, CLI bootstrap, and UI assets. Full-candidate independent Codex autoreview after the concurrency integration found no actionable P0–P2 findings.

The previous published head 25b82844fbae035bb9d06bf63d0ddb607c9e2abb failed compact-large-18 on local-request-context.session-tools.test.ts (“lists then archives a visible session through built-in tools with roles enabled”): sessions.list exceeded its 10-second RPC deadline. Replaying the captured 25-file group passed 454/454 tests on both immutable pure main 5ac833c17248e4b074e0f0aede9ec68724b001b4 and the old PR head; the target took 1.730s and 2.521s respectively. Comparison run. Testbox had 16 CPUs versus CI's two, so this does not prove a fix or establish a main reproduction. No code or timeout was changed solely for that unreproduced failure. New exact-head CI and native preparation remain the landing gate.

Earlier compact-large-2 auth-counter contention and a Windows Node/libuv worker-shutdown abort remain observed failures without claimed fixes; later changed-head CI passed those jobs. Setup failures (expired lease or transport lockfile mismatch) were corrected before validation using clean immutable checkouts and frozen installs.

Data-model compatibility: backfillSessionRowTranscriptFields reads optional preview/terminal facts into the in-memory projection. It is not a persisted migration or backfill. Read-only worker tests verify unchanged stored metadata, no writer admission, and no creation of absent storage. Schema versions, written bytes, transactions, durability, retention, and update behavior are unchanged.

Final-head CI a8ae250e26f / run 35781939912 reported one Discord pacing failure in checks-node-changed-extensions-bundle-8: audio-worker-pacing.integration.test.ts:95 counted 51 encoded packets against 50 source acknowledgements. The voice fixture and executed voice-only dependency path are unchanged by this PR. Existing production code flushes and pads partial Opus frames on underrun, and the existing PCM-underflow test verifies that encoded playback length can exceed source PCM length; the pacing fixture's one-chunk/one-packet assumption is timing-sensitive. This is source evidence for an unrelated fixture issue, not an observed explanation of that specific extra packet.

The captured Discord group passed 292 files / 4,107 tests on pure main 8ba18cf19ad11e6171b2fbbb30e536b865f02f91 both normally (169.97s, target 2.796s) and pinned to two CPUs with Node availableParallelism = 2 (179.07s, target 2.932s), Node 24.19.0. Baseline comparison. The exact failure was not reproduced and no fix is claimed. No Discord code or assertions were changed. No CI job rerun was issued; the final workflow snapshot also exposed the separate cleanup defect below, requiring a repaired head.

The completed same-head run also failed checks-node-compact-small-8 in server.sessions.create.test.ts (“reset-in-place reports cleanup truth for a concurrently finalized checkout”): synchronous fixture teardown closed shared SQLite with active native borrowers. On Testbox, the captured 40-file group passed 590/590 on pure main (340.78s) but failed 10/590 on the unpatched PR (433.10s). The latter exposed eight reset-concurrency failures starting at premature shared-state close, a separate archive fixture history-read revocation, and an orphaned-recovery error whose mechanism was not established. Comparison run. This replay used Node24.19.0 and four permitted CPUs with the captured two-worker policy; the failed CI job advertised eight CPUs.

The repair follows each actual lifetime owner. Direct-handler fixtures dispose and join their tracked projections before database shutdown; scoped state fixtures then use their existing async cleanup instead of a competing global synchronous close. The archive fixture closes its projection before its deliberate cold-storage read and recreates the context binding with the same worker services. Local Gateway fixtures use an explicit existing resource host instead of the process-lifetime fallback, and the production resource-release callback now awaits the projection's existing materialization drain after disposal. No new cleanup API, persisted-state contract, assertions, or timeouts were introduced. The orphaned-recovery test remains unchanged; it passes in the same-order repaired replay, without an independently established cause or a claimed separate fix. Fresh independent review of this eight-file repair found no actionable P0–P2 findings.

The hash-verified eight-file lifetime repair passed the original 40 files / 590 tests on the same Testbox in 379.78s; the previously failing create-finalized case took 2.639s. The unpatched PR comparison failed 10 tests, and the repaired group clears reset-concurrency, archive cold-reopen, and the unchanged orphaned-recovery case together. Full-index patch SHA256 58c8c4e9c0c3ab8aff7f7cb919b6b4bb85688278e17bd13dfc08208b3cad8f62 and all eight source-file hashes were verified before execution. An initial preflight mismatch was solely Git's differing index abbreviation widths; no test ran before canonical source verification succeeded.

The six changed lifetime suites also passed 244/244 tests with pnpm test <six files> --maxWorkers=1: 271.00s Vitest / 273.91s measured wall. This covers the create/delete cleanup blocks, reset authority cases, model-catalog teardown, archive/Undo, and scoped local session tools. The list/archive case took 1.202s; the two failed-worker archive cases took 4.183s and 3.839s.

Core typing passed (54.37s), and focused type-aware lint passed on all eight repair files with zero warnings/errors (9.5s). The six-suite run's recorded file durations were create 135.445s, delete/worktree 23.665s, reset-concurrency 4.881s, model-catalog 22.372s, archive/failed-worker 8.176s, and local session-tools 32.043s; combined wall above includes runner/transform overhead. Post-proof source hashes remained unchanged.

The final rebase onto main 9eec298184e08a6a3612016bca9932e30cbc2459 applied without conflicts. All 73 PR files retain identical source bytes from the reviewed and validated repair; the incorporated main changes touch separate paths. The branch remains one commit with the original subject.

Pre-extraction candidate: e1d5492dd7b82f8fe6187f1ec39af29bdcc9028d. The post-rebase Testbox reconstructed the complete candidate tree d92823310b1cab6e549077fff7cc95cc9702d6cb from immutable main plus the 73 hash-verified task files, and verified the same tree after execution. Focused worker RPC, local session tools, and session-ID routing proof passed 22 tests in three files (90.24s wall); core typing passed (74.62s). Rebase proof. All task Testbox leases are stopped. New exact-head CI and native completed-evidence preparation remain the landing gates.

The e1d5492 run's remaining compact session-flow shard completed successfully. Its baseline-ratchet job rejected the additional disposal import because the already-oversized create suite grew from 6,971 to 6,972 counted lines. The existing Git-workspace fixture factory now lives unchanged in the already-imported sibling test-support module; its sole caller imports it, and the duplicate local implementation is removed. Coverage, fixture data, assertions, caps, and baselines are unchanged.

On Testbox, captured pure main 469c2c75ea639a04d6fc8450df340a834afeb39a passed the line-cap check; unpatched e1d5492 reproduced the exact one-line failure. The extraction passed max-lines, line-cap, and assertion-safety gates, the existing worktree provision/reuse case (3.285s test / 48.64s wall), and two-file type-aware lint (zero warnings/errors, 6.2s). Fresh isolated review found no actionable P0–P2 findings. The tested extraction patch SHA256 is 1485133f682fd96bb2c72cbab212aa71953ba6b5c82e0751ce5effc938866c42.

Published candidate: 2eadae970035771eac914143bd075d46e5c3c307, one commit with the original subject. All scoped source proof is complete and all task Testbox leases are stopped; new exact-head CI and native preparation remain the final landing gates.

@clawsweeper

clawsweeper Bot commented Sep 22, 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: XL maintainer Maintainer-authored PR labels Sep 22, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 22, 2026, 6:16 PM ET / 22:16 UTC (Revision 13).

ClawSweeper review

What this changes

Moves durable session history, metadata, and preview reads into existing database workers, with bounded row preparation and coordinated cleanup.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: the SQL offload remains useful and is not superseded by current main. No actionable patch defect was found. The prior migration-proof blocker does not apply because the changed backfill enriches in-memory rows without changing persistent storage contracts.

Priority: P2
Reviewed head: 2eadae970035771eac914143bd075d46e5c3c307

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent worker migration with meaningful regression coverage and no actionable correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary external-contributor proof gate does not apply to this maintainer-authored internal change. Reported Testbox runs exercise the session RPC, worker, and cleanup owners; the inspected tests preserve final disclosure checks. No stored-data contract changes, so migration proof is not applicable.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor proof gate does not apply to this maintainer-authored internal change. Reported Testbox runs exercise the session RPC, worker, and cleanup owners; the inspected tests preserve final disclosure checks. No stored-data contract changes, so migration proof is not applicable.
Evidence reviewed 9 items Pinned change ownership: Reviewed the introduced delta from 9eec298 to the pinned head. Raw commit records confirm the head's parent and the test merge's ordered base/head parents; unrelated base changes were excluded.
Current main still needs the offload: Fetched main still loads session entries and calls the host-side recent-message reader in sessions.get. The branch instead uses selected projection preparation and the retained history worker.
Latest release check: Inspected this file at the supplied v2026.9.5 release commit; it also retains the host-side sessions.get reader. No shipped replacement for this PR was established.
Findings None None.
Security None None.

How this fits together

The Gateway serves session history and session-list requests from clients and agent tools. Its session projection combines stored metadata, transcript facts, and current access rules before returning results.

flowchart TD
  A[Client and agent requests] --> B[Session row projection]
  B --> C[Selected row preparation]
  C --> D[Existing database workers]
  D --> E[SQLite metadata and transcripts]
  E --> D
  D --> F[Current identity and access checks]
  F --> G[Session response]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +682, Tests +526, Docs +17. Total +1225 across 74 files.

View PR surface stats
Area Files Added Removed Net
Source 29 917 235 +682
Tests 44 723 197 +526
Docs 1 19 2 +17
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 74 1659 434 +1225

Review metrics

Metric Value Why it matters
Production versus test growth Production +682 net lines; tests and support +526 net lines Production growth supports bounded selected-row scheduling and existing worker adapters; tests cover SQL placement, freshness, and cleanup.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/config/sessions/session-transcript-worker-readers.ts, migration/backfill/repair: src/config/sessions/session-transcript-worker.types.ts, migration/backfill/repair: src/config/sessions/session-transcript.worker.ts, migration/backfill/repair: src/gateway/session-row-transcript-backfill.kernel.ts, migration/backfill/repair: src/gateway/session-row-transcript-backfill.ts, unknown-data-model-change: src/gateway/session-row-transcript-backfill.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Use the existing worker and projection owners for durable reads while preserving current access checks, physical-store identity, and host-side presentation policy.

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

Not applicable as a functional bug report; source confirms the host-side SQL path, and the PR supplies a focused SQL-counter regression that this read-only review did not execute.

Is this the best way to solve the issue?

Yes. Reusing the existing read workers and projection invalidation is a coherent solution, without a competing store owner or new persistent contract.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded Gateway performance improvement with no demonstrated urgent user-facing outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary external-contributor proof gate does not apply to this maintainer-authored internal change. Reported Testbox runs exercise the session RPC, worker, and cleanup owners; the inspected tests preserve final disclosure checks. No stored-data contract changes, so migration proof is not applicable.

Evidence

What I checked:

  • Pinned change ownership: Reviewed the introduced delta from 9eec298 to the pinned head. Raw commit records confirm the head's parent and the test merge's ordered base/head parents; unrelated base changes were excluded. (2eadae970035)
  • Current main still needs the offload: Fetched main still loads session entries and calls the host-side recent-message reader in sessions.get. The branch instead uses selected projection preparation and the retained history worker. (src/gateway/server-methods/sessions-read-by-key.ts:77, 54655675d54a)
  • Latest release check: Inspected this file at the supplied v2026.9.5 release commit; it also retains the host-side sessions.get reader. No shipped replacement for this PR was established. (src/gateway/server-methods/sessions-read-by-key.ts:77, ec9c1a13db89)
  • Final disclosure checks: After the worker read, sessions.get prepares current rows again and synchronously checks captured generation, agent, key, physical store, session ID, and current sharing policy before responding. Visibility tests exercise private-session changes, replacement, and role/config revocation during the read. (src/gateway/server-methods/sessions-read-by-key.ts:151, 2eadae970035)
  • No persistent backfill or migration: Transcript enrichment reads through the existing read-only history worker and publishes optional fields into resident objects. There is no introduced DDL, persisted-format change, migration, or retention change. Tests cover unchanged metadata, unavailable indexes, and absent storage without creation. (src/gateway/session-row-transcript-backfill.ts:13, 2eadae970035)
  • Storage policy resolves prior blocker: The material-change checkpoint explicitly distinguishes semantic storage changes from read-only queries preserving existing semantics. The previous review's migration-proof request is therefore not carried forward. Public docs: docs/reference/database-schemas/storage-changes.md. (docs/reference/database-schemas/storage-changes.md:1851, 2eadae970035)

Likely related people:

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

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 (12 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-22T14:51:59.979Z sha c0533e7 :: blocked before merge. :: none
  • reviewed 2026-09-22T19:02:52.613Z sha 9e36564c6cdd34ae2519a05ecd65043323936487 :: blocked before merge. :: none
  • reviewed 2026-09-22T19:17:27.482Z sha 60e9d1acf734630e3c3360cdfac5b49cfa6fe26b :: blocked before merge. :: none
  • reviewed 2026-09-22T19:32:09.147Z sha 60e9d1acf734630e3c3360cdfac5b49cfa6fe26b :: blocked before merge. :: none
  • reviewed 2026-09-22T19:58:52.114Z sha 25b8284 :: blocked before merge. :: none
  • reviewed 2026-09-22T20:48:46.626Z sha a8ae250e26f6a07acdb2c64e455e642c27255de1 :: blocked before merge. :: none
  • reviewed 2026-09-22T21:06:14.754Z sha a8ae250e26f6a07acdb2c64e455e642c27255de1 :: blocked before merge. :: none
  • reviewed 2026-09-22T21:56:26.897Z sha e1d5492dd7b82f8fe6187f1ec39af29bdcc9028d :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 22, 2026
@steipete
steipete force-pushed the steipete/perf-micro-main-thread-sql-leftovers-20260919 branch 3 times, most recently from 60e9d1a to 25b8284 Compare September 22, 2026 19:50
@steipete
steipete force-pushed the steipete/perf-micro-main-thread-sql-leftovers-20260919 branch 3 times, most recently from a8ae250 to e1d5492 Compare September 22, 2026 21:48
Move durable session RPC and row-projection SQL through the existing history and shared-state workers. Preserve raw messages, current authorization, archive ownership, worker custody, and host presentation policy. No schema, stored-data, retention, configuration, or update changes.

Integrate main's coalesced placement reads and per-ID freshness. Admit placement work before selected-row preparation; batch exact-row reads by physical store with bounded input, FIFO retries, and two concurrent scopes for independently retained archive pages. Reject queued work on disposal and settle accepted native work before closing SQLite.

Join Gateway shutdown and projection disposal in affected test fixtures. The original 41-file CI group reproduced active borrowers before the repair and passed all 575 tests afterward; seven focused suites passed 129 tests. Main's memory repair and advisory-export CI fixes are incorporated unchanged.

Testbox: final concurrency/archive/RPC proof passed 30 tests, core typing and focused type-aware lint passed. Earlier full check-changed passed all 25 test graphs, dead-code scans, lint, storage guards, and import cycles. Full-candidate independent autoreview has no actionable P0-P2 findings. No local test suites, typechecks, or builds ran.

The previous large-18 sessions.list timeout did not reproduce in the original 25-file group on main or the old PR head (454 tests each); Testbox CPU capacity differs from CI. No timeout or assertion was weakened. Exact-head CI remains the landing gate.
@steipete
steipete force-pushed the steipete/perf-micro-main-thread-sql-leftovers-20260919 branch from e1d5492 to 2eadae9 Compare September 22, 2026 22:07
@steipete
steipete merged commit b7f616e into main Sep 22, 2026
189 of 190 checks passed
@steipete
steipete deleted the steipete/perf-micro-main-thread-sql-leftovers-20260919 branch September 22, 2026 22:27
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 22, 2026
* commit '7d7f977ccfc1ac177526232e4f4960febd010015': (91 commits)
  test: avoid unused target setup in package profile fixtures (#155972)
  fix(worktrees): batch snapshot metadata reads
  test(plugin-state): distinguish borrowed and foreign lifecycle owners
  refactor(agents): share external harness session and attempt machinery (#152181)
  chore(i18n): refresh native locales (#156006)
  chore(test): retain Doctor fixture settlement diagnostics (#155944)
  perf(codex): reuse unchanged inference request bytes (#155987)
  perf(test): prepare snapshot ownership subprocess imports (#155973)
  perf(test): consolidate channel registry coverage (#155014)
  fix(runtime): preserve Node worker dependencies and cleanup diagnostics (#155292)
  perf(test): prepare worktree GC child runtime (#155928)
  fix(ui): open browser cards after delayed panel renders (#153253)
  fix(update): retain the running updater by hard link instead of copying the package (#155977)
  feat(decisions): add explicit evaluation and Labs opt-in foundation (#155134)
  fix(state): preserve lifecycle custody across worker dispatch
  improve: reuse shared tooling fixtures and defer legacy updater proof (#155731)
  improve(ui): reduce real-Gateway test preparation (#155979)
  perf(state): move session RPC SQL off the Gateway main thread (#155740)
  docs(freebsd): explain native Codex runtime limits (#155980)
  fix(qa): count Code Mode nested tool activity as transcript tool evidence (#155976)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
…aw#155740)

Move durable session RPC and row-projection SQL through the existing history and shared-state workers. Preserve raw messages, current authorization, archive ownership, worker custody, and host presentation policy. No schema, stored-data, retention, configuration, or update changes.

Integrate main's coalesced placement reads and per-ID freshness. Admit placement work before selected-row preparation; batch exact-row reads by physical store with bounded input, FIFO retries, and two concurrent scopes for independently retained archive pages. Reject queued work on disposal and settle accepted native work before closing SQLite.

Join Gateway shutdown and projection disposal in affected test fixtures. The original 41-file CI group reproduced active borrowers before the repair and passed all 575 tests afterward; seven focused suites passed 129 tests. Main's memory repair and advisory-export CI fixes are incorporated unchanged.

Testbox: final concurrency/archive/RPC proof passed 30 tests, core typing and focused type-aware lint passed. Earlier full check-changed passed all 25 test graphs, dead-code scans, lint, storage guards, and import cycles. Full-candidate independent autoreview has no actionable P0-P2 findings. No local test suites, typechecks, or builds ran.

The previous large-18 sessions.list timeout did not reproduce in the original 25-file group on main or the old PR head (454 tests each); Testbox CPU capacity differs from CI. No timeout or assertion was weakened. Exact-head CI remains the landing gate.
steipete added a commit that referenced this pull request Sep 23, 2026
Retain ACP metadata and board membership on cold resident rows through the existing worker batch and revision lifecycle. Preserve cold display-row retention, catalog demotion, and lifecycle replacement semantics.

A 5,000-session Testbox fixture reduced filterSetup from 811 ms to 371 ms and main-thread read statements from 56,700 to zero with identical results. RPC regression, worker/archival coverage, typechecks, scoped lint, and repository guards validated. Full core lint has two documented, unmodified baseline line-cap violations.

Related: #151574, #155740.

PR #156665 contains historical measurements, Testbox evidence, and remaining production-attribution limits.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
Retain ACP metadata and board membership on cold resident rows through the existing worker batch and revision lifecycle. Preserve cold display-row retention, catalog demotion, and lifecycle replacement semantics.

A 5,000-session Testbox fixture reduced filterSetup from 811 ms to 371 ms and main-thread read statements from 56,700 to zero with identical results. RPC regression, worker/archival coverage, typechecks, scoped lint, and repository guards validated. Full core lint has two documented, unmodified baseline line-cap violations.

Related: openclaw#151574, openclaw#155740.

PR openclaw#156665 contains historical measurements, Testbox evidence, and remaining production-attribution limits.
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
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 maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. 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