Skip to content

fix: rehearse legacy exec approval conflicts before update activation - #153406

Merged
steipete merged 5 commits into
mainfrom
fix/update-lifecycle
Sep 24, 2026
Merged

steipete merged 5 commits into
mainfrom
fix/update-lifecycle

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

Related: #153401

What Problem This Solves

Fixes update rehearsal omitting legacy exec-approval conflicts or misreporting already-imported approval files before activation.

User Impact

Operators can rehearse legacy approval inputs against private candidate state while preserving the serving policy and original files.

Why This Change Was Made

The existing snapshot owner copies bounded legacy approval bytes with exclusive creation and link rejection, then rebases the matching migration receipt only in the private database. Doctor remains the policy and migration owner. The integration preserves main’s isolated-process SQLite acquisition, cleanup lifecycle, and plugin-code snapshot handling.

Evidence

Validation on the candidate integrated with fixed main 5050eb796c4ec58f301cf20fd5269e506a257c8d:

  • 104 tests passed across the registered snapshot-worker and exec-approval migration suites. The unchanged four regression cases cover ordinary and interrupted claims, retained receipt authority, and normalized cleanup. Previously captured causal controls fail against the unmodified snapshot implementation.
  • With --maxWorkers=1, the three-file run took 586.75 seconds wall time (569.24 seconds reported by Vitest), including a 147.06-second cold worker build. The four regression test bodies took 31.16 seconds combined.
  • Full changed-code checks passed, including the core and all 25 core-test type graphs, formatting, lint, policy guards, runtime import-cycle checks, and unused-export scans.
  • Managed independent review found no actionable P0–P2 issue.

Maintainer scope decision: accept this repair for an installed updater containing the new projection. It cannot retroactively change the snapshot worker selected by the published 2026.9.4 driver. Older-driver recovery remains tracked in #153401.

A fresh published-driver compatibility cell exercised registry [email protected] (build 3a9d69db306cd7f081e06254cb89c4bcc14a7107) against the exact 7eb9f1b1929ec97017c556e1c43ecb00d8263a7d candidate package. In an isolated Linux arm64 container with Node 24.19.0, the real installed openclaw update --tag file:<candidate.tgz> --yes --no-restart --json completed candidate migration rehearsal, Doctor lint, config validation, plugin resolution, continuation checks, and Gateway canary successfully, then swapped the candidate into place. Activation Doctor correctly refused the conflicting legacy exec-approval input. The updater exited 1 with state-migrated-no-rollback and serviceRestartSafe=false; this is a reproduced older-driver limitation, not a successful upgrade. Immediate read-only verification found the canonical deny policy (including its stored bytes and timestamp) and the 124-byte conflicting legacy file unchanged. The candidate build remained installed, and the disposable container was removed after evidence capture.

The canonical package build and tarball checks passed; the artifact SHA-256 is 2e5d112f5654491039e2d37794c2a7e6ca749fc4af809d8687c34ca22b0cfc03. Exact-head CI also passed. The 104 registered-worker/Doctor tests above provide the positive proof for an updater containing this change. An earlier isolated macOS attempt stopped before rehearsal because the old driver rejected unrelated legacy records in the host-wide handoff store; that attempt is retained separately and is not counted as successful coverage.

Original contribution by Dallin Romney (@RomneyDa).

@clawsweeper

clawsweeper Bot commented Sep 20, 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 size: S maintainer Maintainer-authored PR labels Sep 20, 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 20, 2026
@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 24, 2026, 4:11 PM ET / 20:11 UTC (Revision 6).

ClawSweeper review

What this changes

The branch copies legacy execution-approval files into private update rehearsal state and rebases the matching migration receipt so Doctor can check conflicts before activation.

Merge readiness

⛔ Blocked before merge - 4 items remain

Current main still omits legacy approvals from update rehearsal. The integrated branch addresses that gap for newer snapshot workers, but its scope for operators running published updaters needs an explicit update-owner decision.

Priority: P2
Reviewed head: 7eb9f1b1929ec97017c556e1c43ecb00d8263a7d
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The owner-boundary patch and regressions are focused, but the required current-head published-driver check remains incomplete.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Current-head tests exercise the registered snapshot worker and Doctor on isolated state, while the earlier published-driver comparison establishes the older driver's limitation; a complete current-head published-driver upgrade remains unshown. Existing-receipt compatibility is covered by the worker and Doctor regression.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Current-head tests exercise the registered snapshot worker and Doctor on isolated state, while the earlier published-driver comparison establishes the older driver's limitation; a complete current-head published-driver upgrade remains unshown. Existing-receipt compatibility is covered by the worker and Doctor regression.
Evidence reviewed 7 items Introduced projection: The pinned base-to-head patch adds bounded, link-rejecting copies of legacy approval files and changes only the private snapshot's matching receipt identity.
Integrated snapshot path: The current PR head rebases the receipt during the isolated-process SQLite snapshot and copies approval sources into private state before candidate checks.
Current main still lacks the change: The fetched main snapshot implementation has no approval-file projection or receipt rebase; its snapshot entry point remains present.
Findings None None.
Security None None.

How this fits together

The updater copies serving state into a private candidate environment, then runs Doctor and other checks before activating the update. Doctor compares legacy approval files with SQLite policy and migration receipts in that environment.

flowchart LR
A[Installed updater] --> B[Snapshot worker]
C[Serving SQLite and approval files] --> B
B --> D[Private candidate state]
D --> E[Candidate Doctor]
E --> F{Approval conflict?}
F -->|Yes| G[Stop before activation]
F -->|No| H[Continue update]
Loading

Decision needed

Question Recommendation
Should this PR land as a future-driver improvement while the published 2026.9.4 updater's late-conflict recovery remains tracked separately? Accept future-driver scope: Land the private rehearsal improvement once current-head boundary proof is recorded, and keep older-driver recovery in the linked issue.

Why: Candidate code cannot recover an approval file omitted by the installed driver's snapshot worker; accepting that rollout scope requires update-owner intent.

Before merge

  • Resolve merge risk (P1) - The published 2026.9.4 updater still omits legacy approval files from its own rehearsal snapshot, so this branch does not prevent the reported late conflict for that installed-driver path.
  • Resolve merge risk (P1) - The prior driver × candidate comparison predates the integrated head; the PR reports current-head worker and Doctor tests but no current-head published-driver upgrade check.
  • Complete next step (P2) - Record update-owner acceptance of the future-driver-only scope and a current-head published-driver × candidate check before merge.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +81, Tests +141. Total +222 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 83 2 +81
Tests 1 141 0 +141
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 224 2 +222

Review metrics

Metric Value Why it matters
Production versus test growth production +81 net lines; tests +141 lines The production growth implements the private projection, while the tests cover the registered worker and Doctor boundary.
Reported regression cost 4 cases: 31.16 s in test bodies; 3-file run: 586.75 s wall The PR reports a substantial per-PR validation cost, including a 147.06-second cold worker build.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain Doctor's hash-based policy decision in private rehearsal state, establish the supported updater versions, and provide an in-product Doctor recovery path for older installed drivers.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain Doctor's hash-based policy decision in private rehearsal state, establish the supported updater versions, and provide an in-product Doctor recovery path for older installed drivers.

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

Yes, at source level: current main snapshots SQLite without the legacy approval file, while Doctor checks for that file in its state root. This review did not run an upgrade.

Is this the best way to solve the issue?

Yes for newer drivers: the projection stays with the snapshot owner and leaves Doctor's policy decision intact. The published 2026.9.4 driver needs a separate recovery decision.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against d5e6383f4802.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded update-rehearsal repair, with the published-driver limitation still requiring an owner decision.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Current-head tests exercise the registered snapshot worker and Doctor on isolated state, while the earlier published-driver comparison establishes the older driver's limitation; a complete current-head published-driver upgrade remains unshown. Existing-receipt compatibility is covered by the worker and Doctor regression.

Evidence

What I checked:

  • Introduced projection: The pinned base-to-head patch adds bounded, link-rejecting copies of legacy approval files and changes only the private snapshot's matching receipt identity. (src/infra/update-candidate-exec-approvals.ts:23, 7eb9f1b1929e)
  • Integrated snapshot path: The current PR head rebases the receipt during the isolated-process SQLite snapshot and copies approval sources into private state before candidate checks. (src/infra/update-candidate-state.ts:622, 7eb9f1b1929e)
  • Current main still lacks the change: The fetched main snapshot implementation has no approval-file projection or receipt rebase; its snapshot entry point remains present. (src/infra/update-candidate-state.ts:570, d5e6383f4802)
  • Doctor receipt boundary: Doctor treats a prior import receipt as authoritative only when the source hash matches; otherwise it preserves conflicting legacy policy for recovery. (src/infra/state-migrations.exec-approvals.ts:152, 7eb9f1b1929e)
  • Registered worker regressions: Four added cases exercise the snapshot worker followed by Doctor for conflicting files, interrupted claims, and an existing receipt after a policy edit. The PR body reports 104 passing tests on the integrated branch; this read-only review did not execute them. (src/infra/update-candidate-state.exec-approvals.test.ts:30, 7eb9f1b1929e)
  • Published-driver limitation: The PR discussion reports a published 2026.9.4 driver × candidate check: the installed driver omitted legacy JSON from its snapshot, so the candidate could not detect the conflict. The PR body says a complete published-driver installation upgrade was not run for the integrated branch.

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record the update owner's decision on the future-driver-only scope.
  • Record a current-head published-driver × candidate result for existing conflicting approval state.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (5 earlier review cycles)
  • reviewed 2026-09-20T03:58:18.365Z sha 3215785 :: blocked before merge. :: [P1] Preserve migration receipt identity when copying legacy approvals
  • reviewed 2026-09-20T04:12:00.973Z sha 0b930a4 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-20T04:18:37.306Z sha 0b930a4 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-20T04:45:47.410Z sha 0b930a4 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T10:57:15.705Z sha 0821429 :: blocked before merge. :: none

@RomneyDa

Copy link
Copy Markdown
Member Author

Addressed the accepted receipt-identity finding in cffbe14; 0b930a4 adds the exact interrupted cleanup fixture requested by review. Private snapshots rebase only the matching exec-approvals migration receipt. All four dedicated tests pass, including normalized null usage metadata, failed source cleanup, retained .doctor-importing recovery, and unchanged live claimed bytes. Independent full-branch P0–P2 review was scoped-clean; the added exact-scenario regression received fresh peer review.

Published-driver × candidate boundary proof used a separate checkout of 2026.9.4 e46e3746bb5, its actual prepareUpdateCandidateStateSnapshot, and a separate subprocess running the patched candidate migration:

Driver Profile Candidate result Source
Published e46e374 Fresh No legacy input, no conflict Preserved
Published e46e374 Existing conflicting JSON + SQLite JSON omitted; conflict not detected Preserved
Patched Fresh No legacy input, no conflict Preserved
Patched Existing conflicting JSON + SQLite JSON copied; conflict detected before activation Preserved

The negative published-driver cell is an explicit compatibility limitation, not a claimed pass: that driver launches its own snapshot worker, so candidate code cannot recover input already omitted by the parent. This patch improves future installed drivers and does not change any live schema or policy. Full core/core-test types, dead-export checks, targeted lint, and the relevant services test type graph passed. Current CI is still running with no failures reported.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 20, 2026
steipete and others added 2 commits September 24, 2026 02:02
)

Project legacy execution approvals into isolated candidate state without
removing the original policy during update rehearsal. Reuse the migration
owner constants and cover interrupted cleanup.

Co-authored-by: Dallin Romney <[email protected]>
Keep legacy exec-approval projection and private receipt rebasing while
retaining the canonical isolated-process snapshot acquisition and cleanup.
Original policy bytes and the serving database remain unchanged.

Co-authored-by: Dallin Romney <[email protected]>
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 24, 2026
@steipete
steipete merged commit 7f7f668 into main Sep 24, 2026
219 checks passed
@steipete
steipete deleted the fix/update-lifecycle branch September 24, 2026 21:31
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 25, 2026
…openclaw#153406)

* fix: rehearse legacy exec approval conflicts before update activation

* fix: preserve legacy policy receipt authority in update rehearsal

* test: cover interrupted legacy policy cleanup during update rehearsal

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

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

2 participants