Skip to content

fix(doctor): report retained session metadata differences - #156162

Merged
steipete merged 1 commit into
mainfrom
upd/retained-source-subcases
Sep 23, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/retained-source-subcases

Conversation

@steipete

@steipete steipete commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Refs #155764 #155893

Follow-up to #156052, merged on main as 32366402f49. This branch is now rebased onto 73feceeb54c5209d8c51afac6b88fe53b98fb736, 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 is a342c6913e0. 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:

  • Content identity: deferred-plugin-session-sources.ts:237–255 accepts matching SHA-256 and size; :501–503 refreshes inode/mtime, persisted at :576–615. doctor-session-sqlite.receipt-recovery.test.ts:37–101 exercises recovery with and without failed manifests. The CRLF atomic-replacement control is in doctor-session-sqlite.source-conflict-recovery.test.ts:72–98.
  • Report parity: doctor-session-sqlite-recover-report.ts:144–147 passes current findings into the composer; doctor-session-sqlite-failure.ts:82–101 preserves them in JSON/Markdown. doctor-session-sqlite.receipt-recovery.test.ts:105–187 verifies 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-diff marks the sole commit equal to 276e6095374; the base-relative production diff is byte-identical (SHA-256 f82f48e6d6bfad73a01be08cb89d64eaf19be82f8c24e128f499b23bf25350f1), and the full patch ID remains 0bf881f3121930cce7bd14097ee4cde7a5161673. 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. Separate pnpm 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 4cbf5763b92 because 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:changed passed 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.

@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 23, 2026 04:09
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations size: S labels Sep 23, 2026
Base automatically changed from upd/retained-plugin-source-conflict to main September 23, 2026 04:14
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes scripts Repository scripts size: XL and removed size: S labels Sep 23, 2026
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.
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 23, 2026, 1:11 AM ET / 05:11 UTC (Revision 2).

ClawSweeper review

What this changes

Doctor 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
Reviewed head: 486a082e105d4a577c632a9a7b9d68e79def4e9d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Recorded reviewer rating: A focused diagnostic repair with meaningful boundary coverage and recorded validation, with no identified merge-blocking defect. Real behavior proof remains required by host policy.
Proof confidence 🌊 off-meta tidepool Recorded reviewer rating; Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: GitHub independently verifies the author as a repository admin, so the external-contributor proof gate does not apply. The recorded after-change recovery regression exercises the changed comparison and report output; parent packaged-updater and Windows evidence covers inherited recovery behavior. No stored-data contract or material authority change is introduced.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Required by policy Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: GitHub independently verifies the author as a repository admin, so the external-contributor proof gate does not apply. The recorded after-change recovery regression exercises the changed comparison and report output; parent packaged-updater and Windows evidence covers inherited recovery behavior. No stored-data contract or material authority change is introduced.
Evidence reviewed 10 items Pinned introduced change: The merge-base-to-head patch adds the diagnostic comparison, one recovery regression, and documentation. It does not introduce the parent branch's recovery, startup, or archival changes.
Still necessary on current main: The fetched main implementation reports source-level conflicts and archives unverifiable inputs, but contains no per-session metadata comparison. Its retained-source module is unchanged from the pinned merge base.
Read-only comparison and unchanged authority: The added comparison uses normalized legacy records, existing target-owner filtering, and the exact SQLite reader with readOnly enabled. It appends warning records without modifying receipt authority, canonical rows, archive eligibility, or persisted schemas. These contracts belong to OpenClaw; no Codex dependency contract is required by this patch.
Findings None None.
Security None None.

How this fits together

Doctor 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]
Loading

Before merge

  • Add real behavior proof - Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: GitHub independently verifies the author as a repository admin, so the external-contributor proof gate does not apply. The recorded after-change recovery regression exercises the changed comparison and report output; parent packaged-updater and Windows evidence covers inherited recovery behavior. No stored-data contract or material authority change is introduced.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +76, Tests +74, Docs +3. Total +153 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 77 1 +76
