Repository navigation
fix(doctor): keep repaired session rows readable - #117207
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 2:10 AM ET / 06:10 UTC. ClawSweeper reviewWhat this changesThe PR adds a shared Doctor helper that validates rewritten SQLite session JSON and restores its validity projection for delivery-state and reserved-incognito-key repairs. Merge readinessThis PR is still necessary: current Priority: P1 Review scores
Verification
How this fits togetherOpenClaw Doctor repairs persisted SQLite session records before runtime reads them through strict session accessors. These two Doctor rewrite paths change row JSON; the schema trigger marks that JSON pending validation, and a later strict reader either accepts a settled row or rejects it. flowchart LR
A[Legacy session row] --> B[Doctor repair]
B --> C[Validate rewritten entry]
C --> D[Update session JSON]
D --> E[Schema validity trigger]
E --> F[Settle row validity]
F --> G[Strict session reader]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +33, Tests +89. Total +122 across 5 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one Doctor-owned validation-and-settlement helper for direct session JSON rewrites, preserve strict runtime reads, and merge after current-head CI confirms the repair. Do we have a high-confidence way to reproduce the issue? Yes. Current source shows either direct Doctor writer can update Is this the best way to solve the issue? Yes. Validating the prospective row through the canonical parser and settling the schema-owned validity projection inside the existing Doctor transactions fixes both sibling writers without a runtime fallback, configuration change, or schema bump. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1b8411958b4d. LabelsLabel 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)
|
185bd74 to
daa1b8d
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Final maintainer landing gate for exact head
Landing via squash with contributor authorship preserved. |
* fix: keep repaired session delivery rows readable * fix(doctor): settle session entry rewrites --------- Co-authored-by: VACInc <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
…in-4caff51-20260801 * origin/main: fix(agents): surface /new guidance for thinking-signature replay errors (openclaw#116967) (openclaw#116987) fix(doctor): keep repaired session rows readable (openclaw#117207) fix(feishu): unify outbound delivery lifecycle (openclaw#117223) docs(gateway): document llamacpp toolSchemaProfile for custom llama.cpp endpoints (openclaw#117120) fix(clickclack): thread replies stop being answered past the 100-reply thread window (openclaw#117225) fix(talk): retain bounded relay close owners fix(talk): bound relay transcript persistence
Summary
openclaw doctor --fixcould rewrite canonical SQLite session JSON and leave the same row marked invalid. The next strict session read then rejected doctor's own output, which could abort doctor or update finalization.This PR now repairs the shared doctor write invariant for both direct
session_nodes.entry_jsonwriters:Both paths validate the prospective canonical row before writing, then restore
entry_valid = 1after the schema trigger resets it.What Problem This Solves
Doctor repair could report success and then make its own repaired session rows unreadable. Affected operators could see doctor or
openclaw updatefinalization fail immediately after legacy session metadata was normalized.The original patch fixed only delivery-state repair. Deep review found the same defect in reserved incognito-key repair, which runs earlier in the same doctor sequence and could still leave a row unreadable.
Root Cause
session_nodeshas anAFTER UPDATE OF entry_jsontrigger that setsentry_valid = 0. Canonical runtime writers follow their JSON update with a separate validity update. The two doctor repair paths bypassed that owner boundary and updatedentry_jsondirectly without settling validity.The strict validity projection landed on
mainin #116703 afterv2026.7.2-beta.6was cut. Neitherv2026.7.2-beta.5norv2026.7.2-beta.6contains that projection, so this is a current-mainrelease blocker rather than a regression shipped in those beta tags.Canonical Fix
A doctor-owned rewrite helper now:
entry_json, andStrict readers remain strict. There is no runtime fallback, retry, schema-version bump, or configuration change.
Evidence
Baseline reproduction against current
mainwith the regression tests retained:The failures proved:
entry_valid = 0entry_valid = 0Exact repaired head:
Coverage includes:
listSessionEntriesAlso passed:
oxlintoxfmt --checkgit diff --checkBlacksmith Testbox was attempted for the changed gate, but checkout sync timed out before any repository command ran. The permitted local fallback then stopped at the dependency-status guard because this Codex GWT must not reconcile its shared
node_modules. Clean exact-head GitHub CI is therefore the heavy proof lane.Scope
Production delta:
+59/-26across the two repair paths and one shared helper. Tests:+95/-6.The positive production delta establishes one canonical validation/write boundary and removes duplicate trigger-settlement policy from both doctor writers.
AI-assisted: yes. Maintainer review traced the producer, trigger, strict reader, sibling writer, doctor order, update finalization path, tag provenance, and focused failure/reopen behavior.