Repository navigation
fix(doctor): avoid rereading live state for writable inspections - #176334
Conversation
Fork the retained report-owned private database family into an independent writable inspection image. Preserve producer-bound main and WAL mutation fences, source admission, and cleanup ownership without acquiring the live source again. Validation: targeted formatting, diff checks, and independent static review completed. Focused runtime tests and build remain pending; the queued remote allocation was stopped before execution.
Observe only the IPC child created by a fork, excluding the shared retained-source broker. Capture the returned fork cleanup owner for every retirement fixture and retry that exact owner after injected failures. Validation: targeted formatting and git diff --check pass. The prior source run passed 186 of 188 tests; the two corrected assertions await focused remote proof. Production is unchanged; build remains pending.
|
🦞👀 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 changesDoctor creates writable inspection images from its retained private snapshot instead of reading live database bytes again. Example: Run
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it addresses a distinct remaining Doctor I/O problem, and the pinned diff has no actionable findings. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherDoctor captures shared SQLite state for diagnostic reads, supplies disposable writable state to selected inspectors, and retires private handles and files after the report. flowchart LR
A[Doctor report] --> B[Retained read owner]
C[Live SQLite database] --> B
B --> D[Private main and WAL image]
D --> E[Isolated fork worker]
E --> F[Writable inspection image]
F --> G[Diagnostic checks]
G --> H[Handle retirement and cleanup]
Technical reviewBest possible solution: Keep one report-owned read capture and derive an independently writable image through the existing worker and cleanup owners. Do we have a high-confidence way to reproduce the issue? Current-main source shows the report capture followed by a separate live-source acquisition for writable inspection; no target code was executed during this read-only review. Is this the best way to solve the issue? The change fixes acquisition at the existing snapshot owner while preserving writable isolation, source admission, lazy preparation, and cleanup; the simplification pass found no clearly unnecessary production layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 23537be086cc. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +318, Tests +589, Other +1. Total +908 across 23 files. Added test files: 1. 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 HistoryReviewed October 18, 2026, 5:53 PM ET / 21:53 UTC (Revision 3). |
Baseline-Refresh: 9b089d2345fb25f7334ebce0d8d2d7e39df8efed
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
Merged via squash auto-merge.
|
The published 2026.10.5 updater refuses candidate Doctor lint when a retained report snapshot and its writable inspection use different launch contexts. #176334 intentionally forks the captured image rather than reading live state, but the staging runtime kept only one native session and rejected the fork's scoped state environment. Reuse compatible sessions and retain independent custody for other launch contexts. Count and retire directories on their originating session, preserving failed-close retry without replaying a completed directory retirement. Keep launch compatibility and source identity checks unchanged. Cover overlapping Doctor contexts, compatible reuse, independent retirement, and native-close failure. The reported hourly refusal is independent of the missing watch-io worker packaging issue.
Close the retained rehearsal broker before deleting its socket directory. Observe the native snapshot cleanup receipt on Windows rather than a parent-process fs spy, retaining the real open-handle blocker and source preservation assertions. The native-child cutovers in #173154 and #176334 exposed these stale fixture assumptions.
The plugin-deferral rehearsal fixture applies child-process path variables to the current process. Artifact-preserving state reads introduced in #176334 can initialize the process-lived resource broker in that temporary home; fixture cleanup then removes its socket and breaks subsequent tests. Keep os.tmpdir stable for this in-process fixture while retaining the full rehearsal environment and existing migration assertions. Restore both the spy and Node builtin ESM exports after the test. Production behavior is unchanged. Focused plugin-deferral and pending-read checks pass on Node and pinned Bun; formatting, lint, the Doctor test typecheck, and independent Codex review pass.
…nclaw#176334) * fix(doctor): avoid rereading live state for writable inspections Fork the retained report-owned private database family into an independent writable inspection image. Preserve producer-bound main and WAL mutation fences, source admission, and cleanup ownership without acquiring the live source again. Validation: targeted formatting, diff checks, and independent static review completed. Focused runtime tests and build remain pending; the queued remote allocation was stopped before execution. * test(doctor): bind fork fixtures to owned cleanup Observe only the IPC child created by a fork, excluding the shared retained-source broker. Capture the returned fork cleanup owner for every retirement fixture and retry that exact owner after injected failures. Validation: targeted formatting and git diff --check pass. The prior source run passed 186 of 188 tests; the two corrected assertions await focused remote proof. Production is unchanged; build remains pending. * fix(sqlite): isolate the private snapshot family contract * test(discord): align quiet progress expectations
…law#176665) The published 2026.10.5 updater refuses candidate Doctor lint when a retained report snapshot and its writable inspection use different launch contexts. openclaw#176334 intentionally forks the captured image rather than reading live state, but the staging runtime kept only one native session and rejected the fork's scoped state environment. Reuse compatible sessions and retain independent custody for other launch contexts. Count and retire directories on their originating session, preserving failed-close retry without replaying a completed directory retirement. Keep launch compatibility and source identity checks unchanged. Cover overlapping Doctor contexts, compatible reuse, independent retirement, and native-close failure. The reported hourly refusal is independent of the missing watch-io worker packaging issue.
The plugin-deferral rehearsal fixture applies child-process path variables to the current process. Artifact-preserving state reads introduced in openclaw#176334 can initialize the process-lived resource broker in that temporary home; fixture cleanup then removes its socket and breaks subsequent tests. Keep os.tmpdir stable for this in-process fixture while retaining the full rehearsal environment and existing migration assertions. Restore both the spy and Node builtin ESM exports after the test. Production behavior is unchanged. Focused plugin-deferral and pending-read checks pass on Node and pinned Bun; formatting, lint, the Doctor test typecheck, and independent Codex review pass.
What Problem This Solves
Doctor reacquires live database bytes when writable inspections follow a report's existing private state capture. On large databases, that repeats full-database I/O and source comparisons.
User Impact
Writable inspections fork the report's captured state into an independent image. This removes the second live-source acquisition and its full-file comparison. Initial capture and the private copy or reflink remain necessary; this does not claim zero physical copying. No configuration, schema, or runtime upgrade is required by this repair.
Why This Change Was Made
The retained read producer records its private main/WAL family before lending it. The existing isolated worker forks that owned image, holding source custody and checking identity before and after copying. Committed-WAL drift refuses the fork; frame-free WAL creation by read-only SQLite opens is accepted. Failed forks never retry against live state, and completed findings retain advisory disposal warnings.
The shared family type lives in the existing snapshot contract, avoiding a reverse dependency on its implementation. Generic mutable-source copying stays unchanged.
Production LOC: +332/-14 (net +318); tests +746/-157 (net +589); wrapper inventory +1. Growth implements the independent writable-image boundary, IPC validation and custody checks through existing owners.
Related: #176130, #176291
Evidence
6a8a28a238a86fc2671d7fa635b46213105b9be1also passed all 66 affected Doctor/worker/plugin lifecycle tests across five files.pnpm buildpassed at6a8a28aon Linux with Node 26.7 and pinned pnpm 12.11.1 in 500 seconds. Its build-only retry used the existing build-owned 4,352 MiB V8 setting within the proof environment's 12 GiB cap.50968766ffea25b379d8dca96c07eef1b4aa8ecfincorporates captured mainb1066a5c49101f28f3cbe4bfd3ca42bc66758036, preserves both snapshot helpers and main's wrapper inventory. The runtime algorithms match the tested integration; the CI correction relocates an erased type and adds equivalent test braces. Independent review, qualified formatting and diff checks passed.The earlier trace request is addressed by boundary tests: ordinary Doctor CLI output reports findings and counts, not retained-image lineage, copy method or copied bytes. The planned single post-deployment Doctor run measures functional outcome and timing only.