Skip to content

refactor(state): drop pre-July-2026 state migrations - #163036

Merged
steipete merged 2 commits into
mainfrom
deslop/l286-migrations-state-sqlite-retire
Oct 1, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/l286-migrations-state-sqlite-retire

Conversation

@steipete

@steipete steipete commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Retires state migrations that only serve formats predating the supported July 2026 upgrade window.

User Impact

Upgrades from pre-July-2026 versions are no longer migrated for session provider/lastProvider/room fields, the single-column agent database registry key, or the reverted ACP and trajectory journal layouts. These inputs now receive an actionable refusal that preserves their data. Back up unsupported state and migrate it with an older compatible release before upgrading.

July-era JSON/JSONL imports and the complete numbered SQLite upgrade chain remain supported. Canonical session fields accompanied by harmless stale aliases remain accepted. No schema version, configuration option, or public plugin SDK surface changes.

Why This Change Was Made

The support boundary is based on the last shipped writer, not a migration's name or age:

Retired shape Writer cutoff and release evidence
Session provider / lastProvider Replaced by channel / lastChannel in 90342a4f3a5 (January 13), shipped in v2026.1.12.
Session room Replaced by groupChannel in bbb71c91989 (January 17), shipped in v2026.1.16-2.
Registry PRIMARY KEY(agent_id) and reverted runtime journals Written by f91de52f0d2 on May 13 and reverted by 694ca50e977 that day. The reintroduced May 30 registry writer already uses (agent_id,path); the reintroduced July journal writers use their canonical session keys.

July releases still wrote schema 1, so its migrations remain. The old registry kind remains in the public SDK type for its separate compatibility contract, but core no longer emits it. Expired comments suggesting October removal of still-supported upgrades were removed.

Evidence

  • Isolated Codex autoreview: no actionable P0/P1 findings.
  • Remote proof: focused state, session, Doctor and CLI suites passed; both import-cycle checks report zero. Full check-changed passed, including core/test types, all dead-export scans, core lint, formatting, ratchets and ownership guards. Hosted CI gates the exact pushed head.
  • The current legacy writer round trip failed with the earlier refusal guard and passed with the final canonical-delivery guard. Final session proof: 17 tests passed, 43.53 seconds wall with --maxWorkers=1. State/schema-policy proof: 120 passed, 34.21 seconds wall.
  • Full build passed in 10m13s. Real built doctor --fix upgrade proof passed all 3 cases, including exact July schema-1 agent inputs, session/auth preservation and repeat-run no-op.
  • Existing hash-pinned v2026.7.1-2 shared SQLite fixture upgrades through Doctor to the current schema with integrity and retained-data assertions.
  • The oldest July release (v2026.7.1-beta.1, published July 2 UTC) has the exact agent-v1 schema fixture bytes used by the built Doctor upgrade test. Session import coverage uses its version-3 transcript and canonical session fields.
  • Unsupported-input tests verify source rows, table definitions, version markers, JSON and transcript bytes remain unchanged.
  • Net reduction: 77 production lines and 173 test/support lines; obsolete successful-migration tests were removed and generic failure-ordering tests retain their assertions using supported schema owners.

The first remote test batch exposed a stale generic failure fixture using the retired registry layout. It now uses a malformed audit table so it still tests receipt closure at the intended migration boundary.

Main moved the session normalizer to its Doctor owner while validation ran. The conflict resolution retains that owner import and the new support-window assertion; git range-diff shows only the changed import context. Rebased candidate a8a08fa544d: 170 relevant session/Doctor tests passed in 149.87 seconds; both cycle checks report zero. The full changed gate above is prior-base evidence; hosted CI checks the rebased head.

Hosted CI found two additional fixtures that relied on the retired shapes. The built CLI lifecycle fixture now writes July groupChannel instead of January room; the generic receipt-ordering fixture uses a malformed audit table. All lifecycle/order/source-preservation assertions remain. Remote proof passed 12 receipt tests and the full built Gateway lifecycle test (164.01s test runtime, including import/restart/reset/delete/concurrency). Both cycles remain zero, and isolated review found no actionable P0/P1 issue.

The same CI run had a 120-second timeout in install.managed-npm-authority.e2e.test.ts. Both original cases passed unchanged in the bounded remote replay (26.94s Vitest, 44.26s wrapper). Cause remains unestablished; this is non-reproduction, not a claimed flake fix. No timeout, assertion, or retry policy was changed.

@clawsweeper

clawsweeper Bot commented Oct 1, 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 gateway Gateway runtime cli CLI command changes commands Command implementations size: L labels Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 1, 2026, 7:42 PM ET / 23:42 UTC (Revision 3).

ClawSweeper review

What this changes

The PR replaces migrations for selected pre-July-2026 session and SQLite formats with data-preserving refusals while retaining July-era imports and numbered database upgrades.

Warning

SQLite table change

This PR modifies persisted SQLite tables in src/state/openclaw-agent-db-session-migrations.ts, src/state/openclaw-state-db-schema-repair.ts. Prefer a design that avoids changing persisted SQLite tables. If the change is necessary, verify migration and upgrade compatibility against an existing database before merge.

Merge readiness

⛔ Blocked before merge - 3 items remain

Both previous fixture findings are resolved, and no new blocking code defect was found. The change remains distinct from current main; published-updater recovery evidence is still needed for the changed upgrade contract.

Priority: P2
Reviewed head: 3f690db8f7a0bb40f4d15fbe90c9a433467f5bce

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and both prior findings are fixed, but the upgrade compatibility gate remains incomplete.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary external-contributor proof gate is exempt under the supplied MEMBER association. Reported built Doctor and Gateway results support imports and lifecycle behavior, but existing-state compatibility remains incomplete because the published updater's changed refusal and recovery path is not demonstrated.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor proof gate is exempt under the supplied MEMBER association. Reported built Doctor and Gateway results support imports and lifecycle behavior, but existing-state compatibility remains incomplete because the published updater's changed refusal and recovery path is not demonstrated.
Evidence reviewed 8 items Pinned introduction and review continuity: Reviewed the merge-base-to-head delta. Comparing the previous reviewed head with the current head confirms that both earlier findings were repaired: the receipt-order fixture now uses malformed audit state, and the built session fixture uses groupChannel. Their behavioral assertions remain.
Session support boundary: The new guard refuses string-valued retired aliases only when their supported replacement is absent; canonical delivery exempts obsolete provider metadata. Doctor import coverage verifies supported group and delivery fields, retained transcript content, and unchanged source bytes on refusal.
Database refusal preserves unsupported inputs: The shared registry check runs before schema repair, and the agent journal check runs before migration writes. Added coverage checks retained rows, table definitions, and schema markers after refusal; numbered migrations remain present.
Findings None None.
Security None None.

How this fits together

Doctor imports older session files and upgrades shared and per-agent SQLite databases before the Gateway uses them. These checks determine whether existing history becomes usable or remains untouched with recovery guidance.

flowchart TD
  A[Existing session files] --> C[Doctor support checks]
  B[Existing SQLite databases] --> C
  C --> D{Supported state shape?}
  D -->|Yes| E[Import and numbered upgrades]
  E --> F[Gateway uses current state]
  D -->|No| G[Preserve data and report recovery]
Loading

Before merge

  • Resolve merge risk (P1) - The changed refusals can stop an existing installation's upgrade, but available evidence does not show a published updater preserving state and leaving the previous Gateway usable or completing rollback and recovery.
  • Complete next step (P2) - Record a published updater running this candidate against supported July state and an unsupported retired format, showing preserved data and a usable previous Gateway or successful rollback and recovery.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source -77, Tests -173, Docs +2. Total -248 across 26 files.

View PR surface stats
Area Files Added Removed Net
Source 12 57 134 -77
Tests 13 155 328 -173
Docs 1 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 26 215 463 -248

Review metrics

None.

Stored data model

Persistent data-model change detected: database schema: src/state/openclaw-agent-db-session-migrations.ts, database schema: src/state/openclaw-state-db-schema-repair.ts, migration/backfill/repair: src/config/sessions/supported-session-store.ts, migration/backfill/repair: src/infra/startup-maintenance-required.ts, migration/backfill/repair: src/state/openclaw-state-db-schema-repair.ts, unknown-data-model-change: src/state/openclaw-state-db-schema-repair.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify the installed updater path (recommended)
    Provide a published-updater × candidate result covering a supported July upgrade and an unsupported-format refusal with preserved state and observable rollback or recovery.

Technical review

Best possible solution:

Retain supported July upgrades and verify that retired formats stop safely before activation, with a working intermediate-release recovery path.

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

Not applicable: this is intentional migration retirement. Source comparison establishes the changed refusals and confirms both previous fixture defects were repaired; no code was executed during this read-only review.

Is this the best way to solve the issue?

Yes, replacing obsolete conversions with checks at the existing migration owners is a focused approach. Upgrade safety still requires evidence through the installed updater, beyond direct Doctor execution.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary external-contributor proof gate is exempt under the supplied MEMBER association. Reported built Doctor and Gateway results support imports and lifecycle behavior, but existing-state compatibility remains incomplete because the published updater's changed refusal and recovery path is not demonstrated.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is bounded migration cleanup with operator upgrade consequences and no established urgent runtime regression.
  • merge-risk: 🚨 compatibility: The explicitly chosen pre-July retirement stops previously migratable setups, and installed-updater recovery remains unverified.
  • 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: The ordinary external-contributor proof gate is exempt under the supplied MEMBER association. Reported built Doctor and Gateway results support imports and lifecycle behavior, but existing-state compatibility remains incomplete because the published updater's changed refusal and recovery path is not demonstrated.

Evidence

What I checked:

  • Pinned introduction and review continuity: Reviewed the merge-base-to-head delta. Comparing the previous reviewed head with the current head confirms that both earlier findings were repaired: the receipt-order fixture now uses malformed audit state, and the built session fixture uses groupChannel. Their behavioral assertions remain. (src/infra/state-migrations.caller-mode.execution.test.ts:524, 3f690db8f7a0)
  • Session support boundary: The new guard refuses string-valued retired aliases only when their supported replacement is absent; canonical delivery exempts obsolete provider metadata. Doctor import coverage verifies supported group and delivery fields, retained transcript content, and unchanged source bytes on refusal. (src/config/sessions/supported-session-store.ts:4, 3f690db8f7a0)
  • Database refusal preserves unsupported inputs: The shared registry check runs before schema repair, and the agent journal check runs before migration writes. Added coverage checks retained rows, table definitions, and schema markers after refusal; numbered migrations remain present. (src/state/openclaw-state-db-schema-repair.ts:246, 3f690db8f7a0)
  • Published July schema boundary: GitHub source at v2026.7.1-beta.1 declares agent schema version 1 and the shared registry PRIMARY KEY(agent_id,path). The annotated release tag resolves to this commit, supporting retention of schema-1 upgrades rather than treating all low schema versions as unsupported. (src/state/openclaw-state-schema.sql:593, 4eb1d333cfec)
  • Still necessary on main and latest release: Both fetched main and the supplied latest release commit still contain the retired session-field migrations. No merged fixing PR was established for this retirement. (src/config/sessions/store-migrations.ts:6, 9e9dd76f74ef)
  • Intentional retirement and reported runtime evidence: Repository State identifies the author as MEMBER. The captured PR body expressly accepts refusing the named pre-July formats and describes intermediate-release recovery. It reports built Doctor upgrades, preserved session/auth state, repeat-run no-op behavior, and a built Gateway lifecycle pass. These are useful results, but the body does not record a published updater executing the candidate's changed refusal and recovery path. (3f690db8f7a0)

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 the published-updater × candidate upgrade and refusal-recovery results in the PR body, with private details redacted.

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 (2 earlier review cycles)
  • reviewed 2026-10-01T22:18:28.301Z sha a7eee59ca53bc076a6045da8e25cc0dd981f060b :: blocked before merge. :: none
  • reviewed 2026-10-01T22:43:33.255Z sha a8a08fa :: blocked before merge. :: [P2] Refresh the remaining caller-order refusal fixture | [P2] Seed the built migration harness with supported group fields

@steipete
steipete force-pushed the deslop/l286-migrations-state-sqlite-retire branch from a7eee59 to a8a08fa Compare October 1, 2026 22:33
@steipete
steipete enabled auto-merge (squash) October 1, 2026 22:38
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 1, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 1, 2026
@steipete
steipete merged commit 6df9e06 into main Oct 1, 2026
193 checks passed
@steipete
steipete deleted the deslop/l286-migrations-state-sqlite-retire branch October 1, 2026 23:43
MarMarLabs added a commit to MarMarLabs/openclaw that referenced this pull request Oct 2, 2026
148 upstream commits, including the community invitation refresh (openclaw#163109),
which rewrites the help text for gateway.controlUi.communityInvite, and the
pre-July-2026 state and plugin migration removals (openclaw#163036, d7eb666).
None of them touch extensions/feishu.

One generated conflict, docs/.generated/config-baseline.sha256. Main changed
the core hash through that help text, and this branch changes the channel
hash, so the file was regenerated from this merge rather than hand-merged.
build:docker ran in a separate detached checkout of this commit. The counts
stay core 2484, channel 3788 and plugin 4468. The core and plugin hashes
match upstream/main, the channel hash stays this branch's, as predicted, and
the three generated-file checks pass there. No code conflicts.

Feishu: 103 files and 1532 tests in the extension project, 17 files and
250 tests in the database-workers project. The forwarder test and the
routing guards pass, 444 tests. tsgo:core, tsgo:extensions,
tsgo:extensions:test, tsgo:test:root, the line-cap, max-lines and
assertion-safety ratchets against upstream/main, oxlint and oxfmt on the
43 changed code files all pass.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
Retire January session-field conversions and reverted May registry/runtime-journal schemas under the July 2026 support window. Refuse unsupported inputs without rewriting their source data, and preserve the numbered SQLite upgrades and JSON/JSONL inputs still written by July releases.

Preserve canonical session delivery records with harmless stale aliases. Validate source-preserving refusals, exact July SQLite fixtures, built Doctor upgrades, focused owner suites, import cycles and isolated code review. Release-note context and writer history are recorded in the PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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