Skip to content

fix(sessions): retain Doctor repair for July provider aliases - #163171

Merged
steipete merged 5 commits into
mainfrom
fix/lg-config-july-session-provider-aliases
Oct 2, 2026
Merged

steipete merged 5 commits into
mainfrom
fix/lg-config-july-session-provider-aliases

Conversation

@steipete

@steipete steipete commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Restores Doctor migration for provider / lastProvider session records that supported July releases could still write. The retirement in #163036 incorrectly treated all such records as pre-July data.

User Impact

Doctor converts supported aliases to canonical delivery state, saves a verified original-row backup, updates delivery query columns, and invalidates runtime caches. Runtime requires repair rather than converting aliases while reading.

Conversion-required room records remain retired. The error directs operators to preserve their state, install OpenClaw 2026.9.5, run openclaw doctor --fix, and upgrade again. Canonical delivery retains ignored provider aliases, and canonical groupChannel retains an opaque room value.

Why This Change Was Made

Native provider-alias writers ended in January, but the original v2026.7.1 and v2026.7.35 Doctor import paths still preserved these aliases without canonical delivery. Canonical delivery arrived in 73bba03e4c5a3ed9912e6df7c59f501a5d99bb49 on July 24. Retention must follow the last writer, including importers. July importers already normalized room grouping, so the retired room conversion is not restored.

The existing shared session-entry transform/rewrite and verified-backup owners handle the repair. Alias conversion runs before delivery normalization, including direct file import and historical verification; reversing that order creates an empty route before the alias repair can see the destination. Retirement detection runs before planning and during the authoritative transactional reread. Raw repair preserves unrelated tokens and snapshots.

Doctor dependency: the focused changes under src/commands/doctor/shared must land together. Conflict resolutions preserve main's conversation-link normalization, retirement guidance, and #163030 cache ownership. There is no new migration owner or runtime compatibility converter.

Production delta, from the complete paginated PR files response: +89 / -33 / net +56 across 8 production files. Tests/support/fixtures are excluded. Main already consumed the earlier room-reader deletion; this corrective PR does not claim that reduction again.

Evidence

Reviewed head: c93dfa4ef208858777e995368c98663590cbdd3b, base dc27a51ce51c93877bb41215d007e35bece2666f. Independent Codex reviews are clean through P2. Normal hooks, formatting, and diff checks passed. The original hook omission was resolved by replaying the full normal hook on its exact staged tree; later commits used normal hooks.

Current-head Blacksmith Testbox proof:

  • Lease tbx_01m3xy4dg6w0pmnzsnpnysaw59, run 36988370936: targeted lint 8.95 s, native SDK report 382.81 s. All three unique declaration changes were inspected: identical policy properties reorder, with no direct export or entrypoint change. Approved acknowledgement: 9b909e4b.
  • Lease tbx_01m3y99xthwg7ka0cssnyagrth, run 37006736816: build 714.34 s, package 67.12 s, identity verification 0.09 s. Candidate tar SHA256: 312275bc71bf6cc55d676fb8ad64adb19464ba8f80174f518caefd9791437616.
  • Supplemental native checks: production core/UI/extensions types 148.58 s; noncore test types, including all four root partitions, 330.23 s; 19 core graphs without prior passing evidence 451.31 s; unused files 95.07 s; exports 76.08 s. Whole command 1201.916 s, exit 0.
  • Actual July-writer reproduction 89.60 s. Published 2026.9.7 driver to candidate: supported cell 175.00 s, retired-room refusal cell 56.93 s. Verified canonical routing/projections, exact original-row backups, unchanged canonical neighbor, snapshots/transcript bytes, idempotence, and refusal preserving the installed package/bin and original state. Native receipts and downloaded result hashes agree. These isolated --no-restart cells do not claim service-restart proof.
  • The original nine-file agentic-commands-doctor-sessions-cron-sqlite-hosted-2 group passed in its original order: 71.34 s. Session-entry, delivery, and legacy-import owner suites passed in 41.27 s. The changed import test's single-worker command cost was 22.44 s. Complete tests phase 182.42 s; complete cells/tests wrapper 628.088 s, exit 0. Final per-test logs could not be downloaded after automatic lease shutdown; native phase successes, timings, and wrapper completion were captured before shutdown. No tests were rerun for that optional log retrieval.

