Skip to content

fix(plugins): serialize lifecycle mutations and preserve setup-required installs - #112763

Merged
steipete merged 4 commits into
mainfrom
steipete/plugin-installation-stress-testing-da12ec
Jul 23, 2026
Merged

steipete merged 4 commits into
mainfrom
steipete/plugin-installation-stress-testing-da12ec

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #112718
Closes #112719

AI-assisted implementation and review.

What Problem This Solves

Fixes two plugin lifecycle failures found through install/uninstall stress testing:

  1. Concurrent plugin lifecycle commands sharing one OpenClaw state directory could race, causing one valid install to fail with config changed since last load after lifecycle work had begun.
  2. Plugins whose manifest requires setup configuration could fail after package staging because install enabled them with empty config; cleanup could then lose retry ownership or fail validation.

Why This Change Was Made

Plugin artifact mutation, the shared SQLite install index, plugin policy, and config writes are one lifecycle boundary even when operations target different plugin IDs. This change adds a shared cross-process SQLite lease around complete mutating flows, including CLI, Gateway management, chat policy changes, Claw package ownership, and post-core plugin convergence.

Install persistence now distinguishes missing configuration from authored invalid configuration. Missing required config records the install disabled while preserving plugin policy and normalizing allow/deny state; invalid authored config fails without rewriting it. Managed uninstall disables first while retaining config and the install record, removes the artifact, then re-reads and replans with fresh include guards before committing final cleanup. Failed deletion remains disabled and retryable.

User Impact

  • Concurrent plugin install/update/uninstall operations serialize instead of losing races.
  • Setup-required plugins can be installed before credentials or required settings are available; OpenClaw leaves them disabled and prints the configure-then-enable command.
  • Invalid authored plugin config is preserved and reported rather than erased.
  • Failed managed-directory cleanup retains enough ownership state for a safe uninstall retry.
  • Plugin dry runs remain read-only, and enabled/disabled policy mutations share the same lifecycle lock.

Evidence

  • Hosted marketplace lifecycle sweep: 79/79 current feed entries passed in isolated state directories. Each entry exercised install, runtime inspect, plugin doctor, update dry-run, uninstall, and post-uninstall doctor/list. Blacksmith Testbox runs included tbx_01ky4ayymfqvkb82ywh0fa4b3b, tbx_01ky4gv6rqp9tch88m0ff4pm8z, tbx_01ky4rjy5vyvgc5h71p11410fr, and tbx_01ky4x00wbhs998er2darzc13r; initial run: https://github.com/openclaw/openclaw/actions/runs/29899649575
  • Required-config real package path: clawhub:@aws/[email protected] installed disabled with an actionable warning, inspected cleanly, passed plugin doctor, uninstalled, and passed plugin doctor again on Linux Testbox.
  • Concurrent writer regression: 12/12 fresh-state iterations passed after the fix. Each iteration ran different plugin installs concurrently, then raced install/uninstall and verified final doctor/config state. Before the fix, 12/12 different-plugin install attempts had one command fail.
  • Live OpenAI isolated Gateway: QA Lab started a temporary loopback Gateway and completed a real openai/gpt-5.6-luna turn with exact reply OPENCLAW-LIVE-PLUGIN-GATEWAY-OK (runId=f6fac289-0e3b-4617-ba1b-04b09ae227f9). Blacksmith correctly refused secret forwarding and direct AWS was unavailable, so trusted-source live proof used the documented local isolated fallback.
  • Live plugin reload QA: plugin-lifecycle-hot-reload passed on Blacksmith Testbox with the mock OpenAI lane.
  • Focused tests passed across plugin persistence, cross-process lease contention, dangling-symlink cleanup, install/uninstall CLI, management service, chat commands, Claw package ownership, update finalization, and post-core convergence.
  • pnpm build passed.
  • Final hosted changed gate passed on Blacksmith Testbox tbx_01ky5rf4vt0q2rabdpjky7gsr1: typecheck, core test types, full core lint shards, formatting, plugin boundaries, SDK API baseline, import cycles, state guards, and related checks. https://github.com/openclaw/openclaw/actions/runs/29955551057
  • pnpm docs:check-mdx and pnpm docs:check-links passed.
  • Codex autoreview (gpt-5.6-sol, xhigh) completed clean with no accepted/actionable findings; TruffleHog patch scan was clean.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: XL maintainer Maintainer-authored PR labels Jul 22, 2026
@steipete
steipete marked this pull request as ready for review July 22, 2026 21:26
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready verification for exact head 2053d86b5745a98c7a53cfbb5b9c1bbd7011f95a:

  • Focused Vitest coverage passed across plugin persistence, install/uninstall CLI, management service, chat commands, Claw package ownership, update finalization/resume, cross-process lifecycle leases, and dangling-symlink cleanup.
  • Repeated real CLI stress: 12/12 fresh-state concurrent install/install plus install/uninstall iterations passed after the fix; the pre-fix baseline failed 12/12 different-plugin install attempts.
  • Hosted marketplace campaign: 79/79 current feed entries passed isolated install, runtime inspect, doctor, update dry-run, uninstall, and post-uninstall checks.
  • Real setup-required package: clawhub:@aws/[email protected] installed disabled with an actionable warning, inspected cleanly, passed doctor, uninstalled, and passed doctor again.
  • Live isolated Gateway: QA Lab completed a real openai/gpt-5.6-luna turn with exact reply OPENCLAW-LIVE-PLUGIN-GATEWAY-OK (runId=f6fac289-0e3b-4617-ba1b-04b09ae227f9). Blacksmith does not forward secrets and direct AWS was unavailable, so this live provider proof used the documented trusted-source local isolated fallback.
  • pnpm build, docs MDX/link checks, Codex autoreview, and hosted pnpm check:changed passed. Testbox proof: https://github.com/openclaw/openclaw/actions/runs/29955551057
  • Exact-head hosted CI run 29964883189 is green on attempt 2. Attempt 1's remaining failure was a cluster of unrelated process timeouts; rerunning only failed jobs passed, including checks-node-compact-small-7 and openclaw/ci-gate.
  • Review artifacts validate as READY FOR /prepare-pr with zero findings.

Known proof gaps: none for the changed plugin lifecycle behavior. The current ClawSweeper comment is an expired review started placeholder and contains no Rank-up moves:.

@steipete
steipete force-pushed the steipete/plugin-installation-stress-testing-da12ec branch from 2053d86 to a26d119 Compare July 23, 2026 02:34
@steipete
steipete merged commit a12e0f2 into main Jul 23, 2026
117 checks passed
@steipete
steipete deleted the steipete/plugin-installation-stress-testing-da12ec branch July 23, 2026 03:25
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setup-required plugins fail install and uninstall validation Plugin lifecycle commands race across processes

1 participant