Repository navigation
fix(doctor): restore transcript normalization after database close - #170126
Conversation
Prepare schema facts on the migration-owned handle before transcript writers consume its encoding. Final native close intentionally retires the preceding handle’s facts, so a newly opened migration connection must establish its own admission. Preserves schema, format, integrity, lease and rollback behavior. Historical transcript normalization and both media migration siblings pass with all assertions intact.
Keep admitted readers live while testing historical snapshot versions and zero-query reopen reuse. Final-close retirement in #169956 explicitly requires readmission; the existing state checkonce tests retain that cold-lifetime contract. All migration, rollback, downgrade-refusal and statement assertions are preserved.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: blocked before merge. What this changesThis PR admits migration-owned SQLite connections before transcript writes and updates cron fixtures to retain admission during reuse checks. Example: Doctor normalizes an assistant transcript containing [[reply_to: message-7]] Final answer after the previous database connection closes.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this focused repair addresses a current-main Doctor regression, and no actionable patch defect was found. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherDoctor’s offline migrations open agent databases, validate ownership and schema, and pass migration-owned handles to shared transcript writers that require admitted encoding facts. flowchart TD
A[Doctor migration] --> B[Maintenance ownership and schema checks]
B --> C[Migration native connection]
C --> D[Shared schema admission]
D --> E[Transcript payload writer]
E --> F[Normalized agent transcripts]
Technical reviewBest possible solution: Keep admission in the shared migration adapter while preserving final-close retirement and existing maintenance safeguards. Do we have a high-confidence way to reproduce the issue? Source tracing establishes the close/reopen path into an unadmitted transcript writer; the author also reports baseline failures and passing repaired migration tests, which this read-only review did not execute. Is this the best way to solve the issue? The shared adapter is the appropriate boundary for establishing the writer’s required facts, and the fixture changes preserve data assertions while respecting intentional final-close retirement. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ddaf75ff383b. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +3, Tests -1. Total +2 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 12, 2026, 3:10 PM ET / 19:10 UTC. |
|
Merged via squash.
|
…penclaw#170126) * fix(doctor): admit migration-owned transcript writers Prepare schema facts on the migration-owned handle before transcript writers consume its encoding. Final native close intentionally retires the preceding handle’s facts, so a newly opened migration connection must establish its own admission. Preserves schema, format, integrity, lease and rollback behavior. Historical transcript normalization and both media migration siblings pass with all assertions intact. * test(state): retain admission during cron migration reuse proof Keep admitted readers live while testing historical snapshot versions and zero-query reopen reuse. Final-close retirement in openclaw#169956 explicitly requires readmission; the existing state checkonce tests retain that cold-lifetime contract. All migration, rollback, downgrade-refusal and statement assertions are preserved.
What Problem This Solves
Doctor can skip historical transcript normalization after the preceding database handle closes, reporting
Transcript payload preparation requires admitted SQLite schema facts. The migration adapter now admits its own native connection before using transcript writers. Both callers retain their existing schema, ownership, integrity and maintenance-lease checks.Why This Change Was Made
The trigger is the interaction between #169624, which makes payload preparation consume admitted encoding, and #169956, which retires those facts on final close. The latter is intentional: “Open siblings continue sharing validation facts; reopening after the final connection closes validates again.” Cron migration fixtures now retain a real admitted reader when asserting zero-query reuse. All existing data, rollback, downgrade-refusal and statement assertions remain;
openclaw-state-db-checkonce.test.tsretains cold-reopen validation coverage.User Impact
Update behavior: restores historical directive/media migration through a newly opened handle. It changes no schema, stored format, retention policy or dependency, and preserves failed-authority rollback. Release note: Doctor no longer skips historical transcript normalization after a database close.
Evidence
Validation: all 43 tests passed across the original cron/directive files and both media-migration siblings with
--maxWorkers=1(278.55s wrapper, 205.18s Vitest). Before the change, the two original files reproduced seven failures (205.68s wrapper). Refusal/rollback, malformed history, archive and historical-schema cases pass. Changed-file type-aware lint, formatting and independent P2 review passed. The CI artifact build passed in 218.2s, including built Doctor closures and SDK exports; production types and all 28 owner-selected test type graphs passed. Exact-head CI run 38295206040 passed (36 successful jobs, 26 skipped; 611s).The required published-driver update cell passed on local Linux ARM64: published 2026.10.2 to this exact candidate, 632.44s. The update finished, readiness returned 200, running candidate identity matched, and durable/incognito state survived. The test service and disposable VM were removed. The Testbox request was stopped when it queued; its payload never ran. No CI rerun, dispatch or extra push for green.
Investigated local check failure: the full
check-changeddead-export scan reports 34 production and 22 full-tree unused UI config exports; the script scan is clean. All reported files, their consumers, Knip configuration and scanner are unchanged from base 3c1191d. This patch adds only migration schema admission and a reader-lifetime fixture adjustment, with no new export or UI import. All other selected check-changed commands passed, including runtime cycles (zero), changed-file lint and schema/ownership guards. The UI findings remain unmodified; no claim that local check-changed is fully green. The earlier build-lock interruption was resolved and its unfinished checks resumed without repeating completed proof.