Skip to content

fix: stop Git checkouts on 2026-11-17 main updaters from half-switching on a schema change - #204275

Merged
fuller-stack-dev merged 10 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-early-release-schema-refusal
Nov 24, 2026
Merged

fuller-stack-dev merged 10 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-early-release-schema-refusal

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Related: #203608, #203194, #201463

What Problem This Solves

Git checkouts whose installed updater was built from main between #199706 (2026-11-17) and #201917 (2026-11-19), for example a checkout at 8f80fe08cad, cannot update to current main. Their openclaw update builds the new release, switches the release link and arms a trial. It then fails with "Agent database migration did not finish". The install is left half-switched: the Gateway still serves the old build, and the link points at a release that never started. Later runs report already-current, or build another 4.6 GiB release and fail again. Published releases (2026.11.5, 2026.11.6, 2026.11.10-beta.2) keep the in-place Git updater and are not affected.

User Impact

This is a stopgap, not the full fix. It stops the strand before it happens and prints a one-time rebuild that was proven in cells. It does not recover automatically.

When one of those updaters is about to update to a release that migrates the databases, the release's own check now stops the update before the link is switched. The Gateway is not touched, and the run prints why and one command to run from the checkout:

git pull --ff-only && openclaw gateway stop --force && pnpm install --frozen-lockfile && pnpm build && openclaw gateway install --force || { openclaw gateway start; false; }

After that, openclaw on PATH is the new build, the Gateway serves it on the migrated schema, and later openclaw update runs work normally. Updates that change no schema still go through the older updater unchanged. No other install sees any change.

What still needs a person, and why:

  • Running the rebuild above, once. The installed updater runs first and cannot be patched, and the reasons below rule out finishing inside it. Its failure output already offers openclaw triage, which hands the step to a repair agent on the machine.
  • Gateway-started updates show only the generic headline. When the update starts from the Gateway (Control UI, update.run), the stored run record and the update report show only the old updater's fixed text, "The update could not load its recovery runtime (exit 1)", plus its openclaw triage hint. The full explanation is in the step's stderr, which the CLI route prints and the triage diagnostics carry.
  • The old link and first release stay on disk. git-install/lib/node_modules/openclaw and the release it names (about 4.6 GiB) are no longer used. The docs give the removal steps: delete the release directory the link names, then the link, then run git worktree prune in the checkout.

Why This Change Was Made

Root cause. It sits in the installed updater, not in the new release; the release's --check output is the same at 8f80fe08cad and on main.

Why not recover automatically. The new release's code runs inside that updater only during pnpm install / pnpm build, --check, the read-only schema inspection workers and --version.

  1. A refusal or failure in install or build sends the updater back to older commits (the candidate walk in src/infra/update-runner-git-preflight.ts at 8f80). Those commits lack any fix, so it would strand anyway. A failed --check aborts the whole update instead, so the refusal lives there.
  2. None of those hooks may migrate state, because the old Gateway is still serving it.
  3. After a migration, the updater's own process and the checkout's openclaw on PATH refuse the newer schema. The updater never rebuilds the checkout: update-runner-git-release.ts at 8f80 says "The checkout and the running release are never written".

The experiment that rules out finishing inside the old updater. Branch exp/snapshot-strand-y1 made --check report the on-disk versions, so the updater's check passed.

  • The updater moved the service to the launcher. The Gateway on the new release migrated state to 41/43 and served after one 19 s outage, with marker rows intact.
  • The run then exited 1 as post-update-failed: "Refused by OpenClaw 2026.11.4 (8f80fe0) … schema version 41; this build supports 40".
  • Every later openclaw command on PATH refused the same way, and the old-format trial stayed armed (attempts: 1).

