Skip to content

fix(update): preserve failures before mutation admission - #186977

Merged
vincentkoc merged 7 commits into
mainfrom
fix/update-preactivation-failure-inspection-20261029
Oct 29, 2026
Merged

vincentkoc merged 7 commits into
mainfrom
fix/update-preactivation-failure-inspection-20261029

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

A failed update could start strict state-schema inspection after update mutation was never admitted and the previous Gateway had already been restored. The live writer could then make inspection fail and replace the original error with a misleading rollback-state failure.

User Impact

Failed pre-mutation updates retain their original error and predecessor recovery. Post-mutation failures and explicit state-risk refusals still require strict inspection. No configuration or schema change is required.

The fix belongs to the initiating updater. It applies when an updater containing this change starts the operation; installing a candidate cannot retroactively change an older driver already running an update.

Why This Change Was Made

The outer command lifecycle owns the authoritative mutationStarted fact. It now uses that fact for failed executions without explicit state risk. The inspection helper, executor fences, recovery-root checks, cleanup, and existing recovery mode remain unchanged.

Production delta: +7 lines. Five boundary cases add 167 test lines and one routing entry. Under the landed independent budget policy, this PR allocates exactly those 167 lines in its own record. The shared scalar is unchanged. The current CI merge passes the ratchet at 6,246,370 lines against an effective 6,320,337 ceiling.

Evidence

  • Final signed candidate: 6b639cb19c75d6a22ca25e0a02623b105841d5c0, based on policy merge f996c1c487a0fcb456a73c9af49e360b99d14de5. Independent source review verified the four-path delta, signature, preserved guard and unchanged 167-line regression. Exact-head CI completed SUCCESS: 48 successful jobs, 27 skipped, no failures. Its tested merge is cf53302bea11ed155fd4b65c514110a28dfd9e69 on base b0e65d76509dd60d097ba47049cf749dd8c6c6c0.
  • ClawSweeper revision 6 reviewed that exact head: no findings, no before-merge item and no Rank-up list. The optional shipped initiating-driver failure demonstration is explicitly addressed below.
  • Paired unchanged-production Linux control: both Git and package cases fail specifically at unwanted candidate continuation, after proving stop → capture failure → exactly one predecessor restart. Three post-admission/state-risk cases pass.
  • Current-head focused proof: 105/105 tests pass across the outer-command regression (5), mutable execution (49), selected-target recovery (24), cleanup recovery (6) and migrated-schema suite (21). All five new cases are visible in job 123234213096. The current CI also passed schema-cleanup (11) and service-unavailable/no-op admission (20) cases.
  • Current PostgreSQL conformance passed all four updater cases with a real PostgreSQL connection, within a 47-file/267-test shard. All three PostgreSQL shards passed. This supersedes the earlier source-equal upstream component evidence.
  • The current merged-tree ratchet passes at 6,246,370 / 6,320,337, with 73,967 existing spare lines. The new allocation is exactly the PR's 167 added test lines; it neither changes the shared scalar nor grants extra credit.

Packaged Upgrade Proof

The published-driver × candidate base cell passed once in 1,177 seconds, with cleanup joined: published [email protected] upgraded through its updater to candidate 2026.10.8; migration, package identity, state survival, Doctor and Gateway readiness/status checks passed after a manual restart.

Harness/package source: 89c8f06eb3287d7de85ec5eee720f33faaaa6400. Package SHA-256: 14873aa1f1fc7673545dd8a86887c7b036a0eacae9b62834c16f8dc7d0530d7d. Proof artifact 12851213352, SHA-256 e218c1bec93a1a811f246e50224045f3d0e47fac46ee5939ae4a74c703d2fc67. First-hop post-core attribution is unavailable/original outcome unknown, and nested update output is truncated at 16 KiB. This is historical installed upgrade compatibility proof at 89c8, not complete first-hop attribution, automatic-restart proof or packaged execution of the successor.

The overall Package Acceptance workflow failed the unchanged installed-tree entry budget: 47,621 > 47,500, while size passed at 584.1 MiB < 900 MiB and package integrity passed. An earlier ancestor package already failed at 47,608 entries. The exact contribution of this PR to the count difference has not been isolated. No package cap was raised and no CI exception is claimed for this manual workflow.

Limits and Follow-ups

  • No live update replay. The original cancellation initiator remains unknown. The separate inherited Doctor schema-guard fixture was not selected by this CI run; no execution claim is made for that file.
  • The late-failure case proves recorded mutation admission, not a physical package rewrite. Typed unreadable-state errors are injected conservative-policy coverage; their reachability from the capture read is unproven.
  • The optional ClawSweeper packaged initiating-driver failure proof is deferred: maintained package fault hooks begin after publication or bypass the outer command. They lack the managed-context capture-failure boundary; adding that fault and lifecycle setup is separate proof work. Paired real-command regressions prove the changed failure ordering, while the historical published-driver cell covers installed upgrade compatibility.
  • Named follow-ups: audit typed state-risk propagation before managed-context capture compensation; reduce installed release footprint without deleting supported runtime/compatibility artifacts. The shared-scalar conflict follow-up is resolved by PR187164.

Skip post-activation schema inspection after failed execution before mutation admission, preserving the original error and predecessor recovery. Keep inspection for post-admission and explicit state-risk failures.

Prove the command boundary for Git and package updates; adjust the test-line ceiling to the exact required total with no reserve.
@vincentkoc vincentkoc self-assigned this Oct 28, 2026
@clawsweeper

clawsweeper Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: M labels Oct 28, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review October 28, 2026 18:52
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper review

Please review head 44211dd. Paired original-order Git/package controls fail on the old owner; the repaired five cases plus recovery siblings pass (105 total). Exact staged test-line count and targeted type-aware lint passed. The final boolean syntax change is equivalent under the required internal boolean contract and independently reviewed. Live incident cancellation attribution remains unknown; no live update replay is claimed.

@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 28, 2026
@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Skip post-activation state inspection after failed updates that never admitted mutation, unless explicit state risk requires inspection.

Example: Managed Gateway context capture fails with AbortError: CLI stopping before mutation admission.

  • Before: The predecessor restarts, but a subsequent inspection can replace the original failure with rollback-state-unverified.
  • After: The update retains update-failed and the capture error without inspecting the restored predecessor's live state.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, useful repair with meaningful command-boundary regressions and no identified correctness defect; changed-path evidence remains harness-based.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate. Changed-path coverage is an in-process outer-command regression with injected failures, not shipped initiating-driver output; the previously suggested packaged failure demonstration remains optional.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A failed update can lose its original diagnostic and appear to have unsafe rollback state after the previous Gateway has already recovered.
Reason: The maintainer-authored direction restores accurate failure reporting using existing lifecycle facts and preserves conservative handling when mutation or explicit data risk exists.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR fixes a source-verifiable updater failure still present on main, with no actionable introduced defect found.

Priority: P2
Reviewed head: 6b639cb19c75d6a22ca25e0a02623b105841d5c0

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The shipped initiating updater has not been shown exercising the pre-mutation capture failure; the historical upgrade run covers a different scenario.
Agent review details

How this fits together

The update CLI coordinates installation mutation, Gateway recovery, state inspection, and final reporting using execution facts returned by the mutable-update owner.

flowchart TD
  A[Update CLI] --> B[Mutable update execution]
  B --> C[Mutation admission and recovery facts]
  C --> D[Finalization decision]
  D --> E[State inspection when required]
  D --> F[Preserve original failure]
  E --> G[Finalize update result]
  F --> G
Loading

Technical review

Best possible solution:

Use the existing execution owner's mutation-admission fact to preserve pre-mutation failures while retaining post-mutation and explicit-state-risk inspection.

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

Source shows schema capture followed by a pre-admission context failure and predecessor restart, after which main still runs strict inspection; supplied paired controls report the expected failure, but no reproduction was executed during this review.

Is this the best way to solve the issue?

This is the smallest complete fix: the command already receives authoritative mutation admission, and the condition preserves existing inspection and recovery owners without adding another path or state store.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8d46327b2656.

Provenance checked

  • Post-activation inspection selection changes intended behavior with a stated reason (16095df: The recorded workflow consolidation preserved existing migration and recovery behavior; its parent already had this call. Inspection protects against reopening migrated state through an incompatible runtime, rather than requiring scans after untouched failures.)
  • Database-worker test routing keeps the original intent (c93810d: Existing update tests were split into independently scheduled files while retaining database isolation and ordinary CI coverage.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +7, Tests +168, Other +2. Total +177 across 4 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 19 12 +7
Tests 2 168 0 +168
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 4 189 12 +177

Review metrics

Metric Value Why it matters
Production versus regression growth Production net +7 lines; regression tests +167 lines The production change reuses existing state; the tests distinguish two installation paths and conservative inspection boundaries.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A failed advanced update workflow can report a misleading rollback failure after predecessor recovery; the fix has a limited, well-defined boundary.
  • 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.

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.

History

Review history (5 earlier review cycles)
  • reviewed 2026-10-28T19:00:20.804Z sha 44211dd :: needs changes before merge. :: [P2] Allow an unset execution capture before asserting it
  • reviewed 2026-10-28T19:07:50.692Z sha 5e0aecb :: needs maintainer review before merge. :: none
  • reviewed 2026-10-28T20:25:18.523Z sha 89c8f06 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-28T20:55:18.752Z sha 12c7128 :: needs changes before merge. :: none
  • reviewed 2026-10-28T21:22:01.874Z sha 352a9c1 :: needs maintainer review before merge. :: none

Reviewed October 28, 2026, 10:57 PM ET / October 29, 2026, 02:57 UTC (Revision 6).

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review current head 5e0aecb. The only change since 44211dd is the CI TS2454 correction: the closure-populated test capture now includes | undefined; its existing assert(execution) and all behavioral assertions remain unchanged. Production is unchanged, the type-only delta has independent source approval, and fresh exact-head CI is running. Preserve any still-applicable findings from the earlier head.

@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 28, 2026
Baseline-Refresh: 05a4760ddd958834ae118e956fb2ebdb24c96bf8
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 28, 2026
Baseline-Refresh: b01db85e27e028b595b0aad523099838a9bfd407
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head 352a9c1563ade2c991e41552c41feb85dec1f111. The native baseline refresh resolves the sole shared test-budget conflict against pinned main bf6a97a1761ed7f752544f4934aa708b9d896bd3; guard, regression, and routing blobs are unchanged. The exact native count passes at 6,311,539 with no spare allowance. Independent source review is clean and fresh CI is running: https://github.com/openclaw/openclaw/actions/runs/40770610493.

The completed 89c8 published-upgrade cell passed once in 1,177 seconds with cleanup joined. The PR body now records its source/package/artifact identity, manual-restart and first-hop limitations, inherited component proof, and the still-failing installed-entry budget. The optional packaged initiating-driver failure reproduction remains explicitly deferred because the maintained fixtures lack this pre-mutation capture boundary.

@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 28, 2026
@vincentkoc
vincentkoc enabled auto-merge (squash) October 28, 2026 21:26
@vincentkoc
vincentkoc disabled auto-merge October 29, 2026 02:34
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@vincentkoc
vincentkoc merged commit 5ae646b into main Oct 29, 2026
155 checks passed
@vincentkoc
vincentkoc deleted the fix/update-preactivation-failure-inspection-20261029 branch October 29, 2026 03:19
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 29, 2026
…6977)

* fix(update): preserve failures before mutation admission

Skip post-activation schema inspection after failed execution before mutation admission, preserving the original error and predecessor recovery. Keep inspection for post-admission and explicit state-risk failures.

Prove the command boundary for Git and package updates; adjust the test-line ceiling to the exact required total with no reserve.

* test(update): type the pending execution capture

* fix(ci): bind test budget to the inspected merge count

* fix(update): allocate preactivation regression coverage independently
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes 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.

1 participant