Repository navigation
fix: schema-version refusal blames a downgrade that never happened and cannot identify the stale install - #115232
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 28, 2026, 11:58 AM ET / 15:58 UTC. ClawSweeper reviewWhat this changesThis PR changes SQLite schema-refusal, gateway-startup, and legacy exec-approval messages so operators can identify the refusing installation and the state directory that Doctor must repair. Merge readiness⛔ Blocked until stronger real behavior proof is added - 4 items remain This PR appears to be a focused, correct diagnostic repair for the reported stale-build and scoped-state-root confusion, but it remains protected for maintainer handling and lacks direct after-fix runtime proof from the current head. The existing live before-state and importer evidence are useful; a redacted terminal transcript showing the revised schema refusal and scoped Doctor instruction would close the remaining proof gap. Likely related people: Priority: P2 Review scores
Verification
How this fits togetherSQLite preflight blocks OpenClaw from opening databases created with newer schema versions, and the exec-approvals migration gate blocks use until Doctor imports retired state. Both paths surface recovery instructions to CLI, gateway, and native-app operators. flowchart LR
A[State database or legacy approval file] --> B[CLI, gateway, or app startup]
B --> C[Schema preflight or migration gate]
C --> D[Refusal diagnostic]
D --> E[Install root and state directory guidance]
E --> F[Compatible runtime or scoped Doctor repair]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +41, Tests +47, Docs +6, Other +10. Total +104 across 8 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the fail-closed schema and migration gates unchanged, land the shared diagnostic wording only after a redacted current-head terminal proof shows both the refusing-install message and the scoped Doctor guidance in a real setup. Do we have a high-confidence way to reproduce the issue? No high-confidence current-head reproduction is included. The supplied live before-state and the patched source/tests make the failure mechanism source-reproducible, but an after-fix run against the current PR head is still missing. Is this the best way to solve the issue? Yes, conditionally: keeping the schema gate fail-closed while making its install identity and scoped Doctor target actionable is narrower and safer than changing schema compatibility behavior. The shared helper also keeps direct SQLite and gateway-startup diagnostics aligned. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 924f91ce475a. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
…usals The newer-schema refusal told operators not to downgrade and to upgrade OpenClaw, neither of which is actionable when two builds share one release version string. It now names the install root that refused, both schema versions, and warns that a linked source checkout reports its git HEAD even when its built dist is older. The exec-approvals gate told operators to run `openclaw doctor --fix` without naming the state directory, so a bare invocation repaired the default root while the scoped install stayed blocked. Both the TypeScript gate and its Swift sibling now scope the command to the blocked state directory. Refs #115008
8a27ee0 to
e64a3ce
Compare
|
Merged via squash.
|
…-20260728 * origin/main: fix(slack): cap chat.update edit text at the 4000-char limit, not the 8000 send limit (#115027) [AI-assisted] docs: recommend Node 26 in quickstart, landing, and platform install docs (#115064) refactor(workboard): tidy Control UI card execution helpers (#115195) perf(agents): amortize history-limit eviction with hysteresis (#115273) (#115281) fix: schema-version refusal blames a downgrade that never happened and cannot identify the stale install (#115232) fix: restore Fish completion after global CLI options (#115222) refactor(agents): collapse the client-tool catalog branch (#115212)
* origin/main: (199 commits) refactor(workboard): tidy Control UI card execution helpers (openclaw#115195) perf(agents): amortize history-limit eviction with hysteresis (openclaw#115273) (openclaw#115281) fix: schema-version refusal blames a downgrade that never happened and cannot identify the stale install (openclaw#115232) fix: restore Fish completion after global CLI options (openclaw#115222) refactor(agents): collapse the client-tool catalog branch (openclaw#115212) fix(macos): signed rebuild no longer stalls on app shutdown (openclaw#103957) fix(agents): prevent repeated Code Mode output across waits (openclaw#115213) refactor(ui): split Profile (identity) from Usage (statistics) (openclaw#115245) fix(channels): report a channel that cannot receive as unhealthy instead of connected (openclaw#115229) fix(cli): reject malformed infer model refs (openclaw#115225) feat(ui): finish the Lobsterdex at 42 with wild variants, squish fix, and blink variance (openclaw#115264) test(migrations): avoid mtime precision in checkpoint fixture (openclaw#115269) test(signal): verify archive limits without malformed tar (openclaw#115270) refactor(sessions): isolate legacy transcript fixtures (openclaw#115231) fix(discord): clear pending launch watchdog (openclaw#115100) fix(agents): stop quadratic subagent prompt rendering (openclaw#115263) fix(memory-core): recover dreaming cron reconciliation (openclaw#115174) fix(qa-lab): filter incompatible channel scenarios (openclaw#115087) fix(android): respect locale in compact labels test(i18n): prove iOS discovery catalog ownership ...
* origin/main: (62 commits) feat(macos): enable Computer Control by default and diagnose stale Accessibility grants (openclaw#115280) fix(qa): restore full-stack scenarios and truthful suite exits (openclaw#115290) feat(memory): backfill past sessions from Control UI (openclaw#115266) docs: link macOS onboarding pages to app download (openclaw#111361) feat(skills): shared authoring standards make learned skills routable (openclaw#115103) fix(matrix): suppress previews for modifying hooks fix: prevent node gateway hangs and runaway local inference (openclaw#115248) refactor(ui): adopt @lit/task across remaining page surfaces (openclaw#115274) fix(slack): cap chat.update edit text at the 4000-char limit, not the 8000 send limit (openclaw#115027) [AI-assisted] docs: recommend Node 26 in quickstart, landing, and platform install docs (openclaw#115064) refactor(workboard): tidy Control UI card execution helpers (openclaw#115195) perf(agents): amortize history-limit eviction with hysteresis (openclaw#115273) (openclaw#115281) fix: schema-version refusal blames a downgrade that never happened and cannot identify the stale install (openclaw#115232) fix: restore Fish completion after global CLI options (openclaw#115222) refactor(agents): collapse the client-tool catalog branch (openclaw#115212) fix(macos): signed rebuild no longer stalls on app shutdown (openclaw#103957) fix(agents): prevent repeated Code Mode output across waits (openclaw#115213) refactor(ui): split Profile (identity) from Usage (statistics) (openclaw#115245) fix(channels): report a channel that cannot receive as unhealthy instead of connected (openclaw#115229) fix(cli): reject malformed infer model refs (openclaw#115225) ...
…d cannot identify the stale install (openclaw#115232) * fix(state): name the refusing install in schema and exec-approval refusals The newer-schema refusal told operators not to downgrade and to upgrade OpenClaw, neither of which is actionable when two builds share one release version string. It now names the install root that refused, both schema versions, and warns that a linked source checkout reports its git HEAD even when its built dist is older. The exec-approvals gate told operators to run `openclaw doctor --fix` without naming the state directory, so a bare invocation repaired the default root while the scoped install stayed blocked. Both the TypeScript gate and its Swift sibling now scope the command to the blocked state directory. Refs openclaw#115008 * fix(gateway): name the refusing install in the startup schema refusal * fix(mac): keep the exec-approvals gate message buildable on iOS * fix(exec-approvals): shell-quote the state directory in the repair command * fix(exec-approvals): state the repair directory in prose so every shell can follow it
The docstring quoted the pre-openclaw#115232 refusal text, which no longer matches what the build emits. Also records why the snapshot matters now that the refusal no longer mentions restoring a backup: openclaw#115232 dropped that advice as unactionable, and part of why it was unactionable is that nothing created the backup it pointed at. Co-Authored-By: Claude Opus 5 <[email protected]>
Related: #115008
What Problem This Solves
Fixes an issue where operators hitting a newer-schema database refusal were sent down a path that makes their install worse. The error asserted a downgrade that never happened ("Do not downgrade OpenClaw") and prescribed an action the operator could not carry out ("Upgrade OpenClaw before opening this database"), while giving them nothing to identify which install was stale.
On the reporting host, three state-schema levels (4, 5, and 6) were all produced by builds that call themselves
2026.7.2.2026.7.2is not a published stable release — npmlatestis2026.7.1-2, which is older than what was installed — so an operator following "Upgrade OpenClaw" via Homebrew ornpm i -g openclaw@latestperforms a silent downgrade, moving further from the schema the database requires while the error keeps telling them not to downgrade.A second, smaller misdirection sits on the same machine.
ExecApprovalsMigrationRequiredErrortells the operator to runopenclaw doctor --fixwithout naming the state directory. A bare invocation repairs the default~/.openclawroot, so a node scoped toOPENCLAW_STATE_DIR=~/.openclaw-clawmac-nodestays blocked by the very file the command was supposed to import, with the command reporting success.Why This Change Was Made
The fail-closed schema gate is correct and is unchanged; only its diagnostics change. The refusal now names the install root it was refused by, states both schema versions, and directs the operator at that install rather than at an abstract "newer version".
Choosing the install root as the primary identifier is deliberate. Investigating the reported host showed the stale build was not a second install at all:
/opt/homebrew/bin/openclawis a pnpm global link to a single source checkout whosesrc/declares schema 5 while itsdist/(built nine days earlier) compiles schema 4.resolveCommitHashprefers the checkout's git HEAD overdist/build-info.json, so--versionreports the commit of code that is not executing — printing the commit alone would have swapped one misleading identifier for another. The path is the part that is always actionable, so the message leads with it and explicitly calls out the stale-distcase.The exec-approvals gate and its Swift sibling now name the blocked directory whenever the store is scoped to a non-default state root, leaving the common default-root case unchanged. The directory is stated in prose ("with OPENCLAW_STATE_DIR set to …") rather than as a
VAR=value cmdone-liner: no Windows shell accepts that form, and the macOS app's own state root lives underApplication Support, so a pasted one-liner would word-split on the space and repair the wrong directory.User Impact
Operators who hit a schema refusal can act on it. The message names the install that refused, what it supports, what it found, and that a linked checkout may need rebuilding rather than reinstalling — instead of telling them to undo a downgrade they never performed. Anyone blocked by a legacy
exec-approvals.jsonunder a scopedOPENCLAW_STATE_DIRnow gets a command that targets the directory that is actually blocked.Behavior is otherwise unchanged: the same databases are refused under the same conditions, and no schema version moves.
Evidence
Live reproduction of the misleading error, on the reported host, against the Mac node's state directory:
Root cause of that host's "stale build" — one install, source and
dist/disagreeing:After the fix, on a scoped install
Both changed messages captured from real CLI invocations against a scoped
OPENCLAW_STATE_DIR, running this branch. Paths abbreviated as<state-dir>/<install-root>; nothing else edited.Schema refusal — a state database one version ahead of what this build supports:
The refusal now names the install root, both schema numbers, and the stale-
distcase. It no longer claims a downgrade happened or tells the operator to upgrade.Exec-approvals gate, end to end — staged from the reporting host's actual backed-up node state (its real
exec-approvals.jsonplus its real schema-5state/openclaw.sqlite, which had noexec_approvals_configrow):The gate fires naming the blocked directory,
doctor --fixscoped to that directory imports the file and removes it, and the gate stops firing — the real policy (1 agent, 5 allowlist entries) is now served from SQLite.That last sequence is also why this PR deliberately does not touch the importer.
migrateLegacyExecApprovals(src/infra/state-migrations.exec-approvals.ts) already exists and works; it is reached from themode: "doctor"step list insrc/infra/state-migrations.doctor.tsviasrc/flows/doctor-health-contributions.ts. It never ran on the reporting host only becausedoctor --fixaborts on the schema gate first — which is the misdirection this PR fixes.Focused tests:
src/infra/sqlite-user-version.test.ts(build identity, both schema versions, and explicit assertions that the message no longer says "Do not downgrade" or "Upgrade OpenClaw") andsrc/infra/exec-approvals-store.test.ts(the instruction names the blocked state directory). The Swift gate test asserts the same for the app store.Checks:
pnpm check:changedgreen on Blacksmith Testbox (tbx_01kymhg675k5z4pkmad9bdfzra, exit 0 — typecheck, oxlint, import cycles, plugin-boundary, database-first legacy-store guard); CI on the PR head.Review: fresh Codex autoreview (
gpt-5.6-sol, xhigh) over the branch diff. It caught two real defects in earlier revisions of this PR that are now fixed: an unquotedOPENCLAW_STATE_DIR=<path>one-liner that word-splits on the macOS app'sApplication Supportroot, and the fact that no Windows shell acceptsVAR=value cmdat all. Both are resolved by stating the directory in prose. The final run reports no accepted or actionable findings.