Repository navigation
perf(state): load SQLite command domains without fallback runtime - #172071
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
October 14, 2026 11:09
Contributor
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
steipete
force-pushed
the
steipete/perf-micro-sqlite-worker-heaps-20260919
branch
from
October 14, 2026 11:25
0b27096 to
8ac0599
Compare
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 15, 2026
…enclaw#172071) * perf(state): load SQLite command domains without fallback runtime * fix(pr): include state worker registry in wrapper inventory * test(state): preserve existing import isolation mock
This was referenced Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Shared-state SQLite workers load unrelated command modules before serving an operation already owned by the lazy domain registry.
User Impact
Registered operations can execute without retaining the fallback command graph. Results, schemas, worker lifetimes, writer admission, and committed receipts are unchanged. A worker that subsequently needs a fallback command still loads that graph; this is not a claim that every long-lived worker becomes smaller.
Why This Change Was Made
The existing shared-state backend now prepares and executes registered domains directly. The fallback runtime no longer duplicates registry routing or carries its unused admitted-write argument. Specialized worktree, device/restart, plugin-state, and GitHub source preparation keep their precedence. Mixed namespaces still check the exact prepared operation before falling back.
Production TypeScript is net +4 lines. The small conditional preparation helper preserves the transport contract that only an actual module load returns a Promise and triggers a compile-cache flush; warm operations continue returning undefined. No new cache, worker pool, configuration, or schema.
Evidence
Matched synthetic fixture: 5,000 sessions, 6,000 retained runs, 200 approvals, 100 disabled cron jobs, 12 repositories with real worktrees, 1,500 MiB logical transcript text, a 4,641,595,392-byte agent database, and an 11,812,864-byte shared-state database. Node 26.8.2; isolated Linux sandbox on CPUs 64–127, 64 GiB memory cap, nice 10 / idle I/O. No production data or service changes.
Compared
2678c2b50c89c1a5f4bf88bf01ec9f36584a1e74with0b270969297d3b480108582b6ab7a4b1ed518cf7. Each fresh process uses the real canonical SQLite worker owner, executesplugins.deferredMigrations.read, verifies the empty result, and retains its lease through fresh per-script heap sampling after the normal worker idle-GC delay. The mixed control additionally executesuserPreferences.readfor a seeded synthetic profile with empty requested keys and verifies its result, forcing the remaining fallback runtime to load. Three processes per revision for registry-only; six for mixed, including three interleaved baseline/head pairs.Registry-only retained heap falls 37.0% (29.17 MiB) and median process RSS falls 9.3%. Mixed worker heap is neutral; mixed RSS changes +0.7% with overlapping ranges (base 370.41–374.95 MiB, head 367.47–394.57 MiB). This supports the narrow benefit without claiming a steady-state saving after fallback use.
These are source-loader measurements of the shared-state operation on the production-shaped fixture, not a full Gateway traffic replay. Process RSS includes the compiler/helper isolate; main GC is not forced. The first cold baseline RSS was 492.95 MiB versus 372.29–377.33 MiB in later registry-only baselines; medians and the mixed control avoid presenting that cold-cache outlier as the saving. Native heap samples cover every observed worker; ArrayBuffer breakdown was unavailable. No bundled-runtime or deployed-Gateway RSS reduction is claimed. Largest transcript workers and fully mixed shared-state workers remain follow-ups.
Initial PR CI exposed a missing wrapper inventory entry for the newly static registry import. Added
src/state/openclaw-state-worker-registry.tsto the canonical inventory and independently reviewed that correction. Rebased onto main to incorporate its separate existingruntime-process-manifest.tsinventory fix (#172056);git range-diffconfirms both lane commits remained patch-identical. The measurements above remain evidence for the unchanged production patch.Post-rebase focused closure/provisioning run: 36 passed, one skipped, one local timeout. Both closure files passed all 21 tests; provisioning passed 15 cases but its macOS-only
materializes full cold/warm PR siblings, then preserves native sparse transitionscase exceeded the existing 120-second timeout on the constrained Mac. No assertion failure was reported. This local APFS timing gap remains unresolved; no timeout increase or replay is being presented as a fix. CI owns broader proof.The corrected-head Labeler workflow (run 38556412118) failed because GitHub returned HTTP 500 for
GET /repos/openclaw/openclaw/issues/172071/labels?per_page=100, before any code-dependent action. No workflow or labeler code changed, and the infrastructure failure was not rerun.The next CI run (38556415279) passed all test shards, typechecks, lint, and architecture guards, but the mock-export ratchet rejected an incidental error-message edit because it fingerprints the existing isolation factory. Restored the original diagnostic without changing the mock behavior, baseline, exceptions, or production code. Independent review was clean; all six import-boundary tests passed again (8.41 s Vitest, 10.57 s wrapper).
Local validation is limited to focused files and changed-file format/lint. PR CI owns broad validation, builds, typecheck, and closure guards. No Testbox/Crabbox lease was allocated.
Final head
dd2a4dd60665de4d04007d412232d468e9bb42f1: CI run 38557918712 passed all tests, types, lint, architecture checks, baseline ratchets, and the CI gate. Security and dependency reviews passed. No workflow reruns or inherited-failure exception were used. The synthetic benchmark sandbox was removed and its absence verified. The local macOS APFS timeout noted above remains a separate validation gap.