Skip to content

fix(plugins): recover plugin catalog after transient startup failure - #126815

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa-plugin-catalog-rejection-20260820
Aug 20, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa-plugin-catalog-rejection-20260820

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where a transient official-plugin-catalog initialization failure during Gateway startup permanently broke subsequent plugin inventory, icon, and installation requests until the process restarted or an operator explicitly refreshed plugin metadata.

Why This Change Was Made

The plugin management owner maintained a bespoke process-wide cached Promise that never evicted rejected loads, so startup prewarming poisoned every later caller. Replace that duplicate cache and its hand-registered lifecycle hook with the existing canonical lifecycle-owned Promise loader, which already coalesces successful loads, evicts only the exact rejected generation, and participates in explicit plugin-metadata resets. Hosted catalog validation, signed-feed trust, fallback policy, plugin configuration, public SDK contracts, and persistent state are unchanged.

User Impact

Plugin lists, icons, and installations recover on their next request after a transient catalog bootstrap failure. Successful hosted and bundled-fallback catalog results remain process-stable, concurrent loads stay coalesced, and a stale rejected request cannot invalidate a newer lifecycle generation.

Evidence

  • Regression-first proof on the actual plugin-management owner failed before the fix: the second real listManagedPlugins request rejected with the first transient catalog bootstrap error instead of invoking the catalog loader again; the remaining three owner cases passed.
  • OPENCLAW_VITEST_MAX_WORKERS=1 OPENCLAW_VITEST_FS_MODULE_CACHE=0 node scripts/run-vitest.mjs src/plugins/management-service.lifecycle-cache.test.ts src/plugins/management-service.test.ts src/plugins/plugin-cache-primitives.test.ts --configLoader runner — 45 tests passed across management, lifecycle, installation-facing behavior, and the shared cache primitive.
  • Regression coverage exercises failed prewarm followed by successful retry, continued successful process-stable cache reuse, explicit lifecycle clear with a later stale-generation rejection, and process-stable successful bundled-fallback results.
  • Both repository ratchets passed: assertion safety (4,287 files; 13,527 assertions) and max-lines (897 existing suppressions; 501/501 environment variables).
  • Targeted formatting, direct two-file lint, whitespace validation, authenticated Codex autoreview, and a separate independent owner-boundary review passed.
  • Production delta: +6/-17, net -11 lines. Regression-test delta: +71/-2. Removed the bespoke cache record, constant-key branch, and duplicate lifecycle registration; reused the existing canonical promise loader.
  • Rejections still fail closed for their original request; there is no same-request retry, signature bypass, automatic trust fallback, new public option, persistence change, or unrelated cache-primitive change.

@clawsweeper

clawsweeper Bot commented Aug 20, 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 size: S maintainer Maintainer-authored PR labels Aug 20, 2026
@steipete
steipete marked this pull request as ready for review August 20, 2026 19:21
@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 Aug 20, 2026
@clawsweeper

clawsweeper Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 20, 2026, 3:29 PM ET / 19:29 UTC.

ClawSweeper review

What this changes

The PR replaces the plugin catalog’s bespoke cached promise with the shared lifecycle-aware loader so a failed catalog initialization can be retried.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No patch correctness defect found. Keep this protected maintainer PR open until exact-head checks finish and any latest ClawSweeper rank-up moves are addressed or explicitly skipped.

Priority: P2
Reviewed head: 85944e719e9c816e6c9ebaa1326da0b885e65a04

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A clean, net-negative owner-boundary repair with focused regressions and no identified correctness or security defect.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal cache repair is exempt from the external-contributor real-behavior-proof gate; its PR body provides focused regression-test evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal cache repair is exempt from the external-contributor real-behavior-proof gate; its PR body provides focused regression-test evidence.
Evidence reviewed 7 items Current-main failure path: Current main stores the first catalog promise indefinitely and later awaits that same promise, so a rejection remains poisoned until an explicit lifecycle clear.
Canonical fix boundary: The branch delegates catalog loading and clearing to the existing lifecycle-owned promise loader rather than retaining a second cache implementation.
Rejected-generation contract: The shared loader removes a rejected default promise only when it is still the active generation; clear starts a fresh generation and registers with plugin-metadata lifecycle clearing.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw plugins list --help

Result: PASS (completed)

pnpm openclaw plugins list --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-126815-PQI3Kf/target$ pnpm openclaw plugins list --help
$ node scripts/run-node.mjs plugins list --help
pnpm openclaw plugins list --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 100.18 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

[tsdown-build] invocation 2/2 finished in 13.9s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 10 phases completed in 4114ms (slowest: built plugin control-plane loads 3384ms)
│
◇

OpenClaw 2026.8.1 (85944e7) — All your chats, one OpenClaw.

Usage: openclaw plugins list [options]

List discovered plugins

Options:
  --enabled   Only show enabled plugins (default: false)
  -h, --help  Display help for command
  --json      Print JSON
  --verbose   Show detailed entries (default: false)
runner@runnervm76f27:/tmp/clawsweeper-live-proof-126815-PQI3Kf/target$ pnpm openclaw plugins list --help
$ node scripts/ru
… output truncated …

Assertions:

  • PASS expect_output: plugins

How this fits together

Gateway startup prewarms plugin-management data, while Gateway plugin APIs later use the same catalog for inventory, icons, and installation choices. The catalog result is process-stable until the plugin-metadata lifecycle owner clears it.

flowchart LR
A[Gateway startup] --> B[Plugin catalog prewarm]
B --> C[Lifecycle-aware catalog loader]
C --> D{Catalog load outcome}
D -->|success or fallback| E[Process-stable catalog]
D -->|rejected load| F[Remove failed generation]
E --> G[Inventory icons and installs]
F --> G
Loading

Before merge

  • Resolve merge risk (P1) - Exact-head CI is still running; merge only after required checks pass and the latest ClawSweeper rank-up moves are applied or explicitly skipped.
  • Complete next step (P2) - This maintainer-labeled PR has no mechanical repair finding; normal exact-head CI and merge review remain.
Agent review details

Security

None.

PR surface

Source -11, Tests +69. Total +58 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 17 -11
Tests 1 71 2 +69
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 77 19 +58

Review metrics

Metric Value Why it matters
Production versus test LOC production -11 (6 added, 17 removed); tests +69 (71 added, 2 removed) The bug fix reduces production cache code while adding focused owner-boundary regression coverage.

Stored data model

Persistent data-model change detected: persistent cache schema: src/plugins/management-service.ts, vector/embedding metadata: src/plugins/management-service.lifecycle-cache.test.ts, vector/embedding metadata: src/plugins/management-service.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Merge the lifecycle-owned implementation once exact-head CI is green; it preserves fallback policy and removes the duplicate rejected-promise cache.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Merge the lifecycle-owned implementation once exact-head CI is green; it preserves fallback policy and removes the duplicate rejected-promise cache.

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

Yes, source-reproducible: current main retains a rejected catalog promise at src/plugins/management-service.ts:257 and reuses it at :400; the focused management-service regression models the failed-load then retry path.

Is this the best way to solve the issue?

Yes. Reusing the lifecycle-owned loader is better than maintaining a second cache because it already provides coalescing, lifecycle clearing, and generation-safe rejection eviction.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: A transient catalog-load failure can block later plugin inventory, icon, and installation operations until metadata is reset.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal cache repair is exempt from the external-contributor real-behavior-proof gate; its PR body provides focused regression-test evidence.

Label justifications:

  • P2: A transient catalog-load failure can block later plugin inventory, icon, and installation operations until metadata is reset.
  • 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: This maintainer-authored internal cache repair is exempt from the external-contributor real-behavior-proof gate; its PR body provides focused regression-test evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Available history introduced the management service and shared promise loader in the same area, and this contributor authored the current repair. (role: recent plugin-management and cache primitive contributor; confidence: high; commits: 58cda469f55c, 85944e719e9c; files: src/plugins/management-service.ts, src/plugins/plugin-cache-primitives.ts, src/plugins/plugin-metadata-lifecycle.ts)

Rank-up moves

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

  • Let exact-head required checks complete and address or explicitly skip the latest ClawSweeper rank-up moves before merge.

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.

@steipete
steipete merged commit ba4ff7a into main Aug 20, 2026
299 checks passed
@steipete
steipete deleted the codex/autoqa-plugin-catalog-rejection-20260820 branch August 20, 2026 19:42
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@clawsweeper

clawsweeper Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(plugins): recover plugin catalog after transient startup failure This is item 2/3 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

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: 🐚 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.

1 participant