Repository navigation
fix(exec): recover after doctor migration without gateway restart - #118769
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 12:47 PM ET / 16:47 UTC. ClawSweeper reviewWhat this changesThe PR changes the exec-approval migration gate to cache only confirmed absence, allowing a long-lived Gateway to recover on its next exec attempt after a separate Doctor process removes legacy approval state. Merge readinessKeep this maintainer-labeled PR open for normal merge review. The patch fixes the confirmed cross-process cache-ownership bug without weakening the existing fail-closed source/claim check, and its focused regression covers the required present → removed → next read succeeds sequence. Priority: P1 Review scores
Verification
How this fits togetherBefore agent shell execution can read the SQLite exec-approval store, Gateway and node-host callers pass through a migration gate that blocks retired JSON approval state. The Doctor CLI claims, migrates, and removes that retired state, after which the running process must observe the completed migration without a restart. flowchart LR
LegacyState[Legacy approval file or Doctor claim] --> Gate[Exec migration gate]
Doctor[Doctor migration process] --> LegacyState
Gateway[Gateway exec request] --> Gate
NodeHost[Node-host exec request] --> Gate
Gate --> Store[SQLite approval store]
Store --> Exec[Agent shell execution]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -6, Tests +17. Total +11 across 3 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Land the focused cache-ownership repair after the remaining required checks complete, retaining the source/claim probe and the new regression that proves recovery without a Gateway restart. Do we have a high-confidence way to reproduce the issue? Yes, from current-main source and the PR's stated live observation: make the gate see Is this the best way to solve the issue? Yes. Caching only authoritative absence fixes the actual process-boundary ownership error while retaining the existing fail-closed probe whenever a source or active Doctor claim exists. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 36a2b5b00b3f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
ClawSweeper follow-up for head The latest review contains no |
|
Merged via squash.
|
Closes #118762
What Problem This Solves
Fixes an issue where agents using exec could remain blocked by a legacy-approvals migration error after an operator had successfully run
openclaw doctor --fix. Because the running Gateway retained the refusal until restart, repeating the prescribed repair did not restore exec.Why This Change Was Made
The migration gate cached both absence and presence for the process lifetime. A Gateway that observed the retired JSON or Doctor's temporary claim therefore kept treating that observation as current even when a separate Doctor CLI process removed the state.
The gate now caches only the steady-state absence. A real source or
.doctor-importingclaim still fails closed with the same typed, actionable error, but that positive observation is re-probed on the next attempt. This keeps the normal path free of repeated filesystem work and makes a completed separate-process Doctor migration visible without cross-process signaling.The existing source-claim-source probe already bounds Doctor's rename window. A settle timer or retry delay would add timing policy without improving the required invariant: if an attempt overlaps the rename/removal window, it may fail closed once, then the next attempt re-probes. The obsolete same-process cache-reset hook was removed so correctness no longer depends on which process runs Doctor.
User Impact
After Doctor migrates and removes retired exec-approval state, the next exec attempt can proceed without restarting the Gateway. Exec remains blocked while either the legacy source or Doctor claim genuinely exists.
Evidence
Observed before the repair on maintainer build
39c506b: the Gateway continued returningExecApprovalsMigrationRequiredErrorafter a separatedoctor --fixcompleted, and recovered only after restart.Focused gate/store/Doctor proof:
The regression runs the real filesystem order for both
exec-approvals.jsonand.doctor-importing: present -> same typed/actionable error -> remove without reset -> next store call succeeds.Exec and node-host caller proof:
Touched-file gate:
This covered formatting, production/test typechecks, targeted lint, Plugin SDK and dependency guards, dead exports, native schema v6, database-first legacy-store rules, runtime import cycles, and the remaining core architecture guards.
Codex autoreview: clean, no accepted/actionable findings (
gpt-5.6-sol, high reasoning, 0.98 confidence).LOC: production
+13/-19(net-6); tests+30/-13(net+17). No config, schema, protocol, or public API changes.