Skip to content

fix(sqlite): speed up read-only snapshot startup - #144448

Merged
steipete merged 2 commits into
mainfrom
codex/standalone-snapshot-worker
Sep 10, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/standalone-snapshot-worker

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a problem where each short-lived read-only SQLite snapshot process loads shared runtime chunks containing work it does not need. Update tests launch these processes repeatedly, making cold startup a material part of their runtime.

Why This Change Was Made

Emit the existing snapshot executable as one standalone bundle in both production and the invocation-owned test compiler. One entry classification removes it from the shared executable graph, while parent orchestration and SDK code retain shared runtime identity. The stable worker path, native process protocol, dependency policy, schema inlining, lazy package loading and artifact verification remain intact.

User Impact

Less cold loading for existing read-only snapshots. Runtime implementation, storage semantics and worker/shard counts are unchanged. The standalone artifact duplicates some helpers used by other outputs; it is 155.8 KB (39.4 KB gzip), which is not a measurement of incremental package size.

Evidence

The unchanged complete update-CLI file plus native sync/async sibling passed all 503 cases in each local arm:

Whole command, including preparation and cleanup Time
Original 620.00s
Candidate 501.08s
Restored original 542.54s

The candidate saved 41.46s (7.6%) against the nearer restored control. The first two arms had a 19m36s pause, and the original controls differed by 77.46s; this is not a guaranteed whole-CI or cross-platform saving. Test inventory/order, assertions, dependencies and execution settings were unchanged. This comparison is pinned to its earlier source base; the rebased candidate was subsequently validated against current source and its frozen dependencies.

The earlier native-child comparison reduced the local import closure from 47 files to one. The final production build also emits a single-file worker; real built sync/async SQLite smoke checks passed. All 479 focused owner/native/config cases passed with one existing platform skip, along with five selected source-freshness/refusal/artifact checks, the normal production build, complete changed-file gates and independent P2 review.

Build-tooling delta is +36 lines for the dedicated executable boundary and its two consumers; existing config guards gain 32 net lines. Runtime implementation delta is zero. No new settings, process pool, cache or test-only runtime seam. Exact-head CI remains required before landing.

@clawsweeper

clawsweeper Bot commented Sep 10, 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 scripts Repository scripts size: S maintainer Maintainer-authored PR labels Sep 10, 2026
@steipete
steipete marked this pull request as ready for review September 10, 2026 22:27
@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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 7:09 PM ET / 23:09 UTC (Revision 2).

ClawSweeper review

What this changes

Builds the short-lived SQLite snapshot process separately in production and tests so it loads less shared code at startup.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused optimization beyond the earlier merged import reduction. No actionable defect was found, and the protected maintainer PR should remain open for normal landing.

Priority: P2
Reviewed head: fbad8a5e3a6c0e08eab5e4f3039e4ecc36bb54ae

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with preserved runtime contracts, useful reported validation, and no actionable review findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER association exempts this PR from the external-contributor proof gate; its body nevertheless reports built sync/async snapshot success and bounded native startup measurements.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER association exempts this PR from the external-contributor proof gate; its body nevertheless reports built sync/async snapshot success and bounded native startup measurements.
Evidence reviewed 9 items Single executable classification: The shared classification extracts only the SQLite read-only executable; both build consumers use it without moving parent orchestration or SDK exports.
Production packaging preserves existing policy: The standalone graph retains the existing dependency predicates, Node output conventions, schema inlining, and unified build group. It does not enable sealed-runtime behavior or change storage schemas.
Test artifacts remain verified: The second build reuses input/output hashing plugins, writes into the same invocation directory with cleaning disabled, and completes before the existing artifact verification and manifest publication.
Findings None None.
Security None None.

How this fits together

OpenClaw creates private SQLite snapshots for read-only inspection through a separate process. The build configuration packages that process, while the parent retains responsibility for launching it, interpreting its result, and cleaning up snapshots.

flowchart LR
  A[Snapshot request] --> B[Parent orchestration]
  B --> C[Standalone snapshot process]
  D[SQLite database] --> C
  E[Production and test builds] --> C
  C --> F[Private snapshot and result]
  F --> B
  B --> G[Read-only inspection and cleanup]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +55, Other +36. Total +91 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 71 16 +55
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 38 2 +36
Total 5 109 18 +91

Review metrics

Metric Value Why it matters
Growth by responsibility Runtime implementation +0; build tooling +36; tests +55 net lines Production growth is confined to the justified executable boundary and its two build consumers; the latest commit adds declaration coverage.

Technical review

Best possible solution:

Keep the snapshot executable independently bundled while preserving shared parent ownership, stable worker paths, and existing snapshot semantics.

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

Not applicable as a correctness regression: this is a performance optimization supported by a reported native-process comparison, which was not rerun here.

Is this the best way to solve the issue?

Yes. Separating the existing short-lived executable at the build owner avoids adding runtime caches, pools, or competing snapshot implementations.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded startup-performance improvement for repeated SQLite inspection processes.
  • 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 supplied MEMBER association exempts this PR from the external-contributor proof gate; its body nevertheless reports built sync/async snapshot success and bounded native startup measurements.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit dfd2e74 adds scripts/lib/runtime-process-core-build-entries.mts:19 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: dfd2e744caa3; files: scripts/lib/runtime-process-core-build-entries.mts)

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 (1 earlier review cycle)
  • reviewed 2026-09-10T22:34:13.169Z sha bf57fcf :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 7b230ef into main Sep 10, 2026
161 checks passed
@steipete
steipete deleted the codex/standalone-snapshot-worker branch September 10, 2026 23:20
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 11, 2026
* perf(sqlite): bundle read-only snapshot child independently

* test(build): retain standalone worker declaration coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: S 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