The change.

  • src/infra/update-candidate-check-early-release.ts recognizes the early updater only by what it alone produces: the release check runs from <stateDir>/git-install/releases/<id>/build while git-install/lib/node_modules/openclaw is a symlink. Current main builds at releases/<id>/openclaw, npm and pnpm prefixes at releases/<id>/lib/node_modules/openclaw, and published updaters never build Git releases.
  • It reads the shared and agent schema versions directly through readonly_shm (no writes to the serving Gateway's WAL sidecars), from the shared registry, the agents/ directory and the agent-dir overrides. It refuses only when this release would migrate them, and never for a PostgreSQL-backed store (its local anchor has version 0; that schema migrates through the stopped-writer Doctor procedure, which this rebuild does not cover).
  • update-migrated-finalize.worker.ts --check prints the refusal to stderr and exits 1. Any read failure falls through to the normal contract.
  • No config, stored field, schema, protocol, dependency or --check contract change. Removal note: delete the module once no install can still run an updater from that window.

Relation to other work.

Evidence

Cells: Linux containers with systemd as PID 1 and a user Gateway service from openclaw gateway install, a 512 MiB agent database under 1 MiB/s of writes, marker rows checked by count and hash, a node runner started from the checkout, and synthetic state only. Installed updater 8f80fe08cad unless noted.

Recordings: red on the unmodified base 0828443372b, then green on this exact head 0ccd577bd3e. Each shows the cell run (sped up), then that run's decisive raw facts.

red-base-0828443.mp4
green-head-final.mp4

Green on this exact head: refusal exit 1 after 316 s, with the Gateway untouched; repeat 129 s. Rebuild exit 0 (269 s, Gateway outage 296 s). T+1 389 s and T+2 365 s, both exit 0, with 12.3 s and 7.0 s outages. No-op already-current in 7 s. Schema 41/43 and marker rows 1000 with the same hash throughout. git-install peaked at 14.7 GiB (the old first release plus T+1 and T+2 releases) and ended at 14.6 GiB.

Cell Start state → target Result Wall time Gateway outage Disk (git-install peak → end)
RED, base 0828443372b clean 8f80 checkout → unmodified main exit 1 openclaw doctor; half-switched (link on a never-started release, trial armed, service on checkout); repeat already-current (false) 308 s, repeat 124 s none 14.1 → 9.5 GiB
A, head clean 8f80 checkout → head exit 1, refusal shown; nothing switched; Gateway serves 2026.11.4 on 40/42; repeat refuses again (122 s) 303 s none first release 4.7 GiB stays; candidate build removed
A, rebuild the printed command Gateway and PATH openclaw on the new build; schema 41/43; marker rows 1000, hash unchanged 263 s 286 s (the build) —
D, T+1 / T+2 / no-op version-bump builds through the rebuilt checkout's updater exit 0 / exit 0 / already-current; trials committed 391 s / 381 s / 7 s 12.8 s / 10.8 s / none 14.7 → 14.6 GiB
C, half-switched stranded on pre-fix main → head true refusal (no false already-current); rebuild then T+1, T+2, no-op as above 171 s; rebuild 267 s rebuild 289 s; T+1 12.6 s; T+2 9.1 s 19.4 → 19.2 GiB
Service on launcher earlier same-schema update by 8f80 (serves 2026.11.5 from the old link) → head, with this exact rebuild command refusal; rebuild exit 0, service back on the checkout, serves 2026.11.7 on 41/43; T+1, T+2 exit 0; no-op already-current 177 s; rebuild 276 s; T+1 374 s; T+2 361 s; no-op 7 s rebuild 303 s; T+1 11.8 s; T+2 8.8 s 19.3 → 19.2 GiB
B, Gateway update.run clean 8f80 checkout → head handed to the installed CLI updater; refused; Gateway untouched 423 s none 9.4 → 4.8 GiB
Same schema (falsifier) clean 8f80 → 6691acae (schema 40/42) exit 0; service on launcher; serves 2026.11.5. This change leaves that path alone 356 s 7 s + 13 s —
Experiment clean 8f80 → on-disk versions reported see the experiment below 316 s 19.4 s —

The A and C rows ran on heads a425da8665c/2955d62788b; they differ from this head only in the printed command's last operator (; before openclaw gateway start became ||). In those runs the trailing openclaw gateway start exited 1 because the rebuilt Gateway was still migrating at boot; everything else matched.
The "service on launcher" row ran this rebuild command without the final false (|| openclaw gateway start) and it exited 0. The green recording is the clean-checkout cell rerun on this exact head.

RED, unmodified base: the updater's own output
status=error reason=openclaw doctor
step openclaw doctor: exit 1
  Shared state migration did not finish: expected schema 41, found 40.
  Agent database migration did not finish: ~/.openclaw/agents/main/agent/openclaw-agent.sqlite; expected schema 43, found 42.
step gateway recovery verification: exit 1  Expected Gateway version 2026.11.7; observed 2026.11.4.
then: legacy link -> never-started release, trial armed, service on the checkout; repeat -> skipped already-current
GREEN, head: the step the installed updater records
status=error reason=runtime-verification-failed
step candidate-recovery: exit 1
  OpenClaw 2026.11.7 migrates your databases (state schema 40 to 41, agent schema 42 to 43).
  The updater in this checkout (a main build from 2026-11-17 to 2026-11-19) cannot finish that: after the migration, neither it nor the checkout's `openclaw` command can open the migrated data.
  The update stopped before switching releases; the Gateway was not touched.
  Rebuild the checkout once from its directory; later updates then run normally:
  git pull --ff-only && openclaw gateway stop --force && pnpm install --frozen-lockfile && pnpm build && openclaw gateway install --force || { openclaw gateway start; false; }
Experiment: report on-disk versions instead (rejected)
managed-service-install 0 ... post-update verification 1
This OpenClaw build cannot open your existing data.
OpenClaw state database ~/.openclaw/state/openclaw.sqlite uses newer schema version 41; this build supports 40.
Refused by OpenClaw 2026.11.4 (8f80fe0) installed at ~/openclaw.
schema after: state 41, agent 43; Gateway ready; outage 19.4 s; trial {"attempts":1} still armed

Full raw logs are not attached because the artifact store rejects uploads from this machine (http 401).

Tests.

  • src/infra/update-candidate-check-early-release.test.ts (new) uses real SQLite files and real release layouts. It covers:
    • the refusal and its path-free command;
    • an older agent store, registered or only on disk;
    • a linked state directory;
    • pass-through when nothing migrates, when state is newer, or when it is unreadable;
    • no refusal for the current Git layout, the package layout, a missing legacy link, or a build directory elsewhere.
  • src/infra/update-migrated-finalize.worker.test.ts gains one case that runs the real --check entry against a real state fixture. It fails on base (the contract JSON is printed) and passes on head (empty stdout, exit 1, the refusal on stderr).
  • I audited both files in full. Nothing was removed; the existing --check case still proves that other callers get the unchanged contract.

Checks on head.

  • Passed: node scripts/run-vitest.mjs on the focused files and test/scripts/update-restart-module-outcome.test.ts plus test/scripts/eager-import-closure.test.ts; pnpm tsgo:core; pnpm tsgo:core:test; oxlint on the touched files; pnpm check:baseline-ratchets; the session identity ratchet; pnpm check:docs; git diff --check.
  • node scripts/check-changed.mjs fails only on dead exports in files this PR does not touch (subagent-completion-admission.store.ts, task-supervisor.ts, project-access.ts).

ClawSweeper (one round, informational). Overall D, proof C, patch D. Findings and what changed:

  • A failed in-place build can leave the checkout's build incomplete, and the trailing start hid the failure. Real. The line now ends || { openclaw gateway start; false; }, so a failure restarts the previous service and exits non-zero, and the docs say a failed pnpm build must be fixed and rerun. A service already on the launcher (the old-link release) comes back regardless; a service on the checkout stays down until the rebuild succeeds. Not covered by a cell.
  • PostgreSQL anchors are not schema versions. Real. PostgreSQL-backed stores now pass through, and the docs point them to the stopped-writer procedure.
  • Plain read-only opens touch WAL sidecars. Real. The reads now use readonly_shm, as src/update/check-release.ts does.
  • The docs lost the terminal-route note for the same-schema case. Real. Restored.

Review. An independent reviewer read the diff and the behavior contract. Its findings are fixed:

  • the updater redacts state and home paths from the step text, so the command now names no path;
  • the pull now runs before the stop;
  • every agent store is read;
  • a linked state directory is handled;
  • the wording is truthful;
  • the docs remedy is included.

Its concern that the old link would become the next trial's fallback did not hold: the first update after the rebuild falls back to the rebuilt checkout. autoreview does not run on this machine.

Update proof rules (#203915), from the cells' raw logs.

  • Route: every CLI update step was a plain openclaw update --yes, and the installed updater's own runs record trigger cli. Row B started the update with openclaw gateway call update.run; its RPC --timeout 120000 is the call's own wait, not an update --timeout. The green cell on the exact head (AF3) records trigger api for the rebuilt checkout's T+1 and T+2 runs, and its journal has [gateway] update.run <runId> actor=gateway-client for T+1, T+2 and the no-op run. No OPENCLAW_UPDATE_PACKAGE_SPEC, --tag, --no-restart or shortened update --timeout was used.
  • Service: the Gateway unit comes from openclaw gateway install, and the rebuild reinstalls it with openclaw gateway install --force. In AF3 the rebuild step ended || openclaw gateway start without the { …; false; } group; that group runs only when an earlier step fails, and every step succeeded (rebuild exit 0). After each step the cell saved the unit's ExecStart (systemctl --user cat), the release link, .trial and the checkout worktrees. NeedDaemonReload was not captured.
  • Freshness: each recording names its commit (base 0828443372b, head 0ccd577bd3e). Public npm view openclaw dist-tags at landing: latest 2026.11.7, beta 2026.11.10-beta.2, extended-stable 2026.10.33. Published packages do not reach this code path (see Not proven).
  • Next build: the refused target itself migrates the schema (state 40 to 41, agent 42 to 43), which is the case under test. T+1 and T+2 after the rebuild are version-bump-only builds, so they prove the later switches and not a further migration or rollback.
  • Installed code: the change does not touch src/update/launcher.ts, run.ts, preflight.ts or convert-service.ts. The cells still ran T+1 and T+2 through the rebuilt checkout's updater.
  • Platforms: only Linux systemd user services ran. A Linux container without a user bus, the macOS LaunchAgent and the Windows Scheduled Task are unproven.

Not proven

  • macOS/launchd. The service stop, start and install steps and the Gateway's boot migration timing are service-manager specific; only Linux systemd user services ran.
  • Installs whose agent stores sit at different schema versions run the refusal on the oldest one; not run in a cell.
  • Published npm/pnpm updaters were not rerun. The keying cannot match them (unit test), and they never run this code path from a build directory.
  • Separate defects seen on a pure-main checkout, outside this change: listed in the review notes and not fixed here.

@clawsweeper

clawsweeper Bot commented Nov 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M labels Nov 23, 2026
@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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 23, 2026
@clawsweeper

clawsweeper Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The PR stops affected early Git-release updaters before a schema-changing activation and prints a documented rebuild command.

Example: A Git checkout built at 8f80fe0 updates from state/agent schemas 40/42 to 41/43.

  • Before: The updater switches the release link, then rejects the unmigrated databases while the old Gateway continues serving.
  • After: The target's check refuses before activation, leaves the Gateway serving, and prints the one-time rebuild procedure.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful prevention fix with production-path Linux evidence, preserved existing contracts for other callers, and no actionable correctness finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): Public terminal excerpts exercise the real installed updater and target --check boundary, showing the original schema failure and the after-fix refusal; recorded Linux systemd cells cover clean and stranded installs, rebuilding, marker preservation, and later successful updates. macOS recovery remains explicitly unproven.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Affected Git installs repeatedly fail upgrades and can report already-current while their Gateway still serves the old build.
Reason: Prevention has clear value for an observed installation shape, and the maintainer-authored proposal explicitly chooses the limited manual-recovery approach.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it prevents a verified failure in old installed Git updaters that current-main updater fixes cannot reach retroactively. No actionable introduced defect was found.

Priority: P2
Reviewed head: 0ccd577bd3e82ba5c9dfe12f7a685a58ba6791b9

Before merge

None.

Findings

None.

Agent review details

How this fits together

An installed updater invokes the target release's migrated-finalizer check before activation; this check normally returns capability JSON and now returns a diagnostic failure for the affected old layout when SQLite schemas need migration.

flowchart TD
  A[Installed Git updater] --> B[Build target release]
  B --> C[Target finalizer check]
  C --> D[Inspect layout and SQLite versions]
  D --> E[Continue existing update]
  D --> F[Refuse and print rebuild]
  F --> G[Operator rebuilds checkout]
Loading

Technical review

Best possible solution:

Merge the narrowly keyed refusal and documented rebuild after the existing CI gates pass.

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

Historical updater source and the supplied Linux failure trace establish the half-switch path; this read-only review ran no target code.

Is this the best way to solve the issue?

The existing pre-activation check is the smallest reachable owner for prevention because the installed updater cannot be rewritten by its target, and the patch avoids introducing another recovery executor.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Candidate finalizer check keeps the original intent (d1a69c0: Validate the target recovery runtime and expose its capabilities before activation; later changes preserve machine-readable stdout.)
  • Historical Git-layout recovery guidance changes intended behavior with a stated reason (e60ea9f: The Git upgrade-survivor scenario supported two terminal updates to escape the node_modules layout; this PR explains why schema-changing targets instead require a checkout rebuild.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit 2ef6f7b adds docs/install/updating.md:1854 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2ef6f7bade7c; files: docs/install/updating.md)

PR surface

Source +120, Tests +177, Docs +20. Total +317 across 5 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 2 120 0 +120
Tests 2 177 0 +177
Docs 1 25 5 +20
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 322 5 +317

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.

Labels

Label changes:

  • add P2: The change prevents repeated failed upgrades in a narrow historical main-build population using an advanced Git installation workflow.
  • add merge-risk: 🚨 compatibility: The check intentionally refuses previously attempted upgrades for the affected installed updaters; the maintainer-authored PR accepts that boundary and supplies the manual rebuild path.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The change prevents repeated failed upgrades in a narrow historical main-build population using an advanced Git installation workflow.
  • merge-risk: 🚨 compatibility: The check intentionally refuses previously attempted upgrades for the affected installed updaters; the maintainer-authored PR accepts that boundary and supplies the manual rebuild path.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 23, 2026, 6:34 PM ET / 23:34 UTC.

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Proof recordings for this PR. Linux container with systemd as PID 1 and a user Gateway service; installed updater 8f80fe08cad; 512 MiB agent database under writes; synthetic state only. Each video is the cell run (sped up), then the decisive raw facts read from that run's artifacts.

RED, unmodified base 0828443372b: openclaw update fails with openclaw doctor ("Agent database migration did not finish"), leaves the install half-switched, and the repeat reports already-current while the Gateway still serves 2026.11.4.

red-base-0828443.mp4

GREEN, exact head 0ccd577bd3e: the update stops at the release check with the explanation and the rebuild line, nothing is switched, and the Gateway keeps serving. The printed rebuild exits 0. The Gateway and openclaw on PATH run 2026.11.7 on schema 41/43 with marker rows intact. T+1 and T+2 succeed with 12.3 s and 7.0 s outages, and the no-op takes 7 s. The final openclaw doctor --fix exit 1 is a separate defect on main; the PR body says so.

green-head-final.mp4

Full raw logs are not attached because the artifact store rejects uploads from this machine.

@fuller-stack-dev
fuller-stack-dev merged commit 8b16765 into openclaw:main Nov 24, 2026
144 of 145 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

@fuller-stack-dev
fuller-stack-dev deleted the fix/update-early-release-schema-refusal branch November 24, 2026 00:05
tideclaw-bot pushed a commit that referenced this pull request Nov 24, 2026
Closes #204085

Every release-path update that changes the state schema fails on Windows today: the startup swap renames over the live SQLite files while retained handles are still open. This also affects a successful migration chain, not only its generic-copy fallback (`state-upgrade.ts:566–584,660–663`). The launcher restores the previous release, but the update cannot complete. Shipped first hops use their existing in-place update route and are not affected by this release-path defect.

The candidate releases its closed databases' retained file descriptors before the startup swap. The Windows task supervisor now skips Gateway state and config bootstrap entirely, so it holds no database connection while its child runs. The child still loads its own dotenv files and selects its database and environment. Migration and rollback keep their existing owners and preserved files. There is no schema change or new user action.

An interrupted Windows swap that already created `.pre-*` hard links can still retain admission custody and roll back; this existing, visible recovery edge is unchanged.

Closing SQLite leaves the admission owner's identity descriptor open. A native Windows control reproduces the failure with both SQLite connections closed, then permits the same rename immediately after the existing admission-retirement operation runs. The durable swap now performs that retirement for both database paths before it preserves or replaces either file.

The next open must admit the replacement's physical identity again. The launcher, trial budget, attempts, rollback policy, and SQLite file-sharing mode are unchanged. This requires the candidate fix, not a new installed launcher.

The real Windows replay exposed a second holder: the waiting task supervisor had opened the shared database during Gateway pre-bootstrap. Its only job is to launch and wait for the real Gateway. Supervisor dispatch now happens before SQLite runtime, dotenv, database-engine selection, and Gateway environment selection. The late dispatch is removed.

- Original real Control UI failure: run `4adf1716-1734-4ed5-9eee-38083120fdfc`, two starts, schema 41→42 attempt, both blocked at the canonical WAL; the previous release served after rollback.
- Native Windows reproduction on Azure: a candidate with isolated state holds its own live and prepared file descriptors when replacement fails. No supervisor targets that isolated state.
- Product-API causal control on that lease:
  ```json
  {"file":"live.sqlite","nativeClosed":true}
  {"file":"next.sqlite","nativeClosed":true}
  {"beforeRetirement":"refused","code":"EPERM","syscall":"rename"}
  {"afterRetirement":"renamed"}
  ```
- One swap-owner regression checks descriptor release, new database contents, and the preserved old contents.
- AWS Linux run [`run_604041d54425b8c7e03ba43362072ac2`](https://crabbox.openclaw.ai/portal/runs/run_604041d54425b8c7e03ba43362072ac2): all 46 focused tests passed; the new regression fails on the base because the two descriptors remain retained (not a setup failure).
- Final-head T, next and crash full distribution builds, repository packing, and archive identity/SHA-256 checks passed in AWS run [`run_60ba70a2d1888c2d832aef9a1c6c3665`](https://crabbox.openclaw.ai/portal/runs/run_60ba70a2d1888c2d832aef9a1c6c3665). The corrected fixture declares its predecessor/runtime catalog inputs before generation.
- AWS run [`run_1af4700e569a25502494c17898d4839d`](https://crabbox.openclaw.ai/portal/runs/run_1af4700e569a25502494c17898d4839d): all 37 run-main tests passed; both new supervisor cases fail on clean main base `38f4f8fe018c` because the supervisor enters SQLite startup. Final parser consumer replay [`run_e6e98aa9e306b3332caadeefe5a8615c`](https://crabbox.openclaw.ai/portal/runs/run_e6e98aa9e306b3332caadeefe5a8615c) passes `cli-root-options` and `run-main`. Final-head local review and CI are owned by the lead.
- Fixed candidate-only Windows click on `3c150b5bfa`, run `36fec6f8-d822-409f-9f00-dfb6633e0d70`, still rolled back after two canonical-WAL `EPERM` failures. Native samples every two seconds show the old task supervisor retaining that WAL across candidate starts. Final head `69f58bc4e8` includes the early, database-free supervisor dispatch, its owner regression, and the preserved ordinary parser result.
- **Windows migrating UI update passed:** run `47295f8d-1098-407b-ac2d-160cdca32158`, committed on its first start, T+1 build `0322afdd098e` serving, shared schema 42 and the new STRICT table present. The startup log explicitly reports `by migration chain`. Across 491 native `openclaw.sqlite` handle samples, task-supervisor PID 404 has zero matching lines; other processes have 12,165 matching lines, confirming the sampler was active.
- **Linux chain-mode UI update passed:** run `137ae66a-ab63-4c64-af4b-9c90ee345278`, committed on its first start, T+1 serving schema 42 with the STRICT table. The startup journal explicitly reports `by migration chain`, not generic copy.
- The retained Doctor log explains the old fixture's generic-copy fallback: its schema-41 predecessor catalog was undeclared. Earlier Linux and macOS proof used that fallback. Those runs are not counted as chain-mode proof; the corrected final-head passes above are.

Crash rollback plus healthy recovery, and reboot-before-candidate recovery, cover paths this PR does not change; they run as follow-up proof after merge. Optional plugin maintenance refused old-Gateway-owned schema mutation in the passing runs; those advisory/plugin/channel checks are not claimed as passed.

The swap repair reuses admission retirement. The supervisor repair removes its unnecessary Gateway bootstrap. There is no new user-facing API, flag, configuration, retry, timer, or stored state.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit e2973f9)
Release adaptation: Place the custody regression before the baseline-only legacy registry fixture and integrate the startup contract in the baseline update docs. Retain the in-place update flow. Fold in only the supervisor dead-export cleanup and its test consumers from #204246.
Release companions: #204246 supervisor-only cleanup included; #204224 IPC release launcher and #204127 prepared-release plugin maintenance not applicable (src/update absent). #204275 early-main Git release check and #204253 reporting-only changes are independent, not required. #204230 and #204299 SHA mentions unrelated.
Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 24, 2026
…tate database (#203578)

* fix(update): refuse migrating updates while a node service keeps the state open

Refs #203457

* docs(update): explain the node-service migration refusal

Refs #203457

* fix(update): match the node service's own state directory by filesystem identity

A default node service omits the state selector and must not inherit the updater's; path aliases name one directory. Refs #203457

* fix(update): refuse every activation while a node service keeps the state open

Update Doctor takes native exclusion of openclaw.sqlite on every activation, including patch updates without a schema change (#203457 reported 2026.11.5 -> 2026.11.6, both schema 36). Refuse whenever a running, kind-marked node service resolves to the same state directory, not only for pending migrations. Refs #203457

Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit 19fcba1)

Release adaptation: retain stable captureUpdateActivationSchemas destructuring and check node ownership only before first mutation, so Git revalidation after mutation does not report a pre-mutation refusal. Keep stable preparatory staging and check before any Gateway stop or installed activation.

Release adaptation: keep only the node-service docs and regression in the conflict regions; the separate Gateway migration admission (#203170) is not a prerequisite and remains outside the lane.

Companion audit: no later PR or SHA mentions through 665c286. #203497 (future package preparation) is not needed; the existing stable package/Git activation hooks already share the pre-stop boundary. #203981 is selected elsewhere and already present at lane base (f6ad5b5). Later #204275, #204253, #204224, #204127, #204094, #204095, #204151, #204054, #203994, #203990, #203917, #203959, #203926, #203925, #203915, #203914, #202934 and #203735 are not applicable as companions: independent Git, rollback, Doctor/recovery, plugin, output, docs and host changes do not supply or consume node-service admission.

Validation: two same-state activation cases red on f6ad5b5 (wrongly reached mutation), three controls passed; all 73 tests in update-command-execution.test.ts passed with the fix.

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 24, 2026
…ng on a schema change (openclaw#204275)

* fix(update): stop early Git release updaters before a schema change they cannot finish

* fix(update): name a path-free rebuild and read every agent store

* fix(update): rebind the service before Doctor in the printed rebuild

* refactor(update): keep the rebuild text private to its check

* fix(update): let the rebuilt Gateway migrate state instead of a racing Doctor

* fix(update): restart the previous service only when the rebuild fails

* fix(update): leave PostgreSQL stores and live sidecars alone and keep a failed rebuild visible
obviyus added a commit that referenced this pull request Nov 24, 2026
## Problem
The release update survivor changes package metadata but does not build a successor or migrate state. It is also absent from relevant PR CI. This leaves the normal update/trial/schema path to one-off host proofs.

Class A (proof debt), owner: existing upgrade-survivor lane. Known instances: #203735, #203769, #204094, #204224, #204426, #204512, #204275. This closes the missing-proof class, not each incident's separate runtime cause.

## Change
- Replace the metadata repacker with a real same-source T+1 build, a distinct build ID, and a disposable schema N+1 migration using the normal SQLite/PostgreSQL schema generator.
- Extend `release-update-survivor`: npm-global T and normal `openclaw update` delegated to the Gateway. Require a healthy committed trial, the new serving build, schema N+1, and non-empty sentinel row contents/counts. The crash-after-migration case is split into the StoreCustody product-fix PR, where the same strict rollback assertions must pass; it is not made report-only here.
- Select it for update/state/update-CLI/launcher/harness owners inside the existing Docker seed job. Named failure artifacts now include the trial, latest 20 update rows, readiness/schema observations, and a bounded combined Gateway/launcher journal. Environment dumps remain excluded.

No shipped schema, production source, install behavior, runner size, concurrency cap, or new job is changed. The fixture changes scratch source only. The old metadata/inventory-rehash path is removed. Existing Git and published-version lanes cover other contracts and remain.

## Cost and line count
One extra source build and one Linux npm container update; 40-minute lane ceiling and existing 20-minute container ceiling. Normal manual CI retains its existing six-lane seed profile and 115-minute budget; Full Package Acceptance already owns this lane separately. Relevant PRs can newly select one existing Docker seed runner. The conservative 21-PR envelope becomes 5,131 registrations versus the 6,000 operating target (10,000 bucket).

Production source delta is **0**. `tokei` on this PR's five changed script files, excluding tests: **2,113 → 2,337 code lines (+224)** at base `d4c6c46e32aed4018592e4b0fcc32ab6aa3fb271`, healthy-only head `faf9a9b01fecacb643bc201eeedd4317f8456604`. This is the authorized Class A proof exception; direction beats line count. The metadata/inventory-rehash path is gone; no unrelated code was removed for a quota.

## Evidence and remaining gate
- On head `123a9a40aa67c38e6ccff3bd9fb978545d1bb84a`, [run 45415579743](https://github.com/openclaw/openclaw/actions/runs/45415579743) passed the healthy case: API trigger, committed trial, distinct serving build, schema **42**, two preserved/migrated rows. The CLI switch took **148,733 ms**.
- The earlier full lane failed its crash case after **2,161 s (36m01s)**: CLI exit 1 was followed by no terminal ledger result for 12 minutes. That real product failure belongs to StoreCustody. Per maintainer direction, the entire crash hook/case/artifact contract was extracted, not weakened or allowed to fail. The exact restoration patch was handed to StoreCustody and applies cleanly to this healthy-only head.
- Valid negative control: closed, unmerged #204693, [run 45418885332](https://github.com/openclaw/openclaw/actions/runs/45418885332), head `0616b4dd680fc873a147f31680a8d87c5492f0c0`. The omitted candidate migration left sentinel a/b instead of `migrated=true`; the unchanged row-content assertion failed at line 231. Both sides have SQLite's null prototype. Lane duration **1,193 s (19m53s)**.
- Shared T package preparation took **7m48s** on hosted Ubuntu. Earlier positive/negative receipts above are from frozen earlier heads; removing the dormant crash hook does not change their healthy migration assertions.
- AWS owner tests and source builds ran; the AWS lease was released with `--wait`. Two local reviews found no correctness/security findings on earlier heads. The split is pure crash-case extraction plus a copied-artifact permission fix; no third broad review was added under the two-round policy.
- Failure collection remains strict and allowlisted. Only the container-owned copied trial is chmod 0644 so the artifact uploader can read it; the product's live trial stays 0600.
- New healthy-only head `faf9a9b01fecacb643bc201eeedd4317f8456604`: [CI 45473893182](https://github.com/openclaw/openclaw/actions/runs/45473893182) is running. Final green duration is not yet claimed.
- The completed compact-small-11 job has the known upstream planner-fixture failure: `ci-node-test-plan.test.ts:1852`, expected four groups/got five, 173 passed/1 failed. The single canonical clean-main AWS proof on `269f88452ac261cec1d8e99e7b740cedfe341161` reproduced it ([run_266010a78ce4d0e864cfa9f696fd7f68](https://crabbox.openclaw.ai/portal/runs/run_266010a78ce4d0e864cfa9f696fd7f68)). No duplicate baseline run or fixture change. [Scoped Maintainer override](#204685 (comment)) does not waive the healthy Docker lane.

Land only when the healthy-only Docker lane and other scoped checks pass, apart from the documented upstream planner-fixture override. Class B is already merged. Schema-read reporting and the three enforcement stages are separate follow-up PRs; Node routing was split into merged #204830 (44 Git release tests executed, zero skipped).

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Nov 25, 2026
…204883)

## Class A — previous-reader enforcement, stage 1

Follow-up to merged #204685 and #204830; coordination #204775. Existing owner: upgrade-survivor. Instances behind the proof-debt class: #203735, #203769, #204094, #204224, #204426, #204512, #204275. This adds proof, not claims to fix those separate runtime causes.

## Contract

- Keep the merged healthy head → synthetic-next update lane. Its retained T also reports shared-schema readability from an isolated online backup (`readable`, `refused`, `unproven`), without changing the update result.
- For actual schema-version/production-migration diffs, build T from the PR fork point and reuse CI's tested merge-tree package as T+1. Record both source/build identities.
- Seed shared cron and agent sessions/history through T's real Gateway writers. Stop T, retain raw preimages, boot T+1, stop it at the exact Gateway TCP listen boundary, then hard-kill/reap its process group.
- Inspect DB/WAL/SHM **copies** after the kill. Advanced stores must have committed target schemas and valid floors; untouched lazy stores are named as untouched. Integrity/setup failures always fail.
- Project actual rollback state: restore only raised-floor stores from T's preimages, preserve other candidate-written store bytes, then authenticate to genuine T and read the seeded cron/session/history data. Compatibility becomes required when candidate source includes ReaderFloor's contract; absent/NULL floor metadata is valid and is not mistaken for missing capability.

No production code/schema change, down-migration, fake success receipt, production startup hook, or committed `src/update`/`src/state` edit. StoreCustody owns the separate normal-update crash case; this PR does not reintroduce the old red case. Bulk-access enforcement and the 10 GB nightly are stages 2 and 3, not claimed here.

## Cost and simplification

One extra previous-source build only for schema/migration diffs; no new CI job, runner tier or fanout. Existing lane ceiling rises 40 → 55 min; per-container ceiling stays 20 min and the existing seed job stays 115 min. Explicit downgrade qualification skips the unrelated synthetic successor build. Actual additional runtime is not measured yet.

The previous-reader report's duplicate process supervisor is deleted; seeder, report and downgrade share one bounded process-group owner. Separate modules own source preparation, real RPC fixture, crash barrier, physical store observations/projection and the controller; none ships in the product. These are the smallest coherent pieces of the approved pre-ready oracle, not a second updater.

Final PR-owned `tokei code` against pinned main `f36e439d70772464e10f66182e05e52e99e22663`: production **0 → 0**; scripts **2,116 → 3,516 (+1,400)**; tests **8,797 → 9,175 (+378)**. Net raw test growth is **394 / 400**, allocation **0**. The duplicate SQLite fixture factory/mixed-projection case is gone; byte preservation and restored-content assertions remain in the single suite. No unrelated deletions, suppression allowlist entries or Knip ignores were added.

## Evidence and current gate

Ready for review; published head `ead509c7f0fdd54096923f7cc11b0d7df2d824ec`, with the required CI watchdog armed. Do not treat prior-head runtime proof as a final CI result. Subsequent changes affect typing, unit fixtures, lint and typed failure receipts, not the successful migration/projection path.

- Healthy update and schema-read observation on `1f0cdf960f0c`: AWS [run_8fc9ebd67a55f3ac853523dc53dd7100](https://crabbox.openclaw.ai/portal/runs/run_8fc9ebd67a55f3ac853523dc53dd7100). Committed/reported trial `e7846307-c5b3-48eb-97c4-c8c0bdfd4455`, schema42, two rows; CLI153097ms. Verified old T refused the isolated new shared schema with exit78; backup stayed schema42. This is the requested report, not an accepted downgrade refusal.
- Genuine pre-ready qualification on `55efd824fc82`: AWS [run_2c8997c1c413a76556c9a07c640be21b](https://crabbox.openclaw.ai/portal/runs/run_2c8997c1c413a76556c9a07c640be21b). Actual d4c6c46 source T→published candidate: both agents43→44 before candidate SIGKILL; raised stores restored, shared41 byte-preserved. Config preimage restored atomically: before/restored SHA `74a6c60183b06ccb29deda5eb80de98ae113767aa9e3d232f10c8c8f8c641387`, candidate SHA `076aa2f7d5f926c7998edbb5afeb18a48b42161dee8acf79ad5498371e803b0f`. **Genuine T served, its build ID matched, and both exact histories and the cron sentinel passed.** This older-writer qualification is not a claim that d4 is this PR's fork point.
- ReaderFloor's independent [#204880](#204880) size-loss/config-provenance case remains known ([run_5eaf078abca514a139d8c599b2092035](https://crabbox.openclaw.ai/portal/runs/run_5eaf078abca514a139d8c599b2092035)). Our different fixture passing does not clear it. Rollout remains report-only until the reader-floor/recovery fix lands; no override flag, backup deletion or unraised-database restore was added.
- The genuine proof's full build and14 owner tests passed. After the test consolidation, exact published `55ff2e4cfa76` AWS [run_c243aab4f60386a030d0fa6e81cb65a0](https://crabbox.openclaw.ai/portal/runs/run_c243aab4f60386a030d0fa6e81cb65a0) passed selected canonical type graphs, **11 focused tests**, and the **391/400** test-line ratchet.
- Two full source reviews (`43bd8ae1016a`, `55efd824fc82`) found zero findings, patch correct, security cleared. Exact final-head review of **only the later repair delta** `55efd824fc82..ead509c` also completed clean (zero findings/security cleared); this is not a third full-range audit or release rebuild.
- Complete changed-file format, lint, scripts/test-root types and guards passed in AWS [run_69e9eb1d2d90257c64d462065092464e](https://crabbox.openclaw.ai/portal/runs/run_69e9eb1d2d90257c64d462065092464e). That full canonical command also reported a CLI-only harness export (now private) and pinned-production `src/gateway/operator-admission.ts:intersectOperatorRunModelPolicy`, which this PR does not modify. Previous head `18be57a08bda` [run_7ebfa24dbd0e08ea4509fd93887a6ae3](https://crabbox.openclaw.ai/portal/runs/run_7ebfa24dbd0e08ea4509fd93887a6ae3) then passed the canonical script-Knip profile, **11 tests** and **394/400** line ratchet. No full-command green or current-main reproduction of the production finding is claimed; final PR CI is authoritative.
- Exact waiver-free final head AWS [run_14b6d54ff040f3eda60ba6620d8a44f7](https://crabbox.openclaw.ai/portal/runs/run_14b6d54ff040f3eda60ba6620d8a44f7) passed scoped canonical scripts lint/typecheck, **25 tests** (11 downgrade boundaries plus the suppression guard), and **394/400** line ratchet. The two annotations were removed using explicit reflective receiver handling and existing protocol destructuring, not allowlisted. All owned AWS leases released with `--wait`.

Fable challenged the design before code. Bulk-access enforcement and the real10GB nightly remain the approved subsequent stages, not claimed by this PR.

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 25, 2026
## Problem
The release update survivor changes package metadata but does not build a successor or migrate state. It is also absent from relevant PR CI. This leaves the normal update/trial/schema path to one-off host proofs.

Class A (proof debt), owner: existing upgrade-survivor lane. Known instances: #203735, #203769, #204094, #204224, #204426, #204512, #204275. This closes the missing-proof class, not each incident's separate runtime cause.

## Change
- Replace the metadata repacker with a real same-source T+1 build, a distinct build ID, and a disposable schema N+1 migration using the normal SQLite/PostgreSQL schema generator.
- Extend `release-update-survivor`: npm-global T and normal `openclaw update` delegated to the Gateway. Require a healthy committed trial, the new serving build, schema N+1, and non-empty sentinel row contents/counts. The crash-after-migration case is split into the StoreCustody product-fix PR, where the same strict rollback assertions must pass; it is not made report-only here.
- Select it for update/state/update-CLI/launcher/harness owners inside the existing Docker seed job. Named failure artifacts now include the trial, latest 20 update rows, readiness/schema observations, and a bounded combined Gateway/launcher journal. Environment dumps remain excluded.

No shipped schema, production source, install behavior, runner size, concurrency cap, or new job is changed. The fixture changes scratch source only. The old metadata/inventory-rehash path is removed. Existing Git and published-version lanes cover other contracts and remain.

## Cost and line count
One extra source build and one Linux npm container update; 40-minute lane ceiling and existing 20-minute container ceiling. Normal manual CI retains its existing six-lane seed profile and 115-minute budget; Full Package Acceptance already owns this lane separately. Relevant PRs can newly select one existing Docker seed runner. The conservative 21-PR envelope becomes 5,131 registrations versus the 6,000 operating target (10,000 bucket).

Production source delta is **0**. `tokei` on this PR's five changed script files, excluding tests: **2,113 → 2,337 code lines (+224)** at base `d4c6c46e32aed4018592e4b0fcc32ab6aa3fb271`, healthy-only head `faf9a9b01fecacb643bc201eeedd4317f8456604`. This is the authorized Class A proof exception; direction beats line count. The metadata/inventory-rehash path is gone; no unrelated code was removed for a quota.

## Evidence and remaining gate
- On head `123a9a40aa67c38e6ccff3bd9fb978545d1bb84a`, [run 45415579743](https://github.com/openclaw/openclaw/actions/runs/45415579743) passed the healthy case: API trigger, committed trial, distinct serving build, schema **42**, two preserved/migrated rows. The CLI switch took **148,733 ms**.
- The earlier full lane failed its crash case after **2,161 s (36m01s)**: CLI exit 1 was followed by no terminal ledger result for 12 minutes. That real product failure belongs to StoreCustody. Per maintainer direction, the entire crash hook/case/artifact contract was extracted, not weakened or allowed to fail. The exact restoration patch was handed to StoreCustody and applies cleanly to this healthy-only head.
- Valid negative control: closed, unmerged #204693, [run 45418885332](https://github.com/openclaw/openclaw/actions/runs/45418885332), head `0616b4dd680fc873a147f31680a8d87c5492f0c0`. The omitted candidate migration left sentinel a/b instead of `migrated=true`; the unchanged row-content assertion failed at line 231. Both sides have SQLite's null prototype. Lane duration **1,193 s (19m53s)**.
- Shared T package preparation took **7m48s** on hosted Ubuntu. Earlier positive/negative receipts above are from frozen earlier heads; removing the dormant crash hook does not change their healthy migration assertions.
- AWS owner tests and source builds ran; the AWS lease was released with `--wait`. Two local reviews found no correctness/security findings on earlier heads. The split is pure crash-case extraction plus a copied-artifact permission fix; no third broad review was added under the two-round policy.
- Failure collection remains strict and allowlisted. Only the container-owned copied trial is chmod 0644 so the artifact uploader can read it; the product's live trial stays 0600.
- New healthy-only head `faf9a9b01fecacb643bc201eeedd4317f8456604`: [CI 45473893182](https://github.com/openclaw/openclaw/actions/runs/45473893182) is running. Final green duration is not yet claimed.
- The completed compact-small-11 job has the known upstream planner-fixture failure: `ci-node-test-plan.test.ts:1852`, expected four groups/got five, 173 passed/1 failed. The single canonical clean-main AWS proof on `269f88452ac261cec1d8e99e7b740cedfe341161` reproduced it ([run_266010a78ce4d0e864cfa9f696fd7f68](https://crabbox.openclaw.ai/portal/runs/run_266010a78ce4d0e864cfa9f696fd7f68)). No duplicate baseline run or fixture change. [Scoped Maintainer override](#204685 (comment)) does not waive the healthy Docker lane.

Land only when the healthy-only Docker lane and other scoped checks pass, apart from the documented upstream planner-fixture override. Class B is already merged. Schema-read reporting and the three enforcement stages are separate follow-up PRs; Node routing was split into merged #204830 (44 Git release tests executed, zero skipped).

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit e2ac431)
Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 25, 2026
…04685)

## Problem
The release update survivor changes package metadata but does not build a successor or migrate state. It is also absent from relevant PR CI. This leaves the normal update/trial/schema path to one-off host proofs.

Class A (proof debt), owner: existing upgrade-survivor lane. Known instances: openclaw#203735, openclaw#203769, openclaw#204094, openclaw#204224, openclaw#204426, openclaw#204512, openclaw#204275. This closes the missing-proof class, not each incident's separate runtime cause.

## Change
- Replace the metadata repacker with a real same-source T+1 build, a distinct build ID, and a disposable schema N+1 migration using the normal SQLite/PostgreSQL schema generator.
- Extend `release-update-survivor`: npm-global T and normal `openclaw update` delegated to the Gateway. Require a healthy committed trial, the new serving build, schema N+1, and non-empty sentinel row contents/counts. The crash-after-migration case is split into the StoreCustody product-fix PR, where the same strict rollback assertions must pass; it is not made report-only here.
- Select it for update/state/update-CLI/launcher/harness owners inside the existing Docker seed job. Named failure artifacts now include the trial, latest 20 update rows, readiness/schema observations, and a bounded combined Gateway/launcher journal. Environment dumps remain excluded.

No shipped schema, production source, install behavior, runner size, concurrency cap, or new job is changed. The fixture changes scratch source only. The old metadata/inventory-rehash path is removed. Existing Git and published-version lanes cover other contracts and remain.

## Cost and line count
One extra source build and one Linux npm container update; 40-minute lane ceiling and existing 20-minute container ceiling. Normal manual CI retains its existing six-lane seed profile and 115-minute budget; Full Package Acceptance already owns this lane separately. Relevant PRs can newly select one existing Docker seed runner. The conservative 21-PR envelope becomes 5,131 registrations versus the 6,000 operating target (10,000 bucket).

Production source delta is **0**. `tokei` on this PR's five changed script files, excluding tests: **2,113 → 2,337 code lines (+224)** at base `ad98b9e7f734c00759f4a2bf776dce718a66bd0a`, healthy-only head `faf9a9b01fecacb643bc201eeedd4317f8456604`. This is the authorized Class A proof exception; direction beats line count. The metadata/inventory-rehash path is gone; no unrelated code was removed for a quota.

## Evidence and remaining gate
- On head `123a9a40aa67c38e6ccff3bd9fb978545d1bb84a`, [run 45415579743](https://github.com/openclaw/openclaw/actions/runs/45415579743) passed the healthy case: API trigger, committed trial, distinct serving build, schema **42**, two preserved/migrated rows. The CLI switch took **148,733 ms**.
- The earlier full lane failed its crash case after **2,161 s (36m01s)**: CLI exit 1 was followed by no terminal ledger result for 12 minutes. That real product failure belongs to StoreCustody. Per maintainer direction, the entire crash hook/case/artifact contract was extracted, not weakened or allowed to fail. The exact restoration patch was handed to StoreCustody and applies cleanly to this healthy-only head.
- Valid negative control: closed, unmerged openclaw#204693, [run 45418885332](https://github.com/openclaw/openclaw/actions/runs/45418885332), head `0616b4dd680fc873a147f31680a8d87c5492f0c0`. The omitted candidate migration left sentinel a/b instead of `migrated=true`; the unchanged row-content assertion failed at line 231. Both sides have SQLite's null prototype. Lane duration **1,193 s (19m53s)**.
- Shared T package preparation took **7m48s** on hosted Ubuntu. Earlier positive/negative receipts above are from frozen earlier heads; removing the dormant crash hook does not change their healthy migration assertions.
- AWS owner tests and source builds ran; the AWS lease was released with `--wait`. Two local reviews found no correctness/security findings on earlier heads. The split is pure crash-case extraction plus a copied-artifact permission fix; no third broad review was added under the two-round policy.
- Failure collection remains strict and allowlisted. Only the container-owned copied trial is chmod 0644 so the artifact uploader can read it; the product's live trial stays 0600.
- New healthy-only head `faf9a9b01fecacb643bc201eeedd4317f8456604`: [CI 45473893182](https://github.com/openclaw/openclaw/actions/runs/45473893182) is running. Final green duration is not yet claimed.
- The completed compact-small-11 job has the known upstream planner-fixture failure: `ci-node-test-plan.test.ts:1852`, expected four groups/got five, 173 passed/1 failed. The single canonical clean-main AWS proof on `0ef684ebc6840c92d9ae493cfe64b390acd90e49` reproduced it ([run_266010a78ce4d0e864cfa9f696fd7f68](https://crabbox.openclaw.ai/portal/runs/run_266010a78ce4d0e864cfa9f696fd7f68)). No duplicate baseline run or fixture change. [Scoped Maintainer override](openclaw#204685 (comment)) does not waive the healthy Docker lane.

Land only when the healthy-only Docker lane and other scoped checks pass, apart from the documented upstream planner-fixture override. Class B is already merged. Schema-read reporting and the three enforcement stages are separate follow-up PRs; Node routing was split into merged openclaw#204830 (44 Git release tests executed, zero skipped).

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 25, 2026
…penclaw#204883)

## Class A — previous-reader enforcement, stage 1

Follow-up to merged openclaw#204685 and openclaw#204830; coordination openclaw#204775. Existing owner: upgrade-survivor. Instances behind the proof-debt class: openclaw#203735, openclaw#203769, openclaw#204094, openclaw#204224, openclaw#204426, openclaw#204512, openclaw#204275. This adds proof, not claims to fix those separate runtime causes.

## Contract

- Keep the merged healthy head → synthetic-next update lane. Its retained T also reports shared-schema readability from an isolated online backup (`readable`, `refused`, `unproven`), without changing the update result.
- For actual schema-version/production-migration diffs, build T from the PR fork point and reuse CI's tested merge-tree package as T+1. Record both source/build identities.
- Seed shared cron and agent sessions/history through T's real Gateway writers. Stop T, retain raw preimages, boot T+1, stop it at the exact Gateway TCP listen boundary, then hard-kill/reap its process group.
- Inspect DB/WAL/SHM **copies** after the kill. Advanced stores must have committed target schemas and valid floors; untouched lazy stores are named as untouched. Integrity/setup failures always fail.
- Project actual rollback state: restore only raised-floor stores from T's preimages, preserve other candidate-written store bytes, then authenticate to genuine T and read the seeded cron/session/history data. Compatibility becomes required when candidate source includes ReaderFloor's contract; absent/NULL floor metadata is valid and is not mistaken for missing capability.

No production code/schema change, down-migration, fake success receipt, production startup hook, or committed `src/update`/`src/state` edit. StoreCustody owns the separate normal-update crash case; this PR does not reintroduce the old red case. Bulk-access enforcement and the 10 GB nightly are stages 2 and 3, not claimed here.

## Cost and simplification

One extra previous-source build only for schema/migration diffs; no new CI job, runner tier or fanout. Existing lane ceiling rises 40 → 55 min; per-container ceiling stays 20 min and the existing seed job stays 115 min. Explicit downgrade qualification skips the unrelated synthetic successor build. Actual additional runtime is not measured yet.

The previous-reader report's duplicate process supervisor is deleted; seeder, report and downgrade share one bounded process-group owner. Separate modules own source preparation, real RPC fixture, crash barrier, physical store observations/projection and the controller; none ships in the product. These are the smallest coherent pieces of the approved pre-ready oracle, not a second updater.

Final PR-owned `tokei code` against pinned main `87236ceb25a9fc98d1043d1f18edfcb71b98414b`: production **0 → 0**; scripts **2,116 → 3,516 (+1,400)**; tests **8,797 → 9,175 (+378)**. Net raw test growth is **394 / 400**, allocation **0**. The duplicate SQLite fixture factory/mixed-projection case is gone; byte preservation and restored-content assertions remain in the single suite. No unrelated deletions, suppression allowlist entries or Knip ignores were added.

## Evidence and current gate

Ready for review; published head `ead509c7f0fdd54096923f7cc11b0d7df2d824ec`, with the required CI watchdog armed. Do not treat prior-head runtime proof as a final CI result. Subsequent changes affect typing, unit fixtures, lint and typed failure receipts, not the successful migration/projection path.

- Healthy update and schema-read observation on `1f0cdf960f0c`: AWS [run_8fc9ebd67a55f3ac853523dc53dd7100](https://crabbox.openclaw.ai/portal/runs/run_8fc9ebd67a55f3ac853523dc53dd7100). Committed/reported trial `e7846307-c5b3-48eb-97c4-c8c0bdfd4455`, schema42, two rows; CLI153097ms. Verified old T refused the isolated new shared schema with exit78; backup stayed schema42. This is the requested report, not an accepted downgrade refusal.
- Genuine pre-ready qualification on `55efd824fc82`: AWS [run_2c8997c1c413a76556c9a07c640be21b](https://crabbox.openclaw.ai/portal/runs/run_2c8997c1c413a76556c9a07c640be21b). Actual ad98b9e source T→published candidate: both agents43→44 before candidate SIGKILL; raised stores restored, shared41 byte-preserved. Config preimage restored atomically: before/restored SHA `74a6c60183b06ccb29deda5eb80de98ae113767aa9e3d232f10c8c8f8c641387`, candidate SHA `076aa2f7d5f926c7998edbb5afeb18a48b42161dee8acf79ad5498371e803b0f`. **Genuine T served, its build ID matched, and both exact histories and the cron sentinel passed.** This older-writer qualification is not a claim that d4 is this PR's fork point.
- ReaderFloor's independent [openclaw#204880](openclaw#204880) size-loss/config-provenance case remains known ([run_5eaf078abca514a139d8c599b2092035](https://crabbox.openclaw.ai/portal/runs/run_5eaf078abca514a139d8c599b2092035)). Our different fixture passing does not clear it. Rollout remains report-only until the reader-floor/recovery fix lands; no override flag, backup deletion or unraised-database restore was added.
- The genuine proof's full build and14 owner tests passed. After the test consolidation, exact published `55ff2e4cfa76` AWS [run_c243aab4f60386a030d0fa6e81cb65a0](https://crabbox.openclaw.ai/portal/runs/run_c243aab4f60386a030d0fa6e81cb65a0) passed selected canonical type graphs, **11 focused tests**, and the **391/400** test-line ratchet.
- Two full source reviews (`43bd8ae1016a`, `55efd824fc82`) found zero findings, patch correct, security cleared. Exact final-head review of **only the later repair delta** `55efd824fc82..ead509c` also completed clean (zero findings/security cleared); this is not a third full-range audit or release rebuild.
- Complete changed-file format, lint, scripts/test-root types and guards passed in AWS [run_69e9eb1d2d90257c64d462065092464e](https://crabbox.openclaw.ai/portal/runs/run_69e9eb1d2d90257c64d462065092464e). That full canonical command also reported a CLI-only harness export (now private) and pinned-production `src/gateway/operator-admission.ts:intersectOperatorRunModelPolicy`, which this PR does not modify. Previous head `18be57a08bda` [run_7ebfa24dbd0e08ea4509fd93887a6ae3](https://crabbox.openclaw.ai/portal/runs/run_7ebfa24dbd0e08ea4509fd93887a6ae3) then passed the canonical script-Knip profile, **11 tests** and **394/400** line ratchet. No full-command green or current-main reproduction of the production finding is claimed; final PR CI is authoritative.
- Exact waiver-free final head AWS [run_14b6d54ff040f3eda60ba6620d8a44f7](https://crabbox.openclaw.ai/portal/runs/run_14b6d54ff040f3eda60ba6620d8a44f7) passed scoped canonical scripts lint/typecheck, **25 tests** (11 downgrade boundaries plus the suppression guard), and **394/400** line ratchet. The two annotations were removed using explicit reflective receiver handling and existing protocol destructuring, not allowlisted. All owned AWS leases released with `--wait`.

Fable challenged the design before code. Bulk-access enforcement and the real10GB nightly remain the approved subsequent stages, not claimed by this PR.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Nov 25, 2026
## What Problem This Solves

Update PRs have no automatic check against migrations that scan or rewrite conversation-sized tables. A change described as schema-only can therefore introduce bulk-data work into an update.

Class A, stage 2, following #204685 and #204883. Related proof-debt instances: #203735, #203769, #204094, #204224, #204426, #204512, #204275. These are coverage links, not claims that this PR fixes their separate runtime causes.

## User Impact

No shipped code, schema, configuration, or user action changes. Selected schema/migration PRs gain an enforcement check in the existing Linux npm upgrade-survivor lane; ordinary PR CI also runs its native and owner regressions.

## Why This Change Was Made

One owner remains `release-update-survivor`, extended before its existing previous-release build rather than adding a runner, matrix cell, or second release harness. The source baseline was pinned to `origin/main` **1bec22471ad0114e4d3fe57954ccb443c5672262** before implementation.

- Freeze the agent DDL directly from the pinned fork-point Git blob and seed that version before the real leased maintenance owner runs. Do not regenerate the previous schema from candidate history: fork and candidate versions may be equal while an additive repair is pending. Fast numeric-step counterexamples remain explicit canonical policy fixtures, not claims of genuine old-release writer compatibility; #204883 owns that separate release-path proof.
- Reject executed bulk-data access, including `WHERE 0`, trigger work, FTS/shadow access and index builds. Permit proven constant metadata DDL; fail a bulk-schema touch combined with that store's reader-floor rise. Diagnostics identify the store and version range.
- Observe native preparation/execution, cached reprepare and iterator consumption together with before/after catalogs, not SQL-string splitting or row-count guesses. Unsupported APIs/process escapes fail coverage.
- Test-side spies delegate the real integrity exports unchanged. Only their dynamic boundaries are excluded; migration SQL before the finalizer and in its supplied callbacks remains observed. No production hook, flag, export, or blanket integrity-PRAGMA exemption.
- Install before source-owner imports and qualify the actual native named bindings. A fresh, unmodified native ESM child checks caught-error/coverage-failure behavior. There is no named-export mock, adapter, or preload workaround.
- Retain the sanitized `migration-bulk-access.json` receipt via the existing artifact allowlist. Observation failures retain diagnostics while rethrowing the original error, including frozen errors. Keep SQLite-native contracts on Node and use the existing isolated fork owner for main-thread maintenance authority.

Cost: no new runner class, fanout, or build; the check precedes the existing selected lane's previous-release build. The measured small real-owner case takes about 1.8 seconds, plus the existing Vitest worker preparation.

### Size and simplification

Harness-only Class A exception: **production-code delta 0**. On this PR's own `scripts/**` files, `tokei` code is **1,659 → 2,778 (+1,119)**, excluding tests. Native execution provenance, catalog policy and real-owner invocation are the smallest complete enforcement stage; splitting off an unused observer would not enforce the rule. No unrelated deletions were padded to meet a quota.

Removed unused observer getters/private exports and an overlapping classifier integrity-only case. Retained tests cover three distinct boundaries: native interception, bulk policy, and the actual leased owner/finalizer, plus execution-routing/volume and artifact contracts. Exact net test growth is **776**; the record allocates only **376** above the unchanged 400-line allowance, with a reason per file.

The 10 GB nightly and the separately approved ReaderFloor required-gate flip are not part of this stage.

## Evidence

- AWS [run_f877a94ca0bc44ca9915e83b966bc2a8](https://crabbox.openclaw.ai/portal/runs/run_f877a94ca0bc44ca9915e83b966bc2a8), repair head **643b611e3a**: actual root-scripts types passed; all **25 Node tests** and **39 pinned-Bun volume tests** passed through the real CI shard entrypoint. The real owner43→44 took **1,840 ms**; callback-bulk rejection **1,708 ms**; sanitized failure/original-error test **1,456 ms**. The parallel deliberately bulk-touching process exited **1** for transcript_events READ/UPDATE, and its persisted receipt was checked independently with zero coverage gaps. This batch exposed only a frozen-Error lint typing issue, subsequently fixed in9b by splitting construction and freezing into equivalent statements; that typing fix changed no observer, policy, owner or volume implementation.
- AWS static/routing gate: [run_089d279b4d1166ff262389a5ffaf8a4a](https://crabbox.openclaw.ai/portal/runs/run_089d279b4d1166ff262389a5ffaf8a4a): lint clean, 18 routing tests passed, and the focused artifact allowlist regression passed (238 unrelated cases intentionally unselected).
- Prior review-repair head **9b3bf78171af2f1f17d39c4f2ee6dc13c1a182ce**: AWS [run_4b1e0691d2f51c7081f4db6e74ec6247](https://crabbox.openclaw.ai/portal/runs/run_4b1e0691d2f51c7081f4db6e74ec6247) passed actual root-scripts types, lint, formatting, the native-observer suite and **698/(400+298)** budget. Its only source difference from the 25-test/Bun-volume proof was the equivalent frozen-Error fixture idiom and one-line allocation adjustment; unchanged owner and Bun profiles were not rerun.
- Approved final fork-DDL repair, **230bb1aead4620a36361d4f25f348211811c8e4a**: AWS [run_e9c4578580e1fc461be523d79cbb2865](https://crabbox.openclaw.ai/portal/runs/run_e9c4578580e1fc461be523d79cbb2865) passed all **5 targeted owner tests** using the actual frozen fork1bec DDL. The new same-version additive-repair control took **1,660 ms**: the real missing-table branch ran with equal versions and its bulk work was rejected. No production schema/code change.
- Upstream CI attribution in the same AWS run: a separately cloned checkout pinned to **main ad96c24** reproduced `ci-scheduled-coverage.test.ts:79` solely for `.agents/skills/openclaw-writing/scripts/writing.test.mjs` (1 failed, 2 unrelated cases unselected). This file and missing native-test ownership already exist on that base; no planner invariant was weakened. Main CI45537657628 had run only security-fast, so its green result was not presented as invariant-execution evidence.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 26, 2026
## What Problem This Solves

Update PRs have no automatic check against migrations that scan or rewrite conversation-sized tables. A change described as schema-only can therefore introduce bulk-data work into an update.

Class A, stage 2, following openclaw#204685 and openclaw#204883. Related proof-debt instances: openclaw#203735, openclaw#203769, openclaw#204094, openclaw#204224, openclaw#204426, openclaw#204512, openclaw#204275. These are coverage links, not claims that this PR fixes their separate runtime causes.

## User Impact

No shipped code, schema, configuration, or user action changes. Selected schema/migration PRs gain an enforcement check in the existing Linux npm upgrade-survivor lane; ordinary PR CI also runs its native and owner regressions.

## Why This Change Was Made

One owner remains `release-update-survivor`, extended before its existing previous-release build rather than adding a runner, matrix cell, or second release harness. The source baseline was pinned to `origin/main` **285567057721b971ed4c9679ef3b06f951ca583c** before implementation.

- Freeze the agent DDL directly from the pinned fork-point Git blob and seed that version before the real leased maintenance owner runs. Do not regenerate the previous schema from candidate history: fork and candidate versions may be equal while an additive repair is pending. Fast numeric-step counterexamples remain explicit canonical policy fixtures, not claims of genuine old-release writer compatibility; openclaw#204883 owns that separate release-path proof.
- Reject executed bulk-data access, including `WHERE 0`, trigger work, FTS/shadow access and index builds. Permit proven constant metadata DDL; fail a bulk-schema touch combined with that store's reader-floor rise. Diagnostics identify the store and version range.
- Observe native preparation/execution, cached reprepare and iterator consumption together with before/after catalogs, not SQL-string splitting or row-count guesses. Unsupported APIs/process escapes fail coverage.
- Test-side spies delegate the real integrity exports unchanged. Only their dynamic boundaries are excluded; migration SQL before the finalizer and in its supplied callbacks remains observed. No production hook, flag, export, or blanket integrity-PRAGMA exemption.
- Install before source-owner imports and qualify the actual native named bindings. A fresh, unmodified native ESM child checks caught-error/coverage-failure behavior. There is no named-export mock, adapter, or preload workaround.
- Retain the sanitized `migration-bulk-access.json` receipt via the existing artifact allowlist. Observation failures retain diagnostics while rethrowing the original error, including frozen errors. Keep SQLite-native contracts on Node and use the existing isolated fork owner for main-thread maintenance authority.

Cost: no new runner class, fanout, or build; the check precedes the existing selected lane's previous-release build. The measured small real-owner case takes about 1.8 seconds, plus the existing Vitest worker preparation.

### Size and simplification

Harness-only Class A exception: **production-code delta 0**. On this PR's own `scripts/**` files, `tokei` code is **1,659 → 2,778 (+1,119)**, excluding tests. Native execution provenance, catalog policy and real-owner invocation are the smallest complete enforcement stage; splitting off an unused observer would not enforce the rule. No unrelated deletions were padded to meet a quota.

Removed unused observer getters/private exports and an overlapping classifier integrity-only case. Retained tests cover three distinct boundaries: native interception, bulk policy, and the actual leased owner/finalizer, plus execution-routing/volume and artifact contracts. Exact net test growth is **776**; the record allocates only **376** above the unchanged 400-line allowance, with a reason per file.

The 10 GB nightly and the separately approved ReaderFloor required-gate flip are not part of this stage.

## Evidence

- AWS [run_f877a94ca0bc44ca9915e83b966bc2a8](https://crabbox.openclaw.ai/portal/runs/run_f877a94ca0bc44ca9915e83b966bc2a8), repair head **643b611e3a**: actual root-scripts types passed; all **25 Node tests** and **39 pinned-Bun volume tests** passed through the real CI shard entrypoint. The real owner43→44 took **1,840 ms**; callback-bulk rejection **1,708 ms**; sanitized failure/original-error test **1,456 ms**. The parallel deliberately bulk-touching process exited **1** for transcript_events READ/UPDATE, and its persisted receipt was checked independently with zero coverage gaps. This batch exposed only a frozen-Error lint typing issue, subsequently fixed in9b by splitting construction and freezing into equivalent statements; that typing fix changed no observer, policy, owner or volume implementation.
- AWS static/routing gate: [run_089d279b4d1166ff262389a5ffaf8a4a](https://crabbox.openclaw.ai/portal/runs/run_089d279b4d1166ff262389a5ffaf8a4a): lint clean, 18 routing tests passed, and the focused artifact allowlist regression passed (238 unrelated cases intentionally unselected).
- Prior review-repair head **9b3bf78171af2f1f17d39c4f2ee6dc13c1a182ce**: AWS [run_4b1e0691d2f51c7081f4db6e74ec6247](https://crabbox.openclaw.ai/portal/runs/run_4b1e0691d2f51c7081f4db6e74ec6247) passed actual root-scripts types, lint, formatting, the native-observer suite and **698/(400+298)** budget. Its only source difference from the 25-test/Bun-volume proof was the equivalent frozen-Error fixture idiom and one-line allocation adjustment; unchanged owner and Bun profiles were not rerun.
- Approved final fork-DDL repair, **230bb1aead4620a36361d4f25f348211811c8e4a**: AWS [run_e9c4578580e1fc461be523d79cbb2865](https://crabbox.openclaw.ai/portal/runs/run_e9c4578580e1fc461be523d79cbb2865) passed all **5 targeted owner tests** using the actual frozen fork1bec DDL. The new same-version additive-repair control took **1,660 ms**: the real missing-table branch ran with equal versions and its bulk work was rejected. No production schema/code change.
- Upstream CI attribution in the same AWS run: a separately cloned checkout pinned to **main 34773c7** reproduced `ci-scheduled-coverage.test.ts:79` solely for `.agents/skills/openclaw-writing/scripts/writing.test.mjs` (1 failed, 2 unrelated cases unselected). This file and missing native-test ownership already exist on that base; no planner invariant was weakened. Main CI45537657628 had run only security-fast, so its green result was not presented as invariant-execution evidence.

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 26, 2026
…204883)

## Class A — previous-reader enforcement, stage 1

Follow-up to merged #204685 and #204830; coordination #204775. Existing owner: upgrade-survivor. Instances behind the proof-debt class: #203735, #203769, #204094, #204224, #204426, #204512, #204275. This adds proof, not claims to fix those separate runtime causes.

## Contract

- Keep the merged healthy head → synthetic-next update lane. Its retained T also reports shared-schema readability from an isolated online backup (`readable`, `refused`, `unproven`), without changing the update result.
- For actual schema-version/production-migration diffs, build T from the PR fork point and reuse CI's tested merge-tree package as T+1. Record both source/build identities.
- Seed shared cron and agent sessions/history through T's real Gateway writers. Stop T, retain raw preimages, boot T+1, stop it at the exact Gateway TCP listen boundary, then hard-kill/reap its process group.
- Inspect DB/WAL/SHM **copies** after the kill. Advanced stores must have committed target schemas and valid floors; untouched lazy stores are named as untouched. Integrity/setup failures always fail.
- Project actual rollback state: restore only raised-floor stores from T's preimages, preserve other candidate-written store bytes, then authenticate to genuine T and read the seeded cron/session/history data. Compatibility becomes required when candidate source includes ReaderFloor's contract; absent/NULL floor metadata is valid and is not mistaken for missing capability.

No production code/schema change, down-migration, fake success receipt, production startup hook, or committed `src/update`/`src/state` edit. StoreCustody owns the separate normal-update crash case; this PR does not reintroduce the old red case. Bulk-access enforcement and the 10 GB nightly are stages 2 and 3, not claimed here.

## Cost and simplification

One extra previous-source build only for schema/migration diffs; no new CI job, runner tier or fanout. Existing lane ceiling rises 40 → 55 min; per-container ceiling stays 20 min and the existing seed job stays 115 min. Explicit downgrade qualification skips the unrelated synthetic successor build. Actual additional runtime is not measured yet.

The previous-reader report's duplicate process supervisor is deleted; seeder, report and downgrade share one bounded process-group owner. Separate modules own source preparation, real RPC fixture, crash barrier, physical store observations/projection and the controller; none ships in the product. These are the smallest coherent pieces of the approved pre-ready oracle, not a second updater.

Final PR-owned `tokei code` against pinned main `f36e439d70772464e10f66182e05e52e99e22663`: production **0 → 0**; scripts **2,116 → 3,516 (+1,400)**; tests **8,797 → 9,175 (+378)**. Net raw test growth is **394 / 400**, allocation **0**. The duplicate SQLite fixture factory/mixed-projection case is gone; byte preservation and restored-content assertions remain in the single suite. No unrelated deletions, suppression allowlist entries or Knip ignores were added.

## Evidence and current gate

Ready for review; published head `ead509c7f0fdd54096923f7cc11b0d7df2d824ec`, with the required CI watchdog armed. Do not treat prior-head runtime proof as a final CI result. Subsequent changes affect typing, unit fixtures, lint and typed failure receipts, not the successful migration/projection path.

- Healthy update and schema-read observation on `1f0cdf960f0c`: AWS [run_8fc9ebd67a55f3ac853523dc53dd7100](https://crabbox.openclaw.ai/portal/runs/run_8fc9ebd67a55f3ac853523dc53dd7100). Committed/reported trial `e7846307-c5b3-48eb-97c4-c8c0bdfd4455`, schema42, two rows; CLI153097ms. Verified old T refused the isolated new shared schema with exit78; backup stayed schema42. This is the requested report, not an accepted downgrade refusal.
- Genuine pre-ready qualification on `55efd824fc82`: AWS [run_2c8997c1c413a76556c9a07c640be21b](https://crabbox.openclaw.ai/portal/runs/run_2c8997c1c413a76556c9a07c640be21b). Actual d4c6c46 source T→published candidate: both agents43→44 before candidate SIGKILL; raised stores restored, shared41 byte-preserved. Config preimage restored atomically: before/restored SHA `74a6c60183b06ccb29deda5eb80de98ae113767aa9e3d232f10c8c8f8c641387`, candidate SHA `076aa2f7d5f926c7998edbb5afeb18a48b42161dee8acf79ad5498371e803b0f`. **Genuine T served, its build ID matched, and both exact histories and the cron sentinel passed.** This older-writer qualification is not a claim that d4 is this PR's fork point.
- ReaderFloor's independent [#204880](#204880) size-loss/config-provenance case remains known ([run_5eaf078abca514a139d8c599b2092035](https://crabbox.openclaw.ai/portal/runs/run_5eaf078abca514a139d8c599b2092035)). Our different fixture passing does not clear it. Rollout remains report-only until the reader-floor/recovery fix lands; no override flag, backup deletion or unraised-database restore was added.
- The genuine proof's full build and14 owner tests passed. After the test consolidation, exact published `55ff2e4cfa76` AWS [run_c243aab4f60386a030d0fa6e81cb65a0](https://crabbox.openclaw.ai/portal/runs/run_c243aab4f60386a030d0fa6e81cb65a0) passed selected canonical type graphs, **11 focused tests**, and the **391/400** test-line ratchet.
- Two full source reviews (`43bd8ae1016a`, `55efd824fc82`) found zero findings, patch correct, security cleared. Exact final-head review of **only the later repair delta** `55efd824fc82..ead509c` also completed clean (zero findings/security cleared); this is not a third full-range audit or release rebuild.
- Complete changed-file format, lint, scripts/test-root types and guards passed in AWS [run_69e9eb1d2d90257c64d462065092464e](https://crabbox.openclaw.ai/portal/runs/run_69e9eb1d2d90257c64d462065092464e). That full canonical command also reported a CLI-only harness export (now private) and pinned-production `src/gateway/operator-admission.ts:intersectOperatorRunModelPolicy`, which this PR does not modify. Previous head `18be57a08bda` [run_7ebfa24dbd0e08ea4509fd93887a6ae3](https://crabbox.openclaw.ai/portal/runs/run_7ebfa24dbd0e08ea4509fd93887a6ae3) then passed the canonical script-Knip profile, **11 tests** and **394/400** line ratchet. No full-command green or current-main reproduction of the production finding is claimed; final PR CI is authoritative.
- Exact waiver-free final head AWS [run_14b6d54ff040f3eda60ba6620d8a44f7](https://crabbox.openclaw.ai/portal/runs/run_14b6d54ff040f3eda60ba6620d8a44f7) passed scoped canonical scripts lint/typecheck, **25 tests** (11 downgrade boundaries plus the suppression guard), and **394/400** line ratchet. The two annotations were removed using explicit reflective receiver handling and existing protocol destructuring, not allowlisted. All owned AWS leases released with `--wait`.

Fable challenged the design before code. Bulk-access enforcement and the real10GB nightly remain the approved subsequent stages, not claimed by this PR.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 1bec224)

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
obviyus added a commit that referenced this pull request Nov 26, 2026
)

## What Problem This Solves

Schema-change CI can still report a previous-reader failure without failing the PR, and the test itself restores databases/config before checking that reader. That does not prove the rollback that an installed OpenClaw actually performs.

Related coverage class: #203735, #203769, #204094, #204224, #204426, #204512, #204275. Follows #204883 and #205022 after #204956, #205165 and #205578. These are proof-debt coverage links, not claims to fix each runtime cause.

## User Impact

Schema/migration changes must pass the existing Linux update lane's genuine previous-reader check. No shipped behavior, storage schema, launcher format or update contract changes. The nightly 10 GB case remains a separate PR.

## Why This Change Was Made

The existing upgrade-survivor downgrade controller remains the sole check owner. T's public `update --tag file:<candidate> --no-restart` prepares the genuine candidate, and T's actual resident launcher retries and rolls back its trial. The harness records stopped-store inspection copies, trial/manifest/build evidence, then checks T's authenticated serving identity and exact seeded sessions, history and cron.

Deletes the report-only/capability probe, the harness's store/config restoration writer, and the candidate's redundant global install. Raised-floor stores must return to T's committed schema/floor; unraised stores must retain T+1's schema/floor. Candidate-created null-preimage stores follow production restoration rather than a second test policy. The pre-listen barrier is target-root scoped so the real fallback is not parked.

The resident and Gateway are separately detached processes; bounded cleanup and a shutdown allowance above the resident's real 15-second child deadline are necessary to observe stores only after shutdown. The fixture restarts the resident mid-trial to obtain quiescent post-migration facts without racing its retry.

Line-count policy: direction over deletion quota; no production code added or changed (delta 0). On this PR's seven harness `.mjs` files, `tokei` code lines: **1,225 → 1,331 (+106)** against pinned main `b7bd237d00508e0999c7a3fc6e36bc32bf421098`. Growth replaces the synthetic restoration path with real updater/resident lifecycle coverage; no padded deletions.

## Evidence

- Source/Fable 5.2 design challenge completed before implementation; accepted concrete corrections for real explicit-artifact preparation, launcher provenance, detached process ownership, release-scoped barrier and failure classification.
- Final head **`d402754aeddc08073c5a768d0eb9ec5a757c090f`**: AWS [run_c853226a09bf6307cb2fb9c6883a6e3f](https://crabbox.openclaw.ai/portal/runs/run_c853226a09bf6307cb2fb9c6883a6e3f) passed canonical root-scripts types and **25/25** real NodeSQLite/barrier owner tests (8.90 seconds). Hosted [CI 45786731172](https://github.com/openclaw/openclaw/actions/runs/45786731172) is **green**, including lint, selected types, build, changed tests, docs, plan, guards and the existing [Docker seed lane](https://github.com/openclaw/openclaw/actions/runs/45786731172/job/139796419090) (**51m06s**, within its115-minute budget).
- Nine-file AWS formatting passed in [run_7b781a5cac85a7c1da10d6c349c797db](https://crabbox.openclaw.ai/portal/runs/run_7b781a5cac85a7c1da10d6c349c797db). Final exact-head local review: patch correct, zero findings, security cleared (`d402754aeddc.md`).
- **Genuine green:** AWS [run_61f0082ee849fbbdbe56541506e092d2](https://crabbox.openclaw.ai/portal/runs/run_61f0082ee849fbbdbe56541506e092d2), candidate full build **401.239 seconds**, real runtime **186 seconds**; T full build **398 seconds** in [run_f95430f16696a3a598cdbc58a7840fe2](https://crabbox.openclaw.ai/portal/runs/run_f95430f16696a3a598cdbc58a7840fe2). Genuine T source `9959708b7d1df23a2600c5f9b3e09d54270e391b` versus exact d402 candidate, both version2026.11.10 with distinct verified build IDs. Two real pre-listen crashes led to trial `rolled-back`, attempts2, actual format4 resident selecting T. T was ready/authenticated with matching build identity; exact histories for two agents and cron passed. Agent stores advanced44→45, retainedfloor44 and remained45 after rollback; shared42/floor42 was untouched. The actual manifest correctly contained no restore entries for this all-unraised pair. Raised-store restoration is not claimed as an integration result for this pair. Saved receipt/trial/manifest were independently read after root-owned artifact recovery; the driver itself exited0.
- **Genuine red:** AWS [run_1b513d7779956f918a79f09cd66ada22](https://crabbox.openclaw.ai/portal/runs/run_1b513d7779956f918a79f09cd66ada22), throwaway commit **`4d9f9361eafb9d6f96866401973e8e5401efea29`** (never pushed/merged). Full build **403.664 seconds**, runtime **183 seconds**. A real floor-preserving migration changed canonical session labels and their projection. The actual required gate exited **1**, with **no structural/setup failures**, solely because T's old-label lookup returned0!==1. T was ready/authenticated with the correct serving build; the real resident had rolled back, and agent45/floor44 remained retained. Before this one full corrected run, [run_4ca76b2321c5e2fb29fc90a317dfe8c0](https://crabbox.openclaw.ai/portal/runs/run_4ca76b2321c5e2fb29fc90a317dfe8c0) (**64.925 seconds**) calibrated exact SQL against disposable retained copies and the unchanged genuine T oracle. The first projection-only specimen passed because RPC reads canonical JSON; it is not counted as red proof. Receipts, trials, manifests, store inspections and Gateway logtails were saved and independently read.
- The genuine runtime pair is an explicitly historical qualification pair, **not this harness-only PR's fork point**. Automatic selected schema/migration CI still uses the genuine fork point → tested merge package; this PR changes no selector or fanout. The CI candidate package is reused; only selected schema/migration diffs incur the prior-release build and downgrade runtime.
- AWS leases were released with `stop --wait` (including `cbx_5408b16cf245`). No provider fallback, assertion forcing, or host proof. **Runtime green/red requirements, exact-head local review and hosted CI are complete.** The10GB nightly remains deferred.
- No host build/test/lint/format runs. Production restore is the only writer; no new production hooks or formats.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 27, 2026
…claw#205857)

## What Problem This Solves

Schema-change CI can still report a previous-reader failure without failing the PR, and the test itself restores databases/config before checking that reader. That does not prove the rollback that an installed OpenClaw actually performs.

Related coverage class: openclaw#203735, openclaw#203769, openclaw#204094, openclaw#204224, openclaw#204426, openclaw#204512, openclaw#204275. Follows openclaw#204883 and openclaw#205022 after openclaw#204956, openclaw#205165 and openclaw#205578. These are proof-debt coverage links, not claims to fix each runtime cause.

## User Impact

Schema/migration changes must pass the existing Linux update lane's genuine previous-reader check. No shipped behavior, storage schema, launcher format or update contract changes. The nightly 10 GB case remains a separate PR.

## Why This Change Was Made

The existing upgrade-survivor downgrade controller remains the sole check owner. T's public `update --tag file:<candidate> --no-restart` prepares the genuine candidate, and T's actual resident launcher retries and rolls back its trial. The harness records stopped-store inspection copies, trial/manifest/build evidence, then checks T's authenticated serving identity and exact seeded sessions, history and cron.

Deletes the report-only/capability probe, the harness's store/config restoration writer, and the candidate's redundant global install. Raised-floor stores must return to T's committed schema/floor; unraised stores must retain T+1's schema/floor. Candidate-created null-preimage stores follow production restoration rather than a second test policy. The pre-listen barrier is target-root scoped so the real fallback is not parked.

The resident and Gateway are separately detached processes; bounded cleanup and a shutdown allowance above the resident's real 15-second child deadline are necessary to observe stores only after shutdown. The fixture restarts the resident mid-trial to obtain quiescent post-migration facts without racing its retry.

Line-count policy: direction over deletion quota; no production code added or changed (delta 0). On this PR's seven harness `.mjs` files, `tokei` code lines: **1,225 → 1,331 (+106)** against pinned main `dbf975ac7374fa6f95c5778cbe98abda8a8f5cc3`. Growth replaces the synthetic restoration path with real updater/resident lifecycle coverage; no padded deletions.

## Evidence

- Source/Fable 5.2 design challenge completed before implementation; accepted concrete corrections for real explicit-artifact preparation, launcher provenance, detached process ownership, release-scoped barrier and failure classification.
- Final head **`d402754aeddc08073c5a768d0eb9ec5a757c090f`**: AWS [run_c853226a09bf6307cb2fb9c6883a6e3f](https://crabbox.openclaw.ai/portal/runs/run_c853226a09bf6307cb2fb9c6883a6e3f) passed canonical root-scripts types and **25/25** real NodeSQLite/barrier owner tests (8.90 seconds). Hosted [CI 45786731172](https://github.com/openclaw/openclaw/actions/runs/45786731172) is **green**, including lint, selected types, build, changed tests, docs, plan, guards and the existing [Docker seed lane](https://github.com/openclaw/openclaw/actions/runs/45786731172/job/139796419090) (**51m06s**, within its115-minute budget).
- Nine-file AWS formatting passed in [run_7b781a5cac85a7c1da10d6c349c797db](https://crabbox.openclaw.ai/portal/runs/run_7b781a5cac85a7c1da10d6c349c797db). Final exact-head local review: patch correct, zero findings, security cleared (`d402754aeddc.md`).
- **Genuine green:** AWS [run_61f0082ee849fbbdbe56541506e092d2](https://crabbox.openclaw.ai/portal/runs/run_61f0082ee849fbbdbe56541506e092d2), candidate full build **401.239 seconds**, real runtime **186 seconds**; T full build **398 seconds** in [run_f95430f16696a3a598cdbc58a7840fe2](https://crabbox.openclaw.ai/portal/runs/run_f95430f16696a3a598cdbc58a7840fe2). Genuine T source `901b070361208f47a21206eba9c5ef9b5670f254` versus exact d402 candidate, both version2026.11.10 with distinct verified build IDs. Two real pre-listen crashes led to trial `rolled-back`, attempts2, actual format4 resident selecting T. T was ready/authenticated with matching build identity; exact histories for two agents and cron passed. Agent stores advanced44→45, retainedfloor44 and remained45 after rollback; shared42/floor42 was untouched. The actual manifest correctly contained no restore entries for this all-unraised pair. Raised-store restoration is not claimed as an integration result for this pair. Saved receipt/trial/manifest were independently read after root-owned artifact recovery; the driver itself exited0.
- **Genuine red:** AWS [run_1b513d7779956f918a79f09cd66ada22](https://crabbox.openclaw.ai/portal/runs/run_1b513d7779956f918a79f09cd66ada22), throwaway commit **`4d9f9361eafb9d6f96866401973e8e5401efea29`** (never pushed/merged). Full build **403.664 seconds**, runtime **183 seconds**. A real floor-preserving migration changed canonical session labels and their projection. The actual required gate exited **1**, with **no structural/setup failures**, solely because T's old-label lookup returned0!==1. T was ready/authenticated with the correct serving build; the real resident had rolled back, and agent45/floor44 remained retained. Before this one full corrected run, [run_4ca76b2321c5e2fb29fc90a317dfe8c0](https://crabbox.openclaw.ai/portal/runs/run_4ca76b2321c5e2fb29fc90a317dfe8c0) (**64.925 seconds**) calibrated exact SQL against disposable retained copies and the unchanged genuine T oracle. The first projection-only specimen passed because RPC reads canonical JSON; it is not counted as red proof. Receipts, trials, manifests, store inspections and Gateway logtails were saved and independently read.
- The genuine runtime pair is an explicitly historical qualification pair, **not this harness-only PR's fork point**. Automatic selected schema/migration CI still uses the genuine fork point → tested merge package; this PR changes no selector or fanout. The CI candidate package is reused; only selected schema/migration diffs incur the prior-release build and downgrade runtime.
- AWS leases were released with `stop --wait` (including `cbx_5408b16cf245`). No provider fallback, assertion forcing, or host proof. **Runtime green/red requirements, exact-head local review and hosted CI are complete.** The10GB nightly remains deferred.
- No host build/test/lint/format runs. Production restore is the only writer; no new production hooks or formats.

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

Labels

docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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