Repository navigation
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: blocked before merge. Reviewed October 4, 2026, 8:54 AM ET / 12:54 UTC (Revision 31). ClawSweeper reviewWhat this changesDoctor converts historical compaction checkpoints into private history-retention references and transcript token metrics, allowing runtime cleanup and history readers to stop interpreting legacy checkpoints. Merge readiness⛔ Blocked before merge - 4 items remain Keep open: this migration remains useful and is not implemented on current main. No new actionable code finding was established, but the previous review’s packaged upgrade-safety blocker remains unresolved after the latest file-input fix. Priority: P2 Review scores
Verification
How this fits togetherDoctor repairs older session databases and imported transcript files before OpenClaw starts using them. Its converted records determine which historical transcripts cleanup preserves and which token metrics chat history displays. flowchart TD
A[Historical session records] --> C[Doctor migration]
B[Transcript files and cold archives] --> C
C --> D[Verified original backups]
C --> E[Validate history preservation]
E --> F[Canonical retention and metrics]
E --> G[Refusal with originals preserved]
F --> H[Runtime cleanup and chat history]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Supported updates should complete the Doctor conversion automatically, preserve exact historical content, and retain recoverable originals whenever repair refuses or activation rolls back. Do we have a high-confidence way to reproduce the issue? Not applicable to the requested behavior-preserving refactor. The body documents the prior-head live replay failure and its source regression; this read-only review did not execute the current candidate. Is this the best way to solve the issue? Yes: Doctor’s existing backup, import, rewrite, and transaction owners are the appropriate place for this conversion. The latest intermediate file shape addresses the observed early-repair failure without restoring runtime legacy interpretation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 33bf4664a0e9. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (30 earlier review cycles; latest 8 shown)
|
39a4b6e to
9f74db7
Compare
9f74db7 to
f1d5785
Compare
cf8fadd to
f86aef8
Compare
f5af1d0 to
449dd07
Compare
1ed2644 to
ad3b843
Compare
|
Deferred until these supported checkpoint shapes leave the retention window. At +1,356 net production lines, this migration is too costly; the runtime readers stay. The retention record records the shipped writers and January 2027 retirement checkpoint, including the required check for later preservation writers. Keeping this branch for reference. The independent dot-prefixed checkpoint-path cleanup fix is extracted separately, without the migration or snapshot extension. |
What Problem This Solves
Moves supported historical compaction state out of runtime cleanup and history readers without losing retained history or token metrics. Releases including
v2026.7.1andv2026.9.3wrote checkpoints that still serve both responsibilities.User Impact
Doctor converts checkpoints into canonical retention references and finite metrics on existing compaction events. Runtime consumes those canonical facts. Transcript text, retained-entry boundaries, unrelated fields, and opaque large integers remain intact. Verified backups retain original bookkeeping and unmatched metrics; Doctor never invents a matching compaction event.
The normal update-time Doctor owns conversion. After direct binary replacement, run
openclaw doctor --fixbefore starting the Gateway with historical rows. Prior-head source, build, SDK, package, and the hot/cold 2026.9.7 → candidate cell passed. The separate replay cell exposed a live Doctor file-input defect that the current head fixes. Fresh validation and all three update cells for the current head are pending; this PR is not yet ready to merge.Why This Change Was Made
Migration now uses Doctor's existing entry rewrite, backup, cold restore, import-spool, and transaction owners. Ordinary edits and rewinds preserve retention; forks and explicit resets retain their release behavior. Cross-store repair refuses concrete history-custody loss while preserving originals. A cold-to-hot restore may precede a later refusal; immutable archives remain available to database backups. No schema-version change is introduced.
The shared backup owner captures current repair inputs instead of reusing a stale schema rollback snapshot. Canonical repair backs up and revalidates pending validity before admission, then rebuilds its decisions. Existing path validation rejects aliases, including external stores. The path-containment correction accepts a legitimate child named
..keep. Import backs up an existing destination before restoring cold history or changing metrics.Published 9.7 copies SQLite into its disposable rehearsal but omits cold archive files. In a verified disposable rehearsal only, absent file-backed cold metrics are deferred with a recoverable warning while copied metadata is normalized. Live Doctor still verifies and migrates original archives before activation; present corrupt archives remain errors. Provider-alias-before-delivery ordering from #163171 is preserved.
Significant overlap: #164512 shares Doctor repair-snapshot and source-path validation owners. Its integration must retain these final main behaviors. Main's formatter-import and preview-readiness corrections are included in the base; this PR does not duplicate them.
SDK: public
SessionEntryis unchanged and ordinary entry projections omitretainedHistoryReferences. Existingsession-store-runtimewriter aliasesrecordSessionMetaFromInboundandupdateLastRoutereturn an internal entry type, so their reachable return types gain optionalretainedHistoryReferences: { sessionIds: string[]; artifactPaths: string[] }. The prior93dcSDK comparison reports this additive public effect: no entrypoints added/removed and no direct export changes; 182 exports have changed reachable declaration closures, including internal migration/query declarations. The inspected full digest isc1327cf8305739de6e15dcbf2832659b950d1c390cac5759fe20fc2d08898322. No compatibility export is retired.SessionEntry.compactionCheckpointswas already removed in #154131 and is absent from stable 9.7 public projections.Production +2292 / -936 / net +1356, across 50 production files, from all 85 files in complete paginated GitHub accounting at
e818d504d7beeaf3372dd2f0236586d89a650cd6. Scope issrc/**andextensions/**, excluding tests, support/helpers/utils/harnesses, E2E, and fixtures. Growth belongs to preserving supported durable data; this PR does not claim a net reduction.Evidence
The installed update proof found a second rehearsal gap: 9.7 copies admitted SQLite but omits legacy session JSON/JSONL. Replay's SQLite input was canonical while its checkpoints lived in
sessions.json. The early ACP scan normalized every JSON row merely to find ACP metadata, so strict runtime projection refused it before the transcript importer ran. The current head adds one Doctor-only intermediate shape that preserves checkpoint and locator inputs through file/key/ACP repairs; identity/scalar normalization remains shared and the canonical importer stays strict. The two outer migration cases cover canonical and alias keys, both non-ACP and combined ACP/checkpoint rows, durable ACP metadata, and exact locator/transcript preservation.Prior package run
run_325041de8a6e3a34c03ef74133baa4c2passed in 655.218 s and SDK surface runrun_6083178d8a5e4c98eef81fe61a06f391passed in 5.770 s. At93dc, update runrun_87a68ef4af312212faaa7de39e8ecc2fpassed the hot/cold cell (published update 318.383 s, repeat Doctor 12.432 s, candidate Gateway history 18.680 s). Its replay update failed live ACP preflight after 236.530 s; changed databases and retained snapshots were preserved. Custody did not run. That run remains failed overall, with its successful cell attributed only to93dc.Original
93dcregression runrun_5e20579735d53f531bc42dc9e3192d3cfailed both new cases for the intended ACP/orphan-key refusal in 46.790 s. Fixed production headb06b3259164848c2de358aea8de70890b870a1e8passed the complete outer migration suite (72.699 s), legacy-file suite (22.825 s), ACP suite (31.213 s), and round-trip suite (24.646 s) inrun_e93d7736704646d5190c36881f6341b1. Its broader migration suite passed 110 cases and failed one stale locator-removal expectation (166.046 s). The current test-only child asserts the exact preserved locator; no product assertion, timeout, or retry was relaxed. Those first four passing suites retain their original producer; remaining suites, new delta checks, SDK report, package, and all three new update cells are still pending.Candidate:
e818d504d7beeaf3372dd2f0236586d89a650cd6; base:3f6c1d3a23b90c52b3bf317afc5291e7f1125e32. Independent Codex reviews are clean through P2, including the final mechanical correction. No local builds or tests ran.On Hetzner lease
cbx_b2c1c013d4d4, native runrun_f9268fb2f2bcdbe4ce6de07456a1238fpassed 33 ordinary suites / 470 cases in 1172.221 seconds at parent02f7dbe429c927819e84accd7089356d62c3b3be, usingpnpm test <file> --maxWorkers=1. It then failed the database-worker ratchet in changed checks after 37.737 seconds. The renamed Doctor-only inventory operation was missing from its existing T3 classification. Hosted CI run37186701111also caught six local-variable shadowing diagnostics. The candidate fixes those exact classification and lexical-name omissions, without changing the product algorithm or test bytes. The original run remains failed overall; its passing suites retain their original head and producer. The follow-on inventory check exposed stale generated documentation; the canonical generator corrected it in the docs-only final commit. The original runs remain failed overall. Native continuationrun_2b09bf6d5f1e6d609bed2547f84607d6passed all nine remaining stages: assertion guard 21.798 s, inventory 2.004 s, Kysely guard 55.351 s, changed lanes 0.342 s, changed plan 2.583 s, full changed checks 1281.538 s, CI-artifact build 180.164 s, built-CLI migration E2E 165.225 s, and SDK report 223.791 s. All 33 retained suite results remain attributed to their original head/run; exact mechanical and docs-only delta checks justify their reuse. Packaging and update proof are still pending.Meaningful regressions cover backed-up pending validity, aliased repair inputs, exact opaque entry bytes, retained cold archives, import recovery, and registered history readers. Their original negative controls remain failed at their original heads: the
..keepcontrol (34.310 s), stale-backup control (24.156 s), and three admission/alias cases (31.118 s). No retries, longer timeouts, or weaker assertions were introduced.Earlier update run
run_efaa50f0761b2d6ef1a38b9b1a17837eon stopped leasecbx_84d414edbcd0failed after 96.894 seconds because the published rehearsal omitted a verified 749-byte archive. The candidate's rehearsal-only correction addresses that producer omission; it is not yet claimed as a passing cell. Earlier fixture, import, assertion, and lint failures remain historical failures and are not counted as successful proof.Exact-head hosted CI
37197994646failed only job111423970347(checks-node-changed-compact-large-27, 198 s including setup) and its aggregate gate. The native harness-auth suite ran in worker threads while its real session admission requires the host-owned SQLite actor. Native runrun_f8482c58226f176981a9defedbcb6d65reproduced all 18 failures on clean mainf9dfa9a36f1506e29aee44126d6c6371d7f89aaewith the exact two-file inner shard and observed file order (54.630 s). The unchanged tests plus the shared integration sibling pass 157 cases / 3 files through the existing infra/forks owner (209.070 s). This is a deterministic test-routing defect, separate from the transaction-observer flake. Main already contains the same one-line correction inec583a242659c2a972f25d7a93520cc6f06098c0; the duplicate local fix was not published. Compaction's entry writer can be reached during setup, but the unconditional thread admission refusal and incorrect routing are unchanged on main and independent of retained-history serialization. This is retained failure evidence, not a claim that the failed CI run passed.Measured source-suite wall cost
Each ordinary suite used
pnpm test <file> --maxWorkers=1on the named Hetzner lease. These native storage, recovery, and registered-reader contracts include real worker setup; files above 30 seconds protect persisted bytes or lifecycle boundaries that a mocked helper cannot verify. The original producer is02f7dbe429c927819e84accd7089356d62c3b3be; the built-CLI test ran freshly at93dc1affad6cd11edf4bb7b1ff3b1e16db97dd63.src/commands/doctor-session-compaction-history.test.tssrc/commands/doctor-session-sqlite.compaction-history-import.test.tssrc/commands/doctor-session-canonical-keys.test.tssrc/commands/doctor-session-canonical-keys.address.test.tssrc/commands/doctor-session-canonical-keys.retention.test.tssrc/commands/doctor-session-canonical-keys.race.test.tssrc/commands/doctor-session-incognito-key-repair.test.tssrc/config/sessions/legacy-main-session-migration.handoff.test.tssrc/config/sessions/session-accessor.sqlite-session-row.test.tssrc/config/sessions/session-accessor.sqlite-message-cut.test.tssrc/config/sessions/session-accessor.sqlite-excluded-rows.test.tssrc/config/sessions/disk-budget.test.tssrc/config/sessions/session-cold-storage-eligibility.test.tssrc/plugins/contracts/session-entry-projection.contract.test.tssrc/gateway/server-methods/chat-history-omission-logging.test.tssrc/config/sessions/session-accessor.compaction-boundary.test.tssrc/config/sessions/session-accessor.sqlite-message-cut-native.test.tssrc/commands/doctor-session-sqlite.compaction.test.tssrc/commands/doctor-session-sqlite.compaction-recovery.test.tssrc/config/sessions/session-transcript.worker.schema-freshness.test.tssrc/gateway/server.chat-history-cursor.test.tssrc/tui/embedded-backend.test.tssrc/gateway/session-transcript-readers.markers.test.tssrc/commands/doctor-session-sqlite.manifests.test.tssrc/commands/doctor-session-sqlite.retirement-verification.test.tssrc/commands/doctor-session-transcripts.missing-index.test.tssrc/config/sessions/session-accessor.sqlite-import.test.tssrc/commands/doctor-migration-backup.test.tssrc/commands/doctor-session-canonical-keys.scale.test.tssrc/commands/doctor-session-canonical-keys.completions.test.tssrc/commands/doctor-session-canonical-keys.memory.test.tstest/scripts/eager-import-closure.test.tstest/scripts/pr-wrapper-source-closure.test.tstest/scripts/sqlite-sessions-transcripts-flip-proof.built-cli.e2e.test.ts