Repository navigation
perf(update): reuse verification for owned recovery images - #175359
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Remove the export left unused by manual capture cleanup. Exercise generation refusal and preservation through the retained physical-generation entry point.
Move Doctor and rollback test consumers to the retained physical generation reader after the synchronous helper became private. Keep the existing generation and restoration assertions.
Restore the backup namespace spy and declare the settlement fixtures as SQLite so physical generation reads preserve their no-native-process contract.
2e27c79 to
1f51928
Compare
|
Codex review: needs maintainer review before merge. What this changesThis PR reuses verified SQLite images during manual recovery capture and checks only rebuilt tables after canonical index repair. Example: Candidate Doctor captures the synthetic 43 GB agent database before repair.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR provides a useful, maintainer-directed reduction in database capture work, with no concrete introduced defect found; unresolved CI still prevents a merge-ready verdict. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherDoctor and update maintenance pass database inventories through isolated snapshot workers, which produce verified recovery images and manifests consumed by separate restoration owners. flowchart TD
A[Doctor maintenance custody] --> B[Original state capture]
B --> C[Database backup worker]
C --> D[Verified SQLite image]
D --> E[Final publication comparison]
E --> F[Manual recovery manifest]
F --> G[Restore validation]
Technical reviewBest possible solution: Retain this focused optimization and land it after the required checks for the reviewed head are resolved. Do we have a high-confidence way to reproduce the issue? Current-main source shows repeated generation and publication digest work, supported by the body's large-database observations; no target code was executed during this review. Is this the best way to solve the issue? The change removes repeated work within existing owners while preserving WAL recovery, final-byte comparison, transactional index repair, and separate automatic rollback admission. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 309f0cb002db. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +11, Tests +175, Docs +16. Total +202 across 17 files. Added test files: 0. View PR surface stats
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, 5:59 AM ET / 09:59 UTC. |
…175359) Reduce candidate-side Doctor recovery capture work by reusing exclusive maintenance custody for manual original-state SQLite captures and retaining verified digests across owned inode transfers. Automatic rollback, PostgreSQL generations, WAL recovery, final publication checks, and restore validation remain unchanged. After canonical index repair, verify rebuilt tables instead of repeating a whole-database scan; preserve source admission and finalizer checks. The installed updater still runs first under its own version. Release-note context: reduce redundant full-database reads during candidate updates of large SQLite stores.
What Problem This Solves
Candidate-side Doctor repeatedly hashes the same large SQLite database while retaining its original state. On the synthetic 43 GB agent database, original-state capture took 588 seconds; APFS clone operations were negligible. The baseline recorded eighteen whole-agent digest passes across source generations, private acquisition, and publication. The change removes redundant source-generation and owned-image publication passes.
Manual original-state capture now uses the existing maintenance owner's exclusive SQLite custody. Automatic rollback backups and PostgreSQL retain their generation checks. Owned hardlink publication retains its digest until the final published-byte comparison, and moving that verified image into the capture payload does not hash the rename again. WAL recovery, refusal of absent databases with retained journals, image integrity, publication durability, and restore-time digest/authority checks remain.
Canonical index repair verifies each rebuilt table and its indexes after DDL instead of repeating a whole-database scan. Source integrity admission,
--full-integrity-check, transactional rollback, and migration finalizer data/foreign-key checks remain.The installed updater runs first under its own version. These changes affect only candidate-side Doctor, capture, and schema preparation. There is no schema, retention, or public API change.
Completed measurements
Three alternating shared-harness v3 pairs used frozen base
8c4ea360522c290cada727b04a09408457b44393and candidate05b79326574952d6472cae42822e7060ba65c474(M1,C1,M2,C2,M3,C3). The interrupted original M2 is excluded and was replaced. All six completed runs have complete causal coverage, zero recorded SQL errors, and clean fixture-process shutdown. Counts below are median [min–max]; warmed statistics pool the 30 actual turns per head, rather than treating per-run averages as medians.No ordinary-turn or whole-workload SQL saving is credited to this upgrade-only change. Raw windows include separately attributed background work; the causal warmed-turn counts do not regress. Every raw warmed-window MAIN statement is a background
state_leasesexpiry SELECT in plugin lifecycle lease checks (no-turn-context): 13 in each base run, 13 across the first two windows of C2, and none in C1/C3. Busy-host scheduling moves this maintenance across phase boundaries; it is not a removed check or a SQL saving from this change.Owner attribution is unchanged in every run:
sqlite-index-schemaexecutes eight worker statements during compaction and eight during connected idle;sqlite-readonly-location-cleanupexecutes ten child-process statements at boot and ten at restart. These owners contribute zero MAIN statements and no request-origin matches. This absence of owner-tagged transport requests is not a claim that the entire flow makes zero requests.44 GB upgrade cell
One busy-host pair exercised public candidate-side
doctor --fix --non-interactivein default quick-check mode on derived agent27/state25 images, cloned from the retained native agent28/state26 source including WAL. It covers candidate Doctor, migrations, original-state capture, ordinary Doctor contributions, and fresh readiness; it excludes updater download/install and service activation. The installed updater runs first, so these changes only improve candidate-side work.Complete row counts for transcript identities, transcript events, memory origins, and session heads matched before/after migration. Ordered 100-row sample hashes for transcript payloads, memory origins, and session heads also matched. These are sampled payload hashes plus complete counts, not proof of equality of every payload. The retained source database/WAL metadata remained unchanged.
The observed candidate Doctor duration is still above the five-minute aim. This was one busy-host scale pair, not a controlled latency benchmark; nested Doctor steps and child work overlap and must not be added or subtracted as independent wall-time contributions. The native28/26 explicit-full comparison and stable24 historical-backfill measurement are separate follow-ups.
Compact evidence:
comparison.json,warm-count-audit.json,warm-main-attribution.json,base-scale-summary.json,candidate1-scale-summary.json,doctor-check-costs.json, and per-arm cleanup receipts.Area inventoried T1 calls remain 0→0. The measured production bodies are identical to final PR head
1f519280c06d153f81eb223d3b1694ce244761cb; subsequent changes integrated main and repaired test consumers. The scale fixture already had canonical indexes, so the scoped index repair has forced-repair regression coverage but no claimed share of the scale timing difference.Removed checks and accepted edges
Validation and size
Passed: changed-file formatting, native type-aware lint, and diff whitespace. Both Codex review rounds are scoped-clean. Focused owner proof passed: eight suites, 154 tests passed and two skipped, covering capture/WAL/publication/restore/generations/index repair. The seven additional Doctor/rollback test consumers now use the same async entry point; their basic formatting/lint passed. CI confirmed both later fixture repairs: 28 backup tests and 42 settlement tests passed before the main-integration run superseded that workflow. The published-driver × candidate update cell passed (workflow 39019006593, job 117360580775). Final-head CI passed all production/test types, type-aware lint, source contracts, Madge, T1 (182→182; compatibility 10→10), and the dialect ratchet (0/0/3 unchanged). All nine revised or affected consumer suites passed in CI, 116 tests. The final canonical Knip scan completed with 16 findings, all identical to observed main CI 39021393912, dependencies job 117363945442 at
1225e95d82d9; flagged files and scanner/configuration blobs match main/base/head. There are no candidate-only export findings; Knip itself is not green. Existing active-handle WAL and corruption/rollback regressions remain.Authored diff against integrated main: production +60/−49 (net +11), tests +225/−50 (net +175), documentation +19/−3 (net +16). The old parent generation helper is removed; the small capture-purpose receipt keeps the manual-evidence decision in the existing backup owner.
Final CI reported seven UI cases in five untouched files. A focused replay on this PR's main base
342875ae60f8reproduced six with matching signatures; candidate replay reproduced four and passed two, which is not a claim that the intermittent cases were fixed. The seventh parameterized composer case was not selected by its original full-name filter, but its exact failure (expected 3 to be less than or equal to 1, line825) is recorded in completed main CI39021393912/job117363944654; that file is byte-identical at main/base/head. All seven failures therefore have main or base evidence. No extra UI replay is needed. Both PostgreSQL conformance jobs and all code/static/security jobs passed on the final head. The four failed UI jobs contain only the seven inherited cases above. The aggregate failure report was settling at the pre-merge read; landing uses the authorized inherited-failure route. Frozen SQL measurements completed after merge under the campaign proof policy; all six arms passed.The separate npm 12 package-acceptance job failed its installed-file budget (48,196 versus 47,500); installation completed and the required Docker update cell passed. The independent package-size repair subsequently landed on main. No all-green workflow claim is made.