Repository navigation
improve: reduce SQLite snapshot process startup cost - #144022
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 9:29 AM ET / 13:29 UTC (Revision 2). ClawSweeper reviewWhat this changesMoves SQLite snapshot orchestration and error classification out of the child process’s import path, reducing startup overhead while preserving snapshot behavior and plugin exports. Merge readiness✅ Ready for maintainer review This remains a useful, measured performance improvement absent from inspected main and the latest release. No actionable introduced defect was found, and the follow-up fixture repair preserves the existing validation boundary. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s update, Doctor, and database readers use private SQLite snapshots to inspect state safely. Parent orchestration selects an existing owner or isolated child process, then returns a snapshot with cleanup ownership. flowchart TD
A[Update and database readers] --> B[Snapshot orchestration]
B --> C{Existing source ownership?}
C -->|Yes| D[Owner-coordinated snapshot]
C -->|No| E[Isolated SQLite child]
D --> F[Private snapshot]
E --> F
F --> G[Read and clean up]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +19, Tests +4, Other -1. Total +22 across 47 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep parent launch and logging dependencies outside the native snapshot child while retaining the existing isolation, ownership, cleanup, and SDK contracts. Do we have a high-confidence way to reproduce the issue? Not applicable as a correctness bug: this is a performance optimization, supported by reported native-child A/B/A measurements and the inspected import graph. Is this the best way to solve the issue? Yes. Moving the existing orchestration and pure predicates removes unnecessary child imports without introducing pooling, caching, duplicate snapshot logic, or a new public contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c973fe7e7219. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
* perf(sqlite): trim snapshot child import graph * test(update): forward snapshot marker in finalization fixture
What Problem This Solves
SQLite snapshot processes repeatedly load parent-side launch and logging code that they do not use. In the measured update CLI suite, 5,226 synchronous snapshot processes accounted for about 85% of elapsed time, making their cold imports a significant test and command cost.
Why This Change Was Made
Move the existing public snapshot-routing functions into the existing snapshot-source orchestration module. Keep copying, recovery, staging, adoption and the single cleanup registry in their current low-level owner. The child argument stays unchanged and moves to the shared process-entrypoint module; the pure SQLite error predicates move out of transaction logging into the existing diagnostics module.
All callers follow the owning modules. The plugin SDK façade keeps the same export names and types, and the test-only compiled library entry follows its implementation. The actual worker entry, arguments, budgets, copy algorithms, cancellation, process isolation, source preservation and ownership checks are unchanged. Two moved field reads use the existing equivalent object coercer, retiring two assertions without adding baseline allowance.
User Impact
The measured native snapshot child starts faster without changing update, Doctor, database or plugin behavior. No flags, caches, worker pools, schema or persistence changes are introduced. Most of the 47-file diff updates imports; production is +19 net lines for the internal owner boundary, tests/support +4, and assertion baseline -1 row. No test case, assertion or timeout is removed or weakened.
Evidence
Full
pnpm buildpassed in 240.97 seconds, the correctly scopedpnpm check:changed --base a265abfecad458603578d72395a8dde6f5d3eadcpassed, and the built iMessage entrypoint profile passed (98.44 MB peak RSS; no comparative memory claim). The initial CI run exposed an omitted export in the subprocess fixture’s prepared-entrypoint substitute; it now forwards the canonical child marker while preserving prepared worker locations. The existing JSON case failed before that fix, then all 16 process cases passed. A separate documentation expectation failure was repaired upstream in #144037. Independent review has no accepted actionable P0–P2 findings; the fixture follow-up is scoped-clean through P2. Fresh full CI must pass before landing. This is not a live installed-package update or a claim that the eight-minute CI objective is complete.