Repository navigation
fix(doctor): report retained session metadata differences - #156162
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. |
Compare retained index entries with canonical SQLite through the existing read-only reader. Preserve canonical values and protected source archives, while recording affected session keys and differing metadata fields in the existing recovery findings and sanitized reports. Cover the reported 12-session, smaller-index recovery with two changed runtime metadata entries and no historical manifest issues. Refs #155764 #155893 Follow-up to #156052. Thanks @redxzeta and @zhiyuan82-tech for the detailed recovery evidence.
|
Codex review: needs real behavior proof before merge. Reviewed September 23, 2026, 1:11 AM ET / 05:11 UTC (Revision 2). ClawSweeper reviewWhat this changesDoctor compares retained session indexes with canonical SQLite and reports affected sessions and differing metadata fields, with recovery regression coverage and documentation. Merge readiness⛔ Blocked before merge - 2 items remain This remains a useful, narrowly scoped follow-up: current main preserves conflicting inputs but does not identify the differing session metadata. No actionable correctness or security defect was found. The earlier external-contributor proof blocker does not apply to the independently verified repository admin. Priority: P2 Review scores
Verification
How this fits togetherDoctor repairs session storage during offline maintenance. Its retained-source recovery compares historical inputs with canonical SQLite, preserves conflicting originals, and produces diagnostic reports. flowchart TD
A[Doctor import or recovery] --> B[Retained source verification]
C[Historical session index] --> B
B --> D[Compare conflicting index]
E[Canonical SQLite sessions] --> D
D --> F[Per-session warnings]
B --> G[Existing protected archive]
F --> H[Recovery reports]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +76, Tests +74, Docs +3. Total +153 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. Technical reviewBest possible solution: Keep metadata diagnosis in the existing retained-source owner while preserving canonical sessions, protected originals, and the shared report sanitization path. Do we have a high-confidence way to reproduce the issue? Yes, from source: recovering a changed retained index currently produces file-level warnings without naming differing session metadata. The added regression models the reported 12-session case, but this read-only review did not execute it. Is this the best way to solve the issue? Yes. Reusing normalized legacy records, the exact read-only SQLite reader, and existing warning/report owners is a focused repair that leaves recovery authority and canonical data unchanged. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1aabec7badc0. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
276e609 to
486a082
Compare
* commit '3ab93b4ea59804b34d02a696382db16dc95189bb': (80 commits) fix(gateway): keep session refreshes moving during unrelated writes (openclaw#156286) chore(deps): update fs-safe to 0.18.2 (openclaw#156262) refactor(plugins): extract ClawHub plugin archives once (openclaw#156246) improve(llm-core): avoid unnecessary tool validation sets (openclaw#152066) fix(backup): verification accepts archives missing captured databases (openclaw#156211) fix: cancel Guest work when its original access is revoked (openclaw#156106) fix(test): classify drained legacy migration refusals fix(anthropic): finish Opus 5.5 defaults and thinking display (openclaw#156093) refactor(agents): share native harness tool execution (openclaw#154217) fix(ui): carry typed ownership through short-route resolution test(worktrees): accept additive gc result fields (openclaw#156127) test(tasks): close sqlite borrowers before registry reload (openclaw#156131) chore(autoreview): sync Astra high defaults (openclaw#156175) refactor(node-host): await prepared workspace storage (openclaw#149519) improve: speed up cold Node test planning (openclaw#156234) fix(doctor): avoid slow legacy ownership repair in source checkouts (openclaw#156238) improve: speed up native build artifact validation (openclaw#156219) fix(ui): preserve short-route resolution ownership fix(doctor): name retained session metadata conflicts (openclaw#156162) perf(tasks): bound creation selection to matching runs (openclaw#156183) ...
Compare retained index entries with canonical SQLite through the existing read-only reader. Preserve canonical values and protected source archives, while recording affected session keys and differing metadata fields in the existing recovery findings and sanitized reports. Cover the reported 12-session, smaller-index recovery with two changed runtime metadata entries and no historical manifest issues. Refs openclaw#155764 openclaw#155893 Follow-up to openclaw#156052. Thanks @redxzeta and @zhiyuan82-tech for the detailed recovery evidence.
Refs #155764 #155893
Follow-up to #156052, merged on main as
32366402f49. This branch is now rebased onto73feceeb54c5209d8c51afac6b88fe53b98fb736, with only its own follow-up commit remaining.What Problem This Solves
Retained-index recovery preserves changed input without identifying which session metadata differs from canonical SQLite.
User Impact
Doctor now names the affected sessions and differing metadata fields as warnings before protecting the retained index in the migration archive. Existing canonical rows stay unchanged and Gateway startup remains available.
Why This Change Was Made
The reporter's retained index shrank from 190,020 to 187,332 bytes while all 12 session keys remained in SQLite; two entries differed only in runtime metadata. The parent fix already archived this input safely, but reported only a file-level conflict. The retained-source owner now compares normalized legacy entries through the existing exact, read-only SQLite reader and records per-session differences. SQLite transcript locators are excluded because import deliberately replaces the file locators.
These findings are diagnostic: they do not grant modified inputs receipt authority, replay old values, or resurrect deleted sessions. Existing archive and report owners retain their responsibilities. The warning names fields rather than copying metadata values.
The unchanged-byte case is fixed by
911f63ab915(#153655), whose immediate parent isa342c6913e0. Both are already ancestors of the parent branch, so no additional cherry-pick is needed. ClawSweeper’s closure of #156046 covers this same metadata-only case.The other pinned cases were already covered at parent head
4cbf5763b92ccdef94cb93c9697349f4a319d393:deferred-plugin-session-sources.ts:237–255accepts matching SHA-256 and size;:501–503refreshes inode/mtime, persisted at:576–615.doctor-session-sqlite.receipt-recovery.test.ts:37–101exercises recovery with and without failed manifests. The CRLF atomic-replacement control is indoctor-session-sqlite.source-conflict-recovery.test.ts:72–98.doctor-session-sqlite-recover-report.ts:144–147passes current findings into the composer;doctor-session-sqlite-failure.ts:82–101preserves them in JSON/Markdown.doctor-session-sqlite.receipt-recovery.test.ts:105–187verifies a remaining conflict appears in JSON, Markdown, and the support issue. Current recovery findings are labeled separately from historical validation and restore status.Checked #155827 by @vincentkoc: its plugin-installation plan refresh is complementary and has no production-file overlap with this change.
Release-note context: explain retained session index metadata drift during Doctor recovery while preserving canonical sessions and the original retained bytes. Thanks @redxzeta and @zhiyuan82-tech for the detailed evidence.
Evidence
Post-merge rebase head:
486a082e105d4a577c632a9a7b9d68e79def4e9d. No conflicts or semantic changes.git range-diffmarks the sole commit equal to276e6095374; the base-relative production diff is byte-identical (SHA-256f82f48e6d6bfad73a01be08cb89d64eaf19be82f8c24e128f499b23bf25350f1), and the full patch ID remains0bf881f3121930cce7bd14097ee4cde7a5161673. The existing clean Codex P1 review remains applicable.Rebased candidate proof on Blacksmith Testbox
tbx_01m367pgb7mvxs0wmaakw9r846, run 35817711357: paired source-conflict and receipt-recovery suites N=3, 78/78 passed, walls 42.717, 38.078, 38.073 seconds. The 40-file importer selection passed 39 files / 504 cases, with one Windows-only file and six existing cases skipped, in 448.540 seconds. No individual test exceeded 30 seconds.Rebased candidate
node scripts/check-changed.mjs --base origin/main --timed: exit 0, 470.443 seconds, all 25 test-type shards and all selected guards passed; targeted lint reported zero warnings/errors. Bounded parallel compiler preparation took 877.858 seconds. The combined remote invocation exited 0 in 2000.637 seconds. Separatepnpm check:architecture: exit 0, 116.700 seconds, including zero runtime cycles and zero Madge cycles. Source hashes and the exact base were verified inside both remote payloads. This is fresh Linux regression/static proof; the earlier native Windows and packaged-updater evidence remains unchanged.Before the fix: the new 12-session regression fails on
4cbf5763b92because per-session findings are empty. The preceding assertions already prove preservation of all 12 rows, exact archived bytes, and Gateway startup admission.After the fix on the latest parent: N=5 passed: 130/130 cases across paired source-conflict and receipt-recovery files, including existing identity-refresh and report-parity regressions. Walls: 38.479, 34.275, 34.161, 35.289, 39.416 seconds.
The latest-parent entrypoint batch accounted for 40 files: 39 passed and one platform-skipped; 504 cases passed with six existing platform skips, in 490.049 seconds. This batch preceded the final equivalent
sort()→toSorted()lint correction; N=5 was repeated afterward on the final code.Full
check:changedpassed on the final code, including all 25 test-type shards, lint, and repository guards. The final remote command (lint, N=5, bounded parallel type preparation, and the normal changed gate) exited 0 in 791.909 seconds. Architecture checks also passed with zero static/runtime cycles.Fresh independent Codex P1 autoreview of the final sorting correction: scoped-clean, exit 0.
The baseline failure and first N=5 proof used this Testbox run. The latest-parent proof reuses the test lease,
tbx_01m361m2ftvbjxce86cme9rjr3, and the static-check lease,tbx_01m361m2ksk4njkj16zqde4fft, with unchanged recorded base/head identity. The wrapper verifies the three candidate file hashes before execution.Scope and measured test cost
Production: +77/-1 (net +76). Tests: +74/-0. Docs: +3/-0. Growth supplies the previously missing per-session comparison and warnings inside the existing retained-source owner; no new public options, dependencies, schemas, or canonical-session writes.
The changed recovery file contains 21 cases. Standalone wall times before the mechanical parent rebase (
pnpm test <file> --maxWorkers=1; the changed test file is unchanged): 36.133, 30.606, 31.041, 36.015, 34.799 seconds; summed case time approximately 17–22 seconds per run. The new case takes approximately 0.7 seconds. Receipt recovery walls: 19.352, 18.193, 18.370, 18.312, 19.155 seconds. Hosted PR CI timings are not available yet. The new case uses the real migration/recovery entry point, completed SQLite rows, exact reported source sizes, and a failed manifest with zero old issues. It verifies exactly two per-session warnings and their presence in the generated recovery report. Existing receipt recovery covers five cases per run.Gateway availability here is proven at the startup migration admission boundary. The parent PR owns the packaged Linux updater and native Windows HTTP readiness proof; this follow-up changes diagnostic reporting only.