Tests 1 74 0 +74
Docs 1 3 0 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 154 1 +153

Review metrics

Metric Value Why it matters
Production versus test growth production net +76 lines; tests +74 lines The stated growth supplies the missing comparison within the existing owner and a regression covering preservation and report output.
Added regression cost 1 new case; approximately 0.7 seconds reported The case exercises real recovery and persistence without adding process boots, sleeps, or a production-only testing seam.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-session-sqlite-retained.ts, unknown-data-model-change: src/commands/doctor-session-sqlite-retained.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #155764
Summary: This PR addresses the explicitly identified remaining diagnostic subcase of the canonical report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best 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.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This improves diagnosis of retained-session conflicts; the parent fix already restores core recovery and startup availability.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit. This is the recorded reviewer rating; real behavior proof remains required by host policy.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: GitHub independently verifies the author as a repository admin, so the external-contributor proof gate does not apply. The recorded after-change recovery regression exercises the changed comparison and report output; parent packaged-updater and Windows evidence covers inherited recovery behavior. No stored-data contract or material authority change is introduced.

Evidence

What I checked:

  • Pinned introduced change: The merge-base-to-head patch adds the diagnostic comparison, one recovery regression, and documentation. It does not introduce the parent branch's recovery, startup, or archival changes. (src/commands/doctor-session-sqlite-retained.ts:114, 486a082e105d)
  • Still necessary on current main: The fetched main implementation reports source-level conflicts and archives unverifiable inputs, but contains no per-session metadata comparison. Its retained-source module is unchanged from the pinned merge base. (src/commands/doctor-session-sqlite-retained.ts:43, 1aabec7badc0)
  • Read-only comparison and unchanged authority: The added comparison uses normalized legacy records, existing target-owner filtering, and the exact SQLite reader with readOnly enabled. It appends warning records without modifying receipt authority, canonical rows, archive eligibility, or persisted schemas. These contracts belong to OpenClaw; no Codex dependency contract is required by this patch. (src/commands/doctor-session-sqlite-retained.ts:128, 486a082e105d)
  • Diagnostic privacy and severity: Warnings name metadata fields rather than their values. The existing report composer redacts session keys and sanitizes messages; retained-source conflicts remain warning-only through the shared severity owner. (src/commands/doctor-session-sqlite-failure.ts:94, 486a082e105d)
  • Meaningful boundary regression: The new case invokes real import and recovery owners with 12 persisted sessions and two metadata differences. It checks unchanged canonical rows, exact archived bytes, startup admission, exactly two session warnings, and JSON/Markdown report coverage. The captured PR body records a pre-fix failure and candidate passes, including 78/78 paired cases after rebase; these are contributor-reported regression results, not tests executed during this review. (src/commands/doctor-session-sqlite.source-conflict-recovery.test.ts:163, 486a082e105d)
  • Discussion establishes the remaining scope: In [Bug]: OpenClaw 2026.9.5 update blocked by retained_plugin_source_conflict #155764, redxzeta describes a smaller retained index with all 12 canonical sessions and two metadata-only differences. steipete explicitly requests per-session warnings and later identifies this follow-up as the remaining work after the core recovery fix landed.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-23T04:21:02.964Z sha 276e609 :: needs real behavior proof before merge. :: none

@steipete
steipete force-pushed the upd/retained-source-subcases branch from 276e609 to 486a082 Compare September 23, 2026 05:05
@steipete
steipete enabled auto-merge (squash) September 23, 2026 05:08
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed cli CLI command changes scripts Repository scripts size: XL labels Sep 23, 2026
@steipete
steipete merged commit 856da80 into main Sep 23, 2026
365 of 368 checks passed
@steipete
steipete deleted the upd/retained-source-subcases branch September 23, 2026 06:29
vincentkoc added a commit to ycmjbot-bot/openclaw that referenced this pull request Sep 23, 2026
* 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)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
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.
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant