Skip to content

fix(state): keep retired SQLite schema hashes resolvable across schema edits and generations - #196800

Merged
RomneyDa merged 3 commits into
openclaw:mainfrom
Devin-Linux:fix/sqlite-catalog-cross-generation-read
Nov 12, 2026
Merged

RomneyDa merged 3 commits into
openclaw:mainfrom
Devin-Linux:fix/sqlite-catalog-cross-generation-read

Conversation

@Devin-Linux

@Devin-Linux Devin-Linux commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #196798. Preserves and completes @Devin-Linux's original historical-catalog repair.

What Problem This Solves

An installed updater can read replacement SQLite catalog assets using historical fingerprints during an in-place build swap. Missing historical state and runtime-projection hashes can crash the old reader or refuse database admission.

User Impact

Preserves historical catalog inputs needed by installed readers while retaining the current createRequire loader contract. No new setting, database schema version, or permissive unknown-schema fallback is introduced.

Why This Change Was Made

The existing predecessor owner now accounts for both successive unversioned additions (browser requests and bootstrap_deferred). Generation and runtime admission share those historical inputs; all four historical runtime flag combinations are covered. The historical module is included in the PR wrapper inventory. Canonical generated assets are regenerated, not hand-edited.

Head bbcc84b39462bd1728c6c53ac15b796a5a932649 preserves the original PR head as its first parent and integrates tested main baseline 4947e40db109a28c1fbdcf692eb431db19d46720. Its complete tree exactly matches that baseline plus the prepared reviewed repair. Conflicts were resolved to that exact validated tree; contributor history is retained. This supersedes the earlier incomplete runtime-projection restoration and generated-reader fallback approach.

Evidence

  • Five historical-catalog assertions fail on the tested baseline and pass with the prepared repair.
  • Secretless rootless Podman validation: 190 catalog-equivalence tests, 2 installed-assets/sealed-worker tests, and 37 rollback tests passed; wrapper-inventory regression passed separately.
  • Scoped types, lint, canonical generation, formatting, whitespace, and test-line ratchet passed. Allocation is the measured 52 test lines; the shared scalar is unchanged.
  • Independent static review found no substantive findings. Exact-tree comparison and original-head ancestry were rechecked during publication; prior runtime results are reused, not claimed rerun.

Still outstanding: successful installed-updater activation across the build swap using the unchanged old reader, latest-stable upgrade with settings/data preserved, and full native end-to-end confirmation. The exact-head openclaw/ci-gate has passed; prior focused and independent-review evidence above remains applicable. Focused catalog and packaging checks do not substitute for those native end-to-end gates.

Generated SQLite catalog readers crashed reading '.tables' of undefined
when the fingerprints map knew a schema hash whose catalog entry the
loaded asset no longer contained. In-place update activation produces
exactly that pairing: the running process lazily resolves the asset path
after the build swap, and any state schema edit retires every derived
hash the predecessor chain does not pin, so databases left on an
unpinned schema crashed the updater's git-update check.

Return undefined instead; every caller already falls back to native
schema discovery for unknown hashes.
…essor chain

Adding device_pairing_browser_requests to openclaw-state-schema.sql
changed the text of every state predecessor and runtime projection,
because those derive from the current file. The regenerated catalog
pair retired every previously shipped state hash, so databases left on
one of them no longer matched a declared schema input: updates from
builds that still knew those hashes crashed on the missing catalog
before the reader guard, and refuse admission with the guard.

Register the lazy-additive edit as predecessor version 40 so the
predecessor projections return to their exact prior bytes and the
regenerated catalogs cover the shipped hashes again. The lazy table has
no user_version of its own; the key only orders the undo chain.
@clawsweeper

clawsweeper Bot commented Nov 10, 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 scripts Repository scripts size: M triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Nov 10, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 10, 2026
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR restores historical SQLite schema catalogs and makes generated readers return undefined for missing catalog entries.

Example: An installed 2026.11.1 reader requests state hash 1afe9a93ab5ff5ecdd8a5ef89f60ed9cf1246b4ffb6dd3b31bd782ca5e44ab9d after replacement assets are installed.

  • Before: The replacement catalog lacks the entry, so the old reader dereferences undefined.tables.
  • After: The regenerated asset contains that historical state catalog as state-before-v40.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Useful historical-catalog repair with a confirmed tooling regression and no supplied successful updater-boundary proof.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: A Git-source update fails during activation and rolls back instead of completing.
Reason: Restoring shipped catalog definitions has clear value, but the universal fallback claim is contradicted by admission code and historical runtime-projection compatibility remains unsettled.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this PR open: it addresses a verified catalog compatibility defect, but its new import breaks extracted PR tooling.

Priority: P1
Reviewed head: 40d1e92a6237986af573c7a35f3ca3160230a076

Before merge

  • Add real behavior proof - The supplied evidence covers predecessor lookups and a generated reader against a modified temporary asset, not successful openclaw update activation with the unchanged installed reader; provide redacted terminal output or logs of that after-fix scenario, removing IPs, API keys, phone numbers, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • [P2] Add the predecessor module to the wrapper inventory (P2) - This import extends the runtime closure of modules extracted by scripts/pr, but scripts/pr-lib/wrapper-components.txt includes only the earlier predecessor modules. Consequently an extracted wrapper cannot resolve the new module and fails before lease bootstrap or provisioning can complete. Exact-head checks-node-compact-small-3 reports both the missing inventory entry and the resulting Cannot find module failure. Add this source path to the existing inventory.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P2] [P2] Add the predecessor module to the wrapper inventory — src/state/openclaw-state-schema-runtime.ts:17

Tests

  • Missing end-to-end proof: Supply redacted successful installed-updater activation output across the build swap, including historical runtime-projection coverage and a latest-stable upgrade preserving settings and data; the added tests do not demonstrate that boundary.
Agent review details

How this fits together

Build tooling derives SQLite fingerprints and diagnostic catalogs from schema definitions; runtime admission consumes those generated facts when opening, migrating, or inspecting databases.

flowchart TD
  A[Canonical schema SQL] --> B[Predecessor transforms]
  A --> C[Catalog generator]
  B --> C
  C --> D[Embedded fingerprints]
  C --> E[Lazy catalog assets]
  D --> F[Runtime schema admission]
  E --> F
  F --> G[Database inspection and migration]
Loading

Technical review

Best possible solution:

Preserve catalogs required by installed readers through the existing generator and predecessor owners, complete the wrapper inventory, and verify activation across asset replacement.

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

Source confirms the missing-entry dereference and historical-key retirement; exact-head CI independently demonstrates the introduced wrapper import failure, and no target code was executed during this review.

Is this the best way to solve the issue?

The existing predecessor chain and generator are appropriate owners, but returning undefined does not guarantee admission recovery because expected-schema inspection requires generated facts.

Full review comments:

  • [P2] [P2] Add the predecessor module to the wrapper inventory — src/state/openclaw-state-schema-runtime.ts:17
    This import extends the runtime closure of modules extracted by scripts/pr, but scripts/pr-lib/wrapper-components.txt includes only the earlier predecessor modules. Consequently an extracted wrapper cannot resolve the new module and fails before lease bootstrap or provisioning can complete. Exact-head checks-node-compact-small-3 reports both the missing inventory entry and the resulting Cannot find module failure. Add this source path to the existing inventory.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Generated SQLite readers keeps the original intent (fd15115: Avoid repeated scratch-schema reconstruction while retaining authoritative generated compatibility checks.)
  • Shared-state predecessor chain keeps the original intent (7faf32d: Keep runtime historical admission and generated inputs on one ordered transform chain.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test test/scripts/eager-import-closure.test.ts -t "PR wrapper inventory"
  • pnpm test test/scripts/eager-import-closure.test.ts -t "acquires wrapper leases"
  • pnpm test test/scripts/pr-wrapper-source-closure.test.ts

What I checked:

Likely related people:

  • RoboClaw: Raw commit 7faf32d adds src/state/openclaw-state-schema-runtime.ts:61 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 7faf32da36cd; files: src/state/openclaw-state-schema-runtime.ts)

PR surface

Source +65, Tests +75, Other +7. Total +147 across 12 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 8 124 59 +65
Tests 2 76 1 +75
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 9 2 +7
Total 12 209 62 +147

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #196798
Summary: This PR is the proposed fix for the reporter's installed-updater catalog mismatch.

Members:

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

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The linked report establishes a repeatable source-install update failure with a matching owned-source mechanism.
  • merge-risk: 🚨 automation: The introduced import is missing from the trusted wrapper inventory and demonstrably breaks extracted tooling bootstrap.
  • merge-risk: 🚨 compatibility: Replacement catalog assets must remain consumable by an already-running installed reader; four historical runtime-projection keys remain absent.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 10, 2026, 1:47 PM ET / 18:47 UTC.

VN77-77VN pushed a commit to VN77-77VN/openclaw that referenced this pull request Nov 11, 2026
Refreshed onto upstream main cb4cd56. Carries upstream openclaw#196800 (v40,
device_pairing_browser_requests) plus the companion v41 transform for
workspace_setup_state.bootstrap_deferred, which landed after openclaw#196800 was opened.
Both edits must be reversed for a database at our 11.2 layout to stay resolvable,
otherwise the in-place activation crashes on 'catalog.tables' of undefined.
Catalogs regenerated and verified against our live layout hash.
VN77-77VN pushed a commit to VN77-77VN/openclaw that referenced this pull request Nov 11, 2026
Refreshed onto upstream main eafa247. Carries upstream openclaw#196800 (v40,
device_pairing_browser_requests) plus the companion v41 transform for
workspace_setup_state.bootstrap_deferred, which landed after openclaw#196800 was opened.
Both edits must be reversed for a database at our 11.2 layout to stay resolvable,
otherwise the in-place activation crashes on 'catalog.tables' of undefined.
Catalogs regenerated and verified against our live layout hash.
Integrate the tested main baseline and reviewed catalog repair, retaining the original PR history. Preserve the existing loader contract and register the historical module in the wrapper inventory.

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
@RomneyDa
RomneyDa merged commit 1930535 into openclaw:main Nov 12, 2026
149 of 150 checks passed
RomneyDa added a commit that referenced this pull request Nov 12, 2026
Cover required #196800 on the beta release through its retained-loader
prerequisite #197095. Cold lazy catalog reads must use the running
updater's retained generation instead of the replacement filesystem.

Source: 6ff8c86 (#197095)
Required scope: 1930535 (#196800)

The later device-pairing/bootstrap-deferred edits and v37-v40 history
are absent from this v36 branch; preserve its existing historical
catalogs rather than importing unrelated schema changes. Regenerate
all five loaders and exercise cold reads in installed and sealed assets.

Independent local review omitted by explicit release-owner direction.

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 13, 2026
…a edits and generations (openclaw#196800)

* fix(schemas): tolerate retired catalog entries in generated readers

Generated SQLite catalog readers crashed reading '.tables' of undefined
when the fingerprints map knew a schema hash whose catalog entry the
loaded asset no longer contained. In-place update activation produces
exactly that pairing: the running process lazily resolves the asset path
after the build swap, and any state schema edit retires every derived
hash the predecessor chain does not pin, so databases left on an
unpinned schema crashed the updater's git-update check.

Return undefined instead; every caller already falls back to native
schema discovery for unknown hashes.

* fix(state): pin the device-pairing browser-request edit in the predecessor chain

Adding device_pairing_browser_requests to openclaw-state-schema.sql
changed the text of every state predecessor and runtime projection,
because those derive from the current file. The regenerated catalog
pair retired every previously shipped state hash, so databases left on
one of them no longer matched a declared schema input: updates from
builds that still knew those hashes crashed on the missing catalog
before the reader guard, and refuse admission with the guard.

Register the lazy-additive edit as predecessor version 40 so the
predecessor projections return to their exact prior bytes and the
regenerated catalogs cover the shipped hashes again. The lazy table has
no user_version of its own; the key only orders the undo chain.

---------

Co-authored-by: Devin-Linux <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Git-source update from 2026.11.1 fails at activation: schema edits retire every derived catalog hash, cross-generation asset read crashes the updater

2 participants