Repository navigation
fix(state): avoid payload copies during online schema preflight - #171984
Conversation
|
ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment |
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR extends the existing isolated schema reader to inspect shared-state metadata without copying database payloads during explicitly online preflight. Example: Online schema preflight against the supplied 256 MiB SQLite fixtures.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR provides a useful performance fix that current main still lacks; the corrected cleanup fixture exercises real fallback, and no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherUpdate compatibility checks pass database paths and supported versions to the shared preflight owner, which returns schema, registry, and retained-deletion facts from isolated SQLite readers. flowchart TD
A[Update compatibility check] --> B[Database preflight owner]
B --> C[Isolated schema reader]
C --> D[Coherent SQLite transaction]
B --> E[Private snapshot fallback]
E --> C
D --> F[Compatibility and discovery facts]
Technical reviewBest possible solution: Use the existing isolated reader for explicitly online shared-state checks while preserving snapshot, recovery, and admission ownership. Do we have a high-confidence way to reproduce the issue? Fetched main unconditionally prepares a shared-state snapshot when no admitted location exists, including explicit online inspection; supplied comparative I/O measurements support the source path, but this read-only review ran no target code. Is this the best way to solve the issue? The patch removes unnecessary copying at the existing owner, reuses coherent native reads, and retains strict artifact-preserving and recovery paths without adding configuration or persistence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0602d851d3b5. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +26, Tests +78, Docs +8. Total +112 across 10 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 14, 2026, 5:42 AM ET / 09:42 UTC (Revision 2). |
|
@clawsweeper re-review Please review current head |
|
🦞👀 Re-review progress:
|
Online shared-state schema preflight now reads committed metadata in an isolated native transaction instead of copying all payloads. The busy writer fixture still expected its node:sqlite.backup preload to create a counter file, so scheduled main failed with ENOENT after admission passed. Remove that obsolete preload and copy-count expectation. Retain successful caller/service admission, caller environment preservation, live writer progress and final source database integrity checks. Culprit: e902bed (#171984). Natural failure: CI 38550286127 / job 115806476493. Proof: https://github.com/openclaw/openclaw/actions/runs/38552665607 Job 115814133885 passed the single diagnosed case on Node 24.19.0 (1 passed, 13 skipped; case 985 ms, Vitest 62.06 s, test step 68 s, whole job 143 s), plus changed-file oxfmt, oxlint and diff check. The reviewed test blob was proven on current main 218baa9 as source f2dcae3. One Codex P2 review was scoped-clean. Test-only change: +7/-35.
…claw#171984) * fix(state): inspect online schemas without copying database payloads * test(update): exercise real schema snapshot fallback cleanup
Online shared-state schema preflight now reads committed metadata in an isolated native transaction instead of copying all payloads. The busy writer fixture still expected its node:sqlite.backup preload to create a counter file, so scheduled main failed with ENOENT after admission passed. Remove that obsolete preload and copy-count expectation. Retain successful caller/service admission, caller environment preservation, live writer progress and final source database integrity checks. Culprit: 4392e4a (openclaw#171984). Natural failure: CI 38550286127 / job 115806476493. Proof: https://github.com/openclaw/openclaw/actions/runs/38552665607 Job 115814133885 passed the single diagnosed case on Node 24.19.0 (1 passed, 13 skipped; case 985 ms, Vitest 62.06 s, test step 68 s, whole job 143 s), plus changed-file oxfmt, oxlint and diff check. The reviewed test blob was proven on current main 4552777 as source f2dcae3. One Codex P2 review was scoped-clean. Test-only change: +7/-35.
What Problem This Solves
Fixes excessive database I/O during ordinary online schema preflight: shared-state inspection copied and compared the entire database before reading schema metadata.
User Impact
Routine online maintenance can inspect shared-state and agent schemas without copying their payloads. Explicit artifact-preserving admission, startup integrity checks, and migration refusals retain their existing guarantees. Online reads may update SQLite SHM read marks; they do not promise byte-identical sidecars.
Why This Change Was Made
Reuse the existing isolated native schema reader for explicit online shared-state inspection. The child keeps a coherent read transaction and closes before cleanup, preserving parent-process SQLite locks. Only the existing recovery/incomplete-WAL result selects snapshot fallback; read and close errors remain failures.
Production delta: +26 lines to extend the existing reader owner to shared state; tests: +78; documentation: +8. No schema or config change.
Evidence
The repaired cases each read another 8,192 B of WAL: 209,176 B total, unchanged across payload sizes. Both had zero staging reads, zero payload mappings, unchanged source DB/WAL hashes, and joined child lifecycles. The trace census covers native read/write/copy operations and distinguishes SHM/epoll metadata from payload. This is logical syscall I/O proof, not a claim that production latency is cured.