Repository navigation
fix(doctor): bound scoped backups to version migrations - #172671
Conversation
|
ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 429f22cd74
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Exclude pending migrations whose databases were not admitted by preflight. This prevents an older pending-and-indeterminate database from reaching the version runner or later Doctor consumers as a completed migration. Add a production-path regression that reproduced the missing-target error and checks that the excluded database stays at v26.
) Complete declared schema version phases before broader Doctor maintenance so eligible agent v26-to-v27 and shared-state v22-to-v23 migrations can use table-scoped rollback archives. Preserve full-file rollback for installed updater drivers and undeclared scopes, source-integrity admission, and existing repair owners. Filter version receipts to admitted agent targets, preventing pending-but-indeterminate databases from failing the update path. Run the declared state migration before agent leases can write shared state, retain R9's meeting_transcript_sessions declaration, and preserve live undeclared planner statistics through the existing byte-preserving row codec during scoped restore. Add Doctor entry-point undeclared-table and forced-restore coverage, the published-driver recovery cell, and bounded statistics refresh for older supported SQLite. The synthetic 1.1 GB backup becomes 24 KB; no warmed-path SQL saving is claimed. No schema-version or retention-policy change. The migration-runner restart-test failure carried forward from openclaw#172390 remains unclassified; see the PR for validation and inherited CI evidence.
) Complete declared schema version phases before broader Doctor maintenance so eligible agent v26-to-v27 migrations can use table-scoped rollback archives. Co-authored-by: RomneyDa <[email protected]>
What problem this solves
A small schema migration currently copies and validates the entire database for rollback. A measured 38 GB deployment snapshot spends about 514 seconds validating the backup and 36 seconds copying it, although agent v27 changes only the outbox and planner statistics.
Doctor now finishes each fully declared version phase before broader maintenance. Eligible agent v26→v27 and shared-state v22→v23 migrations can therefore use a table-scoped rollback archive. Installed updater drivers retain their full-file checkpoint contract, and every selected source still receives integrity admission before its checkpoint.
What changed
The agent version runner separates the declared outbox/statistics migration from later startup-column/index repair, session normalization, orphan recovery, transcript repairs, historical media/directives, ACP accounting, and plugin maintenance. Those later operations retain their existing transactions and preserving repair owners. Retained-content rewrites preserve their original image only when an actual rewrite is needed. Older SQLite versions use bounded
ANALYZEfor statistics refresh through the existing statistics owner.The automated-review P2 is fixed: version-phase receipts contain only admitted agent targets. A real preflight regression produces an older database that is both pending and indeterminate; before the fix it throws
Missing discovered agent migration target. The fixed path returns no receipt for that excluded database and leaves it at v26.Main is merged through R9 (#172755,
c58d6181af08). Its shared-state v23 declaration remains exactly["meeting_transcript_sessions"]; the resolver addsschema_metaandconfig_machine_state. The state version phase runs before agent maintenance leases can open shared state. Unrelated index repair, orphan recovery, quarantine cleanup, and full runtime-shape admission remain with later Doctor maintenance. Scoped restoration preserves current undeclared planner statistics with the archive's existing byte-preserving row codec, including raw text bytes, bigint rowids, and laterANALYZEresults. Explicitly declared statistics retain archive-restore semantics. No migration declaration, schema number, retention policy, or public API is changed by this PR.The declared phase reuses integrity admission under the same offline Doctor custody; it adds no foreign-write polling. Recording backup completion after commit is best effort: failure emits a warning and leaves the original image protected.
Evidence and impact
Net change against the merged base: production +309 lines, tests +636, docs/tooling +166.
The synthetic archive is 99.9978% smaller. Avoiding the measured deployment snapshot's copy and copied-image validation would remove about 550 seconds of backup work per eligible standalone/startup Doctor migration. Source admission remains. Host load exceeded available cores, so these observed benchmark times are not production latency claims. The touched migration owners contributed zero statements/requests to warmed turns in all six harness runs; the small aggregate decreases are workload noise, not a runtime saving claimed by this PR.
The existing agent fixture verifies undeclared schema and typed contents, retained history, and populated statistics. A deliberate second-database failure plus production restore recovers the first database's version and FIFO outbox while preserving a later unrelated write. Orphan and updater-marker fixtures retain their full-backup contracts. The new state fixture exercises the actual Doctor migration entry point, requires a scoped archive, checks every undeclared table, defers an unrelated missing index, and restores v22 while retaining later unrelated data and statistics.
Validation at the landing head:
actions/setup-goarchive returned HTTP 404; those jobs provide no behavioral evidence.Failure classification and proof limits
The historical Telegram join-introduction failure (
Automation has no recorded inference account, run 38669500382/job 116209598979) was a base regression fixed upstream by #172775, commit5f604ddd809518b8d0ce4ad9142584b90ebb12d3. The earlier merge context's main parent035bf890treated immediate room-join turns as cron automation. The fix propagatestrigger: "event"and restricts the recorded-inference-account requirement to cron turns. It is present in the pinned main baseline, this PR, and current main91b328ad22271caf6b6fe0ede9ac2597e4d24771.The exact Telegram test,
introduces itself once when Telegram reports joining an allowed supergroup, passes on the final PR head in run 38690495848/job 116275802459, now shardchecks-node-changed-23: one file/one test, 64,991 ms, exit 0. No current Telegram failure is being waived. Local main attempts were inconclusive: standalone preparation spent over 72 minutes compiling declarations; CI-styleqaRuntimepreparation then passed in 33m16s, but the runner's five-minute silence watchdog stopped cold worker compilation before the Telegram case began. Those attempts establish neither a main behavioral pass nor a failure. Current main's later fixture/launcher changes are distinct from the unchanged join-event/auth-guard fix.The focused runner invocation was:
It followed CI's
OPENCLAW_BUILD_PRIVATE_QA=1 OPENCLAW_RUN_NODE_SKIP_DTS_BUILD=1 VITEST=1 pnpm build qaRuntime; a task-local filesystem module cache was also configured. Final CI's native shard runner executed the same test against its prepared runtime. The queued local retry was cancelled once that direct final-head proof and the upstream cause/fix were verified.The migration-runner restart-test failure carried forward from #172390 remains unclassified. No matching baseline failure establishes its cause. The earlier hook-pressure case (20 tool outputs, 19 hook invocations) also remains unclassified despite a later passing replay. Earlier Cron inference-account fixture failures matched scheduled main and passed in the later PR run. The earlier OpenShell retirement path failed on both candidate and baseline with different terminal timing; it is not claimed as an identical-signature failure or a repaired flake.
The former remote proof request reports completion without a GitHub run association; its recovery claim remains preserved, with no duplicate allocation. Ordinary PR CI does not cover Knip. Local export scans used a 30-minute per-scan timeout and began at one-minute load 57.71. The inherited findings are
listBundledChannelPluginIds,bindChatPickerOverlay,handleChatComposerDetailsToggle,syncChatPickerOverlay,ChatWorkingIndicatorOptions(production);ClaudeCliSpawnProofKindandsyncChatPickerOverlay(full-tree); none (scripts).Landing head:
a71c9506d8ad9b9dadd35adc53c071d830b91382. The last delta enables bigint write receipts and moves an existing SAFETY comment. All required final-head gates are complete; inherited Knip findings and unresolved historical proof limits are identified above.