Repository navigation
fix(doctor): allow legacy exec approvals migration - #133773
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs real behavior proof before merge. Reviewed August 31, 2026, 3:53 AM ET / 07:53 UTC. ClawSweeper reviewWhat this changesThe PR changes Doctor’s legacy-state flow so retired exec-approval JSON is imported before approval-store reads and obsolete generated approvals are renewed afterward. Regression provenancePossible regression — probable (reproduction; reviewed change; failure trace). No predecessor PR is attributed. Merge readiness⛔ Blocked until real behavior proof is added - 3 items remain Keep this PR open: the current head addresses the prior ordering finding and no blocking code defect was found, but exact-head real behavior proof is still missing for this persistent-state upgrade repair. Priority: P1 Review scores
Verification
How this fits togetherDoctor checks and repairs an OpenClaw installation’s configuration and retired state during recovery. It imports legacy approval JSON into the canonical SQLite store, then security diagnostics and approval cleanup use that store. flowchart LR
A[Retired approval JSON] --> B[Doctor legacy-state flow]
B --> C[SQLite approval migration]
C --> D[Approval-store reads]
D --> E[Security diagnostics]
C --> F[Generated approval cleanup]
E --> G[Doctor completion]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +30, Tests +70. Total +100 across 6 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep ordinary approval access fail-closed, while Doctor’s legacy-state owner imports the retired file before performing the canonical-store cleanup and demonstrates that upgrade path on the exact head. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main invokes a gated cleanup before the Doctor-owned import, and the supplied released-version reports document that path. This read-only review did not execute the external PR head. Is this the best way to solve the issue? Yes: moving cleanup behind the one migration owner preserves the normal runtime gate and fixes the actual ordering violation; disabling the gate would be a weaker alternative. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e7bacb6e552a. 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 (3 earlier review cycles)
|
e30d375 to
dbe033a
Compare
dbe033a to
367c3fb
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Confirmed this is still in shipped 2026.8.1 (ea80657) on a macOS LaunchAgent upgrade from
Filed as #133813 (prior reports #132495 / #132768 were closed as main-only). |
|
I reproduced the shipped failure behind this PR in an isolated Docker fixture using exact published packages and synthetic state only. Reproduction
Control runs ( That matches the retained generation reported in #133828. Adding a valid legacy
Recovery control also passed: preserve/move the legacy approvals file, complete Doctor/import, then run This proves the immediate Doctor deadlock is a shipped, user-visible upgrade blocker and that this PR owns the correct trigger. It also exposes a separate generic updater-containment gap after any post-swap/pre-convergence failure; that should remain outside this PR. Important scope note: this evidence reproduces the defect and recovery path. It does not yet validate PR head |
|
Confirmed this issue on a real upgrade from OpenClaw 2026.6.11 → 2026.8.1 (ea80657). My reproduction matches the problem described in this PR:
So this PR's root-cause description matches the behavior I'm seeing, particularly Doctor reaching the approval migration gate before completing its own JSON → SQLite migration. Happy to test the fix against this affected installation once there is a build/release containing it. |
Exact-current-head real behavior proofPR head: I exercised the The command ran with an empty environment (
Observed terminal result: Persisted-state verification after the process exited:
A second fresh fixture kept bundled plugins enabled. It repeated the import and cleanup, then reached real plugin-registry convergence: Its canonical row again preserved An immediate second isolated Doctor run converged cleanly: Current-head hosted proof also passes the relevant shards:
This proof covers only the legacy exec-approval Doctor deadlock. It does not claim or absorb the generic post-swap updater-containment, Discord generation-selection, or Terminal CI classificationCI run 33369638499 attempt 2 finished with 180 success, 17 skipped, and 13 failure. Twelve leaf failures are outside this PR's six changed Doctor files:
Build, full The separate
|
|
Exact-head release-regression proof for
Final state: {"exit":0,"sourceRemoved":true,"receipt":{"status":"completed","removed_source":1},"patterns":["=command:durable"]}This proves the old schema is repaired first, the Doctor-owned import remains reachable, cleanup runs after import, the durable rule remains, and Doctor completes in one process run. |
|
Thanks @dailytrap! Proof: State created by published
|
## What Problem This Solves Updating from `2026.7.1-2` to `2026.8.1` can leave the Gateway unavailable when the old release wrote `exec-approvals.json`. `openclaw doctor --fix` reached gated exec-approval reads and cleanup before the Doctor-owned JSON-to-SQLite import could finish. The command exited with an instruction to run itself and repeated the same failure after restart. ## Root Cause - `2026.8.1` added a fail-closed gate around the canonical SQLite approval store. - Doctor security diagnostics and generated-rule cleanup called that gate before the later legacy-state owner imported the retired JSON. - Moving cleanup after import initially coupled it to the aggregate legacy-state prompt, so declining an unrelated migration also skipped approval cleanup. ## Fix - Load approval state once for Doctor security diagnostics and skip only approval-dependent checks while the migration gate is pending. - Run generated approval cleanup in the legacy-state contribution after its import owner has run. - Let a declined unrelated migration skip that migration only; Doctor-only approval cleanup remains reachable. - Preserve the gate for every normal runtime reader and writer. ## Evidence Exact-head redacted terminal proof: openclaw#133773 (comment) 1. Published `[email protected] approvals allowlist add /usr/bin/rg` created the retired version-1 JSON in an isolated state directory. 2. Published `[email protected] doctor --fix --non-interactive --no-workspace-suggestions` exited `1` with `Legacy exec approvals exist ... Run openclaw doctor --fix`. 3. A second process run exited `1` with the same message. 4. The candidate source command exited `0`, printed `Imported legacy exec approvals into shared SQLite state.` and `Doctor complete.`, recorded a completed migration receipt, and removed the retired source. ## Validation - Full affected Doctor suites: 193 passed. - Focused published-owner, security-continuation, and interactive-decline regressions: 3 passed. - Oxfmt, Oxlint, and `git diff --check`: passed. - Production delta: `+71/-41`, net `+30`; this is down from the prior net `+43` after consolidating duplicate proof and removing avoidable branches. - Local TypeScript typecheck and build were not run on this host; exact-head CI owns those gates. Co-authored-by: Ayaan Zaidi <[email protected]>
Fix the Doctor/update loop caused by empty legacy exec-approvals JSON and interrupted import claims. Recognize only the exact policy-free shape, archive and verify its bytes, and finish the existing receipt/cleanup flow. Preserve usable socket credentials through the canonical import when SQLite is absent; never replace existing policy with an empty stub. Reported by Discord users uniqueason and Akarxo; Eisenh0rn40 highlighted the workaround. Follow-up to #133813 and #133773. Closes #135968. Verified with failing pre-fix regressions, 134 passing migration/store/parser/socket tests, real valid/invalid-token UDS proof, and five isolated dist-backed Doctor/Gateway health checks. No configuration, schema, protocol, or dependency changes.
Fix the Doctor/update loop caused by empty legacy exec-approvals JSON and interrupted import claims. Recognize only the exact policy-free shape, archive and verify its bytes, and finish the existing receipt/cleanup flow. Preserve usable socket credentials through the canonical import when SQLite is absent; never replace existing policy with an empty stub. Reported by Discord users uniqueason and Akarxo; Eisenh0rn40 highlighted the workaround. Follow-up to openclaw#133813 and openclaw#133773. Closes openclaw#135968. Verified with failing pre-fix regressions, 134 passing migration/store/parser/socket tests, real valid/invalid-token UDS proof, and five isolated dist-backed Doctor/Gateway health checks. No configuration, schema, protocol, or dependency changes.
What Problem This Solves
Updating from
2026.7.1-2to2026.8.1can leave the Gateway unavailable when the old release wroteexec-approvals.json.openclaw doctor --fixreached gated exec-approval reads and cleanup before the Doctor-owned JSON-to-SQLite import could finish. The command exited with an instruction to run itself and repeated the same failure after restart.Root Cause
2026.8.1added a fail-closed gate around the canonical SQLite approval store.Fix
Evidence
Exact-head redacted terminal proof: #133773 (comment)
[email protected] approvals allowlist add /usr/bin/rgcreated the retired version-1 JSON in an isolated state directory.[email protected] doctor --fix --non-interactive --no-workspace-suggestionsexited1withLegacy exec approvals exist ... Run openclaw doctor --fix.1with the same message.0, printedImported legacy exec approvals into shared SQLite state.andDoctor complete., recorded a completed migration receipt, and removed the retired source.Validation
git diff --check: passed.+71/-41, net+30; this is down from the prior net+43after consolidating duplicate proof and removing avoidable branches.