Repository navigation
fix(state): make schema-17 session repair atomic - #134272
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 8:46 PM ET / September 1, 2026, 00:46 UTC. ClawSweeper reviewWhat this changesThis PR moves schema-17 session-schema convergence and canonical-index validation into the migration transaction, renews the maintenance lease before that preflight, and adds rollback and ordering coverage. Warning SQLite table change This PR modifies persisted SQLite tables in Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep open. The earlier repair was merged in #134208, but this PR still contributes the distinct atomic transaction boundary; no blocking introduced defect was found, and the previous lease-renewal finding is addressed. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw Doctor upgrades per-agent SQLite databases before the gateway can operate normally. This change controls the schema-17 path from Doctor’s migration entrypoint through schema validation and final database readiness. flowchart LR
A[Doctor repair] --> B[Agent SQLite database]
B --> C[Migration transaction]
C --> D[Session schema convergence]
D --> E[Canonical index validation]
E --> F[Schema 19 database]
E --> G[Rollback and warning]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +19, Tests +188. Total +207 across 3 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the dedicated transaction-bound v17 preflight and merge after exact-head migration validation completes, preserving rollback for every preflight failure. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible with high confidence: the deterministic Doctor migration entrypoint reaches the v17 schema owner, and the supplied exact-head trace exercises that production path against the affected database shape. This read-only review did not execute the contributor command. Is this the best way to solve the issue? Yes. Moving all v17 additive convergence and validation under the existing immediate transaction is the clean owner-boundary repair; leaving validation outside it would permit partial schema writes on rejection. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 04d73ea52d82. LabelsLabel 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 (1 earlier review cycle)
|
3bebe3a to
be71261
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thanks @RileyJJY! Proof: Current-main red proof showed a rejected schema-17 migration leaving route and index repairs behind. Exact-head sanitized Linux proof passed 34 owner, sibling, and Doctor process tests, and required CI completed green.
|
Move the schema-17 additive and canonical-index preflight into the existing migration transaction. A later participant identity rejection now rolls back every prerequisite write while damaged-index recovery still works. Replace the false-green early-rejection test with red/green owner and `openclaw doctor --fix` process regressions. Related to openclaw#134163 and follows openclaw#134208. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Schema-17 repair was not atomic after #134208. Doctor repaired missing additive session objects and a canonical index before the main schema migration transaction began. If the later participant identity migration rejected an unknown dependency, the database stayed at version 17 but retained those prerequisite writes.
Related to #134163 and follows #134208.
Why This Change Was Made
The schema owner now performs the v17 additive and canonical-index preflight inside the existing immediate migration transaction. A later migration rejection rolls back the whole attempt, while the preflight can still recover a damaged canonical index before strict integrity admission.
The regression uses a valid legacy participant table with an unknown non-unique dependency. Current main accepts and commits the prerequisite repair, then rejects the participant migration. The repaired head rejects the same database without leaving the route column, trigger, or repaired index behind.
The final diff also removes the one-use exported helper and the call-order lease test. Production is net-negative and the test now fails on pre-fix code for the intended reason.
User Impact
openclaw doctor --fixstill upgrades repairable schema-17 databases to schema 19. If later validation rejects a database, Doctor now leaves its schema unchanged instead of committing a partial repair.Evidence
c50533f9d944e7cced59c650b426d3ea18dfc7d0: the focused regression failed becauseroute_context_jsonremained present after the participant migration rejection.7e8b26722634ae730b1a1c62ef09f5882a7f00a3: sanitized clean Linux proof passed the v17 migration, participant recovery, retired-lease, and full Doctor process suites — 34 tests.openclaw doctor --fixprocess paths passed.migrateLegacyMediaPersistenceproduced the same atomic rollback formainand a variedsecondaryagent id.git diff --checkpassed. Production+15/-16(net-1); tests and test support+193/-26(net+167).AI-assisted: built with Codex