The proof fixture was corrected without changing product source or weakening assertions: SQLite result prototypes were normalized for comparison; the actual July writer and neighboring fixtures received explicit titles to avoid unrelated title repair; canonical delivery includes route/context/origin; and raw SQL seeds certify their identity cache separately after the JSON-update invalidation trigger. Whole-row, neighboring-row, backup, snapshot, transcript, and idempotence comparisons remain strict. A later invocation stopped at its remote-environment precheck before running tests and was corrected through explicit native Testbox routing markers.

Inherited CI failures

CI run 36984642589 tested this head at merge c7bf4f0ad6a9390c22f2948189a0ab8a04eabce5, with main dbb580aed3e79548f98f361e460fb76f1d38c279. Its only originating failed job was the architecture check's Madge cycle between src/process/command-process-custody.ts and src/process/exec-spawn.ts. This PR changes neither file nor graph configuration; custody does not exist at standalone PR head. The cycle came from #162614 and was fixed on main by 0f470aecdc1208c34df6f233371ff1d6e7484d25.

Cancelled type-stripe logs also reported a duplicate trace property in main's src/agents/prepared-model-runtime.test-harness.ts; standalone PR head has neither property and does not change that file. Main fix d81a2d8b7294ec21741d0e8b23e817a237aac9d6 removes the duplicate. Both fixes are verified ancestors of current main.

Completed exact-head CI lint, boundaries, ratchets, snapshots, security-fast, eight core type graphs, both Knip passes, and package-boundary compile/canary/publication steps are reused. Supplemental native proof above closes every cancelled type/deadcode gap and exercises the original failing migration group. No CI rerun or rebase was used merely to obtain green. The maintainer-authorized pre-existing-failure exception applies to the remaining CI gate status; no owned failure is waived.

Earlier owned failures were repaired: a raw-record overload needed the already-validated SessionEntry type; stale import expectations rejected supported aliases; direct import normalized delivery before aliases; and the ordering fix initially reassigned a parameter. No flake fix is claimed.

@clawsweeper

clawsweeper Bot commented Oct 2, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations size: M labels Oct 2, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 2, 2026, 4:38 AM ET / 08:38 UTC (Revision 9).

ClawSweeper review

What this changes

Doctor repairs July-era session provider aliases into canonical delivery metadata, updates SQLite query columns, and preserves refusal of retired room-only records.

Merge readiness

⛔ Blocked before merge - 3 items remain

The repair remains necessary because current main still rejects supported July provider-alias records. No introduced correctness defect was identified, but the prior persisted-state upgrade-proof blocker remains unresolved.

Priority: P1
Reviewed head: c93dfa4ef208858777e995368c98663590cbdd3b

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch has no identified blocking code defect, but existing-state upgrade compatibility remains unproven.
Proof confidence 🌊 off-meta tidepool Not applicable: Ordinary contributor proof is exempt under the supplied MEMBER association. Independently, Doctor rewrites persisted delivery rows and query projections, so published-updater compatibility remains insufficient; inspected adjacent navigation screenshots do not exercise this migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Ordinary contributor proof is exempt under the supplied MEMBER association. Independently, Doctor rewrites persisted delivery rows and query projections, so published-updater compatibility remains insufficient; inspected adjacent navigation screenshots do not exercise this migration.
Evidence reviewed 10 items Pinned introduced patch: Read the complete merge-base-to-head patch and affected production owners. Alias conversion extends the existing Doctor transform, backup, transaction, and cache-invalidation paths. The supplied verified test merge has the pinned base and head parents; base-branch drift was not attributed to this PR.
Current main still needs the repair: Fetched main rejects string provider or lastProvider aliases when their corresponding channel fields and canonical delivery are absent. The merged retirement change therefore does not resolve the supported July-input problem.
Published July importer: The published v2026.7.35 importer copies the shaped entry, converts room grouping, and sends normalized records to the session-store writer. Its shape normalizer preserves provider aliases. The tag was independently resolved to aa94808.
Findings None None.
Security None None.

How this fits together

Doctor migrates stored session metadata before OpenClaw runtime readers consume it. Its repairs preserve backups and keep delivery metadata consistent with the SQLite columns used to query sessions.

flowchart TD
  A[Stored session records] --> B[Doctor inspection]
  B --> C{Supported format?}
  C -->|Provider aliases| D[Verified backup and repair]
  C -->|Retired room grouping| E[Preserve state and explain recovery]
  D --> F[Canonical delivery and query columns]
  F --> G[Runtime session readers]
Loading

Before merge

  • Resolve merge risk (P1) - Published-updater compatibility for the persisted delivery rewrite remains unverified: observed results must establish canonical delivery/projection agreement, exact backups, unrelated-state preservation, unchanged canonical inputs, idempotence, and source-preserving retired-room refusal.
  • Complete next step (P2) - Record published-driver × candidate compatibility results and focused validation for the final migration changes, including measured changed-test wall costs.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +56, Tests +135, Docs +10. Total +201 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 8 89 33 +56
Tests 3 151 16 +135
Docs 1 10 0 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 250 49 +201

Review metrics

Metric Value Why it matters
Persistent delivery projections 2 columns synchronized: channel and account_id Upgrade proof must show these query columns agree with the repaired canonical delivery metadata.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-session-delivery-state.ts, migration/backfill/repair: src/commands/doctor-session-sqlite-verification.ts, migration/backfill/repair: src/commands/doctor/shared/session-entry-shape.ts, migration/backfill/repair: src/config/sessions/supported-session-store.ts, unknown-data-model-change: src/commands/doctor/shared/session-entry-rewrite.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify supported upgrades (recommended)
    Record the published 2026.9.7 updater running against the candidate with July alias inputs, canonical controls, verified backups, consistent projections, repeat-run preservation, and unchanged retired-room sources.

Technical review

Best possible solution:

Keep legacy conversion with Doctor’s existing verified-backup owner and establish published-driver upgrade compatibility before landing.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: July Doctor preserves provider-only records, and current main rejects those records without canonical delivery. No runtime reproduction was executed in this read-only review.

Is this the best way to solve the issue?

Yes, the patch restores the supported migration through existing Doctor owners while retaining canonical runtime reads; upgrade safety still needs observed verification.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d1ba4d9bdbd5.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The repair restores migration of supported July session records that current main otherwise refuses.
  • merge-risk: 🚨 compatibility: The patch rewrites existing persisted delivery metadata and query projections without completed published-updater compatibility evidence.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Ordinary contributor proof is exempt under the supplied MEMBER association. Independently, Doctor rewrites persisted delivery rows and query projections, so published-updater compatibility remains insufficient; inspected adjacent navigation screenshots do not exercise this migration.

Evidence

What I checked:

  • Pinned introduced patch: Read the complete merge-base-to-head patch and affected production owners. Alias conversion extends the existing Doctor transform, backup, transaction, and cache-invalidation paths. The supplied verified test merge has the pinned base and head parents; base-branch drift was not attributed to this PR. (src/commands/doctor-session-delivery-state.ts:209, c93dfa4ef208)
  • Current main still needs the repair: Fetched main rejects string provider or lastProvider aliases when their corresponding channel fields and canonical delivery are absent. The merged retirement change therefore does not resolve the supported July-input problem. (src/config/sessions/supported-session-store.ts:12, d1ba4d9bdbd5)
  • Published July importer: The published v2026.7.35 importer copies the shaped entry, converts room grouping, and sends normalized records to the session-store writer. Its shape normalizer preserves provider aliases. The tag was independently resolved to aa94808. (src/infra/state-migrations.ts:3304, aa94808cb056)
  • July shape contract: Read the complete published shape normalizer: it validates identity and timestamps without converting provider or lastProvider. This independently supports retaining their Doctor migration. (src/config/sessions/store-entry-shape.ts:42, aa94808cb056)
  • Persistence and rejection boundaries: Raw repair rereads authoritative rows inside synchronous transactions, preserves unrelated JSON fields, updates channel and account_id when delivery changes, and invalidates runtime caches. Retired room detection runs during inspection and again before rewriting. Existing maintenance authority checks remain in place; the patch does not change principal authorization. (src/commands/doctor/shared/session-entry-rewrite.ts:146, c93dfa4ef208)
  • Regression coverage: Source-reviewed tests cover alias conversion, delivery projections, exact original backups, canonical-input preservation, repeat-run no-op, archived import bytes, and room refusal including a row changed after inspection. These tests were not executed during this read-only review. (src/commands/doctor-session-entry-state.test.ts:154, c93dfa4ef208)

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record published-updater results for alias conversion, canonical inputs, exact backups, projections, unrelated state, idempotence, and retired-room preservation.
  • Record focused validation for the final migration changes and single-worker wall costs for changed test files.

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 (8 earlier review cycles)
  • reviewed 2026-10-02T02:33:19.400Z sha 64428630e6ec767454b9d1fd2ea37f45d5acbc15 :: blocked before merge. :: none
  • reviewed 2026-10-02T02:39:52.705Z sha 64428630e6ec767454b9d1fd2ea37f45d5acbc15 :: blocked before merge. :: none
  • reviewed 2026-10-02T03:10:27.398Z sha 6cd969abeeb4ebf8aa66ff5a3fa85d138e18a8ae :: blocked before merge. :: none
  • reviewed 2026-10-02T03:48:02.480Z sha 6cd969abeeb4ebf8aa66ff5a3fa85d138e18a8ae :: blocked before merge. :: none
  • reviewed 2026-10-02T04:07:00.027Z sha 74510f888d7386f1acf20952d285d57449a09d18 :: blocked before merge. :: none
  • reviewed 2026-10-02T04:58:10.393Z sha e9fdfaf :: blocked before merge. :: none
  • reviewed 2026-10-02T06:41:09.869Z sha 7d3703d :: blocked before merge. :: none
  • reviewed 2026-10-02T07:57:44.375Z sha c93dfa4 :: blocked before merge. :: none

@steipete
steipete force-pushed the fix/lg-config-july-session-provider-aliases branch from 6442863 to 6cd969a Compare October 2, 2026 02:57
@steipete
steipete marked this pull request as ready for review October 2, 2026 03:42
@steipete
steipete force-pushed the fix/lg-config-july-session-provider-aliases branch from 74510f8 to e9fdfaf Compare October 2, 2026 04:49
@openclaw-barnacle openclaw-barnacle Bot closed this Oct 2, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 2, 2026
@steipete
steipete enabled auto-merge (squash) October 2, 2026 13:33
@steipete
steipete merged commit f1be744 into main Oct 2, 2026
107 of 146 checks passed
@steipete
steipete deleted the fix/lg-config-july-session-provider-aliases branch October 2, 2026 13:33
steipete added a commit that referenced this pull request Oct 2, 2026
…3729)

Since #163171, Doctor repairs session rows that still carry provider/lastProvider aliases and runtime reads raise a migration-required error until it runs; only room-without-groupChannel rows stay refused with 2026.9.5 intermediate-upgrade guidance. Also drop the retired provider/room names from the session labeling-field list.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
…aw#163171)

* fix(sessions): retain Doctor repair for July provider aliases

* fix(doctor): preserve validated session types during verification

* test(doctor): cover supported July provider imports

* fix(doctor): migrate provider aliases before delivery normalization

* refactor(doctor): keep migration input immutable
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
…nclaw#163729)

Since openclaw#163171, Doctor repairs session rows that still carry provider/lastProvider aliases and runtime reads raise a migration-required error until it runs; only room-without-groupChannel rows stay refused with 2026.9.5 intermediate-upgrade guidance. Also drop the retired provider/room names from the session labeling-field list.
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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant