Skip to content

fix(plugins): preserve update failures and prevent duplicate settlement - #146483

Merged
steipete merged 2 commits into
mainfrom
steipete/upd-plugin-transaction-finalization
Sep 12, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/upd-plugin-transaction-finalization

Conversation

@steipete

@steipete steipete commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Plugin updates hide the actionable peer-link error when rollback also fails, and completed managed install results retain their staging transaction handle.

Fixes #146435
Refs #146434

Reported by @aniruddhaadak80 (#146435, #146434).

User Impact

Plugin update failures report the real cause instead of a rollback error, and install transactions can no longer be settled twice after successful completion. No configuration or migration is required.

Why This Change Was Made

The transaction owner now retains the primary error as the first aggregate member and cause, with its message first. Both peer-link finalization and the CLI's outer rollback path supply that primary failure.

Management takes and removes the handle before persistence owns settlement, so the completed result cannot spread it to another caller. Pending source adapters retain their existing handoffs. Batch settlement shares in-flight work and remembers successful completion; failed rollback remains retryable, preserving the directory owner's recovery contract.

The reported handle leak was reproduced. The existing directory transaction already guards successful settlement, so the stronger claim of repeated filesystem side effects was not reproduced with that owner; the batch-level regression demonstrates duplicate callbacks with generic transactions.

Evidence

The regressions ran on unchanged production code first:

install-transaction: expected callback once, got 4 times
management install (all six sources): expected transaction handle to be undefined
update-summary: expected peer-link cause; received "Plugin install transaction rollback failed"
CLI update: expected primary install failure; received "Plugin install transaction rollback failed"

After the fix, all 356 focused tests passed across install transactions, management install compensation, plugin updates, git installs, CLI updates, and hook-pack updates. The finalization and batch regressions are now colocated in install-transaction.test.ts to keep the plugin test shard within its unchanged 700-root budget.

The final combined regressions and shard-budget owner tests passed (29 tests):

node scripts/run-vitest.mjs src/plugins/install-transaction.test.ts test/scripts/tsgo-core-test-shards.test.ts

node scripts/check-changed.mjs passed its formatting, ratchet, dependency, and boundary checks, then stopped at an unrelated existing type error:

src/gateway/server-startup-finish.ts(416,37): TS2741
Property 'stop' is missing in an array passed as GatewayPostReadySidecarHandle.

The same error reproduced with all production changes in this PR temporarily reversed, using node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo. The fix was restored afterward.

Known gap: no published-driver × candidate installation smoke was run; proof covers the plugin and CLI finalization boundaries with synthetic fixtures.

Targeted Oxlint passed for the changed TypeScript files, including the combined regression file. The selected test typecheck (plugins-platform, config-cli) is blocked by the same pre-existing Gateway error. git diff --check passed.

The coercion-helper, deprecated-API, and dead-export guards also passed.

The first CI run caught the extra test-file count (plugins-platform: 701 test roots exceeds the 700 limit). Consolidating the two related regression suites fixes that failure without changing the cap or assertions; the cap owner's full 24-test suite now passes locally.

CI passed on d8c37ed583581cacdc7ead818a536ace3855fe15: run 34720278306. The exact-head watcher reported rollup=green, github_rollup=SUCCESS, pending=0, and GREEN. The previously failing shard-budget job also passed.

ClawSweeper review

The completed review of d8c37ed583581cacdc7ead818a536ace3855fe15 found no actionable code or security findings. Both remaining requests concern the same published-driver × candidate installation smoke. That broader smoke is deferred under the maintainer's explicit decision to land this scoped repair; the existing synthetic plugin/CLI regressions and exact-head green CI cover the changed finalization boundaries. No published-updater or full installation/recovery validation is claimed. No code fixups were needed.

Keep peer-link failures primary when rollback also fails, detach managed install handles before persistence, and share successful batch settlement. Preserve retryable rollback recovery.
@clawsweeper

clawsweeper Bot commented Sep 12, 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 docs Improvements or additions to documentation cli CLI command changes size: S maintainer Maintainer-authored PR labels Sep 12, 2026
@steipete
steipete marked this pull request as ready for review September 12, 2026 21:16
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 6:15 PM ET / 22:15 UTC (Revision 3).

ClawSweeper review

What this changes

Preserves original plugin update errors alongside rollback failures, removes completed installation handles, and prevents successful transaction settlement from repeating.

Merge readiness

✅ Ready for maintainer review

This remains a useful repair: current main and the latest release retain the error-masking path. No actionable correctness or security findings remain, and the PR body explicitly records the maintainer’s deferral of the prior smoke-test request.

Priority: P2
Reviewed head: d8c37ed583581cacdc7ead818a536ace3855fe15

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful regression coverage, successful exact-head CI, and no actionable findings; the broader smoke limitation is explicitly acknowledged.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies this as a member-authored PR, exempt from the external-contributor proof gate. Its tests exercise settlement, management completion, and CLI error propagation with synthetic fixtures; published-updater installation/recovery proof is explicitly unclaimed and deferred in the recorded maintainer disposition.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies this as a member-authored PR, exempt from the external-contributor proof gate. Its tests exercise settlement, management completion, and CLI error propagation with synthetic fixtures; published-updater installation/recovery proof is explicitly unclaimed and deferred in the recorded maintainer disposition.
Evidence reviewed 9 items Current main still needs the repair: The main finalizer awaits rollback before rethrowing the original error, while settlement constructs an aggregate containing only rollback failures. A rollback rejection therefore masks the original failure.
Latest-release comparison: The supplied latest release, v2026.9.4, contains the same rollback-before-rethrow path; no shipped fix is established.
Introduced settlement behavior: The pinned introduced diff preserves the primary failure as the first aggregate member and cause, shares in-flight settlement, remembers success, and clears failed settlement for retry. Both finalization callers supply the original failure.
Findings None None.
Security None None.

How this fits together

Plugin installation stages package files before committing installation records and configuration. Its transaction handling determines whether staged changes are finalized or restored and which errors reach the CLI.

flowchart TD
  A[Plugin install or update] --> B[Stage package files]
  B --> C[Installation transaction]
  C --> D{Finalization succeeds?}
  D -->|Yes| E[Commit and consume handle]
  D -->|No| F[Roll back staged changes]
  F --> G[Report original and cleanup errors]
  E --> H[Skip repeated settlement]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +32, Tests +87, Docs +2. Total +121 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 40 8 +32
Tests 3 88 1 +87
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 130 9 +121

Review metrics

Metric Value Why it matters
Production versus regression coverage production +32 net lines; tests +87 net lines Production growth implements failure aggregation and settlement bookkeeping, with focused regressions protecting those contracts.

Technical review

Best possible solution:

Keep failure aggregation and completed-handle consumption at the installation owner while preserving the directory owner’s retryable recovery behavior.

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

Yes, from source: simultaneous peer-link repair and rollback failures cause current main to lose the original error. The PR reports failing-before regressions; this review did not execute them.

Is this the best way to solve the issue?

Yes. The patch repairs the existing settlement and management boundaries, retains pending handoffs, and preserves failed-rollback retries without changing configuration or persisted formats.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs a bounded plugin-update diagnostic failure and transaction-lifecycle cleanup without evidence of a broader outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool 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 supplied repository state identifies this as a member-authored PR, exempt from the external-contributor proof gate. Its tests exercise settlement, management completion, and CLI error propagation with synthetic fixtures; published-updater installation/recovery proof is explicitly unclaimed and deferred in the recorded maintainer disposition.

Evidence

What I checked:

  • Current main still needs the repair: The main finalizer awaits rollback before rethrowing the original error, while settlement constructs an aggregate containing only rollback failures. A rollback rejection therefore masks the original failure. (src/plugins/update-summary.ts:105, ee89d82253ec)
  • Latest-release comparison: The supplied latest release, v2026.9.4, contains the same rollback-before-rethrow path; no shipped fix is established. (src/plugins/update-summary.ts:105, 3a9d69db306c)
  • Introduced settlement behavior: The pinned introduced diff preserves the primary failure as the first aggregate member and cause, shares in-flight settlement, remembers success, and clears failed settlement for retry. Both finalization callers supply the original failure. (src/plugins/install-transaction.ts:98, d8c37ed58358)
  • Installation handoff and existing filesystem guard: Management consumes the handle before persistence and before spreading the completed result. Pending adapters still pass through their transaction objects; the existing directory owner already memoizes successful settlement, consistent with the PR’s narrower claim rather than repeated filesystem damage. (src/plugins/management-install.ts:434, d8c37ed58358)
  • Focused regression coverage: Read coverage for duplicate and concurrent settlement, retry after failed rollback, primary-error precedence, completed-handle removal across six installation sources, and CLI double failure. Tests were inspected, not executed during this read-only review. (src/plugins/install-transaction.test.ts:10, d8c37ed58358)
  • Prior review disposition and proof scope: The supplied body snapshot, sourceRevision 7ad7e781d9e6c9220122e413727ba88e57b8337a8a14f042fa9071d6a16fd5bf, explicitly addresses the previous published-driver × candidate smoke request: it records maintainer-directed deferral and claims only synthetic plugin/CLI validation. A live PR read showed the same disposition and unchanged head. (d8c37ed58358)

Likely related people:

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

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 (2 earlier review cycles)
  • reviewed 2026-09-12T21:46:35.876Z sha d8c37ed :: blocked before merge. :: none
  • reviewed 2026-09-12T22:05:33.445Z sha d8c37ed :: blocked before merge. :: none

@steipete
steipete merged commit a9d273d into main Sep 12, 2026
202 checks passed
@steipete
steipete deleted the steipete/upd-plugin-transaction-finalization branch September 12, 2026 22:17
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 13, 2026
…nt (openclaw#146483)

Preserve the original plugin update failure when rollback also fails, keeping rollback errors as additional diagnostics. Consume completed managed install transaction handles and share successful or concurrent settlement, while retaining retryability after failed rollback in the existing recovery owner.

Regression evidence covers primary-error propagation through update finalization and the CLI, handle consumption across managed install sources, and duplicate/concurrent settlement. The authoring lane recorded failing-before/passing-after regressions and 356 passing focused tests; exact-head CI passed. Published-driver × candidate installation smoke remains a disclosed validation gap accepted for this scoped landing.

Fixes openclaw#146435
Refs openclaw#146434
Reported by @aniruddhaadak80 (openclaw#146435, openclaw#146434).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

[Bug]: Rollback error replaces root peer-link error in plugin update finalization

1 participant