Repository navigation
fix(doctor): avoid repeated database copies in selected reports - #176014
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. What this changesSelected Doctor reports lazily prepare and reuse one private shared-state snapshot across ordinary synchronous and asynchronous reads. Example: A selected Doctor report performs three ordinary reads of a 160 MB shared-state database.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it addresses repeated snapshot copying in selected Doctor reports, and review found no actionable correctness or security defects. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherDoctor selects health checks and reads shared state through the database read owner, which supplies private snapshot bytes to native readers and workers and releases them after report drainage. flowchart TD
A[Doctor selected report] --> B[Retained read scope]
B --> C[Lazy snapshot preparation]
C --> D[Private shared-state image]
D --> E[Synchronous readers]
D --> F[Asynchronous workers]
E --> G[Drain and cleanup]
F --> G
Technical reviewBest possible solution: Use the existing report read scope with one lazily materialized source, preserving independent verification, current reads, and reader-drained cleanup. Do we have a high-confidence way to reproduce the issue? Current main explicitly bypasses report reuse for selected checks, leaving ordinary artifact-preserving reads to prepare separate copies; the supplied regression exercises that path, but no target code was executed during this review. Is this the best way to solve the issue? The change addresses the owning snapshot lifetime and shares acquisition across reader transports without introducing a persistent cache or replacing independent verification. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cd4a35072fb0. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +185, Tests +325, Docs +1, Other +1. Total +512 across 8 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel 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 Reviewed October 17, 2026, 11:06 PM ET / October 18, 2026, 03:06 UTC. |
|
Merged via squash auto-merge.
|
Follow #176014's shared-image contract while comparing native SQLite and retained snapshot paths with the same Windows namespace spelling. Keep the exact one-image and next-report freshness assertions, and normalize the source-isolation comparison too. Proof: all 15 Doctor state-isolation and 65 SQLite owner tests pass locally with one worker; targeted Doctor types, lint, formatting, and P2 autoreview pass. Windows pathname equivalence is covered by the owner tests and a path.win32 control; no native Windows replay was run.
…claw#176014) * fix(doctor): avoid repeated database copies in selected reports * fix(build): retain snapshot source in PR wrapper inventory
Follow openclaw#176014's shared-image contract while comparing native SQLite and retained snapshot paths with the same Windows namespace spelling. Keep the exact one-image and next-report freshness assertions, and normalize the source-isolation comparison too. Proof: all 15 Doctor state-isolation and 65 SQLite owner tests pass locally with one worker; targeted Doctor types, lint, formatting, and P2 autoreview pass. Windows pathname equivalence is covered by the owner tests and a path.win32 control; no native Windows replay was run.
What Problem This Solves
Fixes an issue where users running
openclaw doctor --lint --only ...repeatedly copied shared state between ordinary reads, adding unnecessary I/O and delay on large databases.User Impact
Selected reports reuse one private shared-state image for ordinary reads. Each new report sees fresh committed data, and inspection preserves the source database, WAL, and shared-memory files.
Why This Change Was Made
Selected reports now enter the same report-owned snapshot scope as full reports, with preparation deferred until the first shared-state read. Synchronous and asynchronous readers join one retained preparation and reuse a stable source identity. The source owner retains private bytes until accepted readers drain, while preserving cancellation, fresh/current reads, and cleanup.
Evidence
5555cccdfe6, including all three PostgreSQL conformance shards and the repaired wrapper inventory/provisioning paths.Behavior proof uses real database/report harnesses; no packaged-CLI trace or production rollout is claimed.
Production changes are +185 lines, tests +325, docs +1, wrapper inventory +1. The added production logic owns lazy materialization shared by sync/async readers; extracting acquisition and cleanup keeps that ownership separate from reader transport. No config or schema version changes.
Cross-worker auth snapshots and writable plugin inspection copies require their own ownership changes and remain separate follow-ups.