Skip to content

fix(plugins): surface swallowed cleanup, setup, and CLI-load failures - #124570

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa-plugin-cleanup-visibility
Aug 16, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa-plugin-cleanup-visibility

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Three silent-failure sinks in the plugin lifecycle, all violating the repo's core doctrine that every action ends in a visible outcome or a recorded reason:

  1. cleanupReplacedPluginHostRegistry deliberately collects per-hook cleanup failures instead of throwing (it must finish every plugin) — but both call sites in runtime.ts discarded the returned failures array entirely. A plugin whose session-extension/scheduler teardown broke during disable/reload left zero trace.
  2. setup-registry dropped broken setup entries (catch { return null; }) and threw-away registration errors (catch { return false; }), silently removing a plugin's providers/CLI backends/config migrations from onboarding. Worse: the module's diagnostics array — including the existing descriptor-drift diagnostics from feat(plugins): warn on ignored setup runtime #71253 — had no operator surface at all; it was only ever read by tests.
  3. loadPluginCliDescriptors swallowed total load failures behind an intentionally muted per-plugin logger; a failure removes every plugin command from help/dispatch and vanished with it.

Why This Change Was Made

  • The cleanup funnel (cleanupPreviousPluginHostRegistry) now warns per failure with plugin + hook ids — one fix at the shared funnel covers both discard sites, using the exact pattern the rollback path already uses.
  • Setup failures push typed diagnostics (setup-entry-load-failed, setup-registration-failed), and the registry build warns once per uncached build for every diagnostic — giving the whole channel (new + pre-existing drift codes) its first operator surface. The two one-shot resolvers log directly.
  • The CLI descriptor loader warns once on the outer catch; the muted per-plugin logger stays for scan noise.

User Impact

Operators debugging "my plugin's commands/providers disappeared" or "plugin teardown left stale state" now get warn-level log lines naming the plugin and the reason, instead of silence.

Evidence

  • New regression records a diagnostic when the setup entry fails to load fails pre-fix (stash proof); the atomic-publish test's diagnostics: [] assertion updated to expect the recorded setup-registration-failed (it was pinning the silent drop).
  • node scripts/run-vitest.mjs run src/plugins/setup-registry.test.ts src/plugins/setup-registry.runtime.test.ts src/plugins/setup-registry.migrations.test.ts src/plugins/cli.test.ts src/plugins/runtime.test.ts — all green.
  • tsgo core + core-test shards clean; oxfmt/oxlint clean.
  • Autoreview (Codex, gpt-5.6-sol high): clean, 0.99.
  • Prod LOC: +62 −10 (visibility for three failure classes + typed diagnostic codes); tests +22 −1.

Three silent-failure sinks in the plugin lifecycle, all violating
'every action ends in a visible outcome or a recorded reason':

- cleanupReplacedPluginHostRegistry collects per-hook cleanup failures
  instead of throwing (it must finish every plugin), but both callers
  discarded the returned failures array entirely — broken session-
  extension/scheduler teardown vanished. The shared funnel now warns
  per failure with plugin and hook ids.
- setup-registry dropped broken setup entries with catch{return null}
  and threw-away registration errors with catch{return false}, silently
  removing a plugin's providers/CLI backends/migrations from
  onboarding. Both now push typed diagnostics (setup-entry-load-failed,
  setup-registration-failed) — and since the diagnostics array had no
  operator surface at all, the registry build now warns once per
  uncached build for every diagnostic (including the previously
  invisible descriptor-drift ones).
- loadPluginCliDescriptors swallowed total load failures behind a muted
  per-plugin logger; a failure removes every plugin command from
  help/dispatch and must not vanish with it. One warn on the catch.
@clawsweeper

clawsweeper Bot commented Aug 16, 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 16, 2026
@steipete
steipete marked this pull request as ready for review August 16, 2026 12:37
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 16, 2026, 8:43 AM ET / 12:43 UTC.

ClawSweeper review

What this changes

The PR adds warnings and typed diagnostics when plugin cleanup, setup registration, or CLI descriptor loading fails.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: the patch improves three silent-failure paths, but its new setup-entry loader diagnostic still disappears on the one-shot provider and CLI-backend resolution paths.

Priority: P2
Reviewed head: 5cc5c981eeb860e6652158e53edff59e35db9288

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The repair has a clear owner-boundary direction and focused validation report, but one P1 silent path remains.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored plugin reliability repair is exempt from the external contributor proof gate; the PR body reports focused test coverage, but the remaining source defect blocks merge independently.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored plugin reliability repair is exempt from the external contributor proof gate; the PR body reports focused test coverage, but the remaining source defect blocks merge independently.
Evidence reviewed 5 items Incomplete one-shot setup visibility: The new loader catch records an error only through an optional diagnostics array, but both one-shot resolvers call it without that array and return undefined when loading fails.
Affected production callers: Provider-auth and CLI-backend resolution use the one-shot setup resolvers, so a broken setup module can still remove a provider/backend without the new warning.
Current-main comparison: The proposed implementation is not on current main; the reviewed paths differ between the PR head and main.
Findings 1 actionable finding [P1] Report setup-module load failures for one-shot lookups
Security None None.

How this fits together

Plugin metadata feeds setup/onboarding, runtime registry replacement, and CLI command discovery. Those paths must preserve their current fallback behavior while making failures visible to operators.

flowchart LR
  A[Plugin manifests] --> B[Setup registry]
  A --> C[CLI descriptor loader]
  D[Registry replacement] --> E[Cleanup hooks]
  B --> F[Provider and backend lookup]
  B --> G[Onboarding]
  C --> H[CLI help and dispatch]
  E --> I[Operator logs]
Loading

Before merge

  • Report setup-module load failures for one-shot lookups (P1) - resolvePluginSetupProviderCore and resolvePluginSetupCliBackend call this helper without diagnostics, so a loader exception still returns undefined with no log on their auth/runtime paths. Emit the same warning through those callers (and cover a throwing loader) so the new setup-entry failure handling does not leave that user-visible disappearance silent.
  • Resolve merge risk (P1) - The branch is behind current main; refresh it and rerun exact-head checks after addressing the one-shot loader path.

Findings

  • [P1] Report setup-module load failures for one-shot lookups — src/plugins/setup-registry.ts:300-304
Agent review details

Security

None.

PR surface

Source +52, Tests +21. Total +73 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 62 10 +52
Tests 1 22 1 +21
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 84 11 +73

Review metrics

Metric Value Why it matters
Production versus test delta production +52 net (62 added, 10 removed); tests +21 net (22 added, 1 removed) The positive production growth is purposeful diagnostics work, but the remaining one-shot silent path means it is not yet a complete repair.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Route setup-module load failures through one shared reporting callback so full-registry and one-shot provider/backend lookups all emit the same operator-visible failure, with focused regression coverage.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Route setup-module load failures through one shared reporting callback so full-registry and one-shot provider/backend lookups all emit the same operator-visible failure, with focused regression coverage.

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

Yes, from source: make the setup module loader throw during one-shot provider or CLI-backend resolution; the new catch returns undefined without a diagnostic sink or warning.

Is this the best way to solve the issue?

No: the shared loader catch is the right owner, but its optional diagnostics sink leaves the two one-shot callers outside the reported failure path.

Full review comments:

  • [P1] Report setup-module load failures for one-shot lookups — src/plugins/setup-registry.ts:300-304
    resolvePluginSetupProviderCore and resolvePluginSetupCliBackend call this helper without diagnostics, so a loader exception still returns undefined with no log on their auth/runtime paths. Emit the same warning through those callers (and cover a throwing loader) so the new setup-entry failure handling does not leave that user-visible disappearance silent.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a bounded plugin setup reliability repair that affects operator troubleshooting and optional provider/backend setup.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored plugin reliability repair is exempt from the external contributor proof gate; the PR body reports focused test coverage, but the remaining source defect blocks merge independently.

Label justifications:

  • P2: This is a bounded plugin setup reliability repair that affects operator troubleshooting and optional provider/backend setup.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored plugin reliability repair is exempt from the external contributor proof gate; the PR body reports focused test coverage, but the remaining source defect blocks merge independently.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the current setup/runtime modules’ recent restoration and the proposed repair. (role: recent area contributor; confidence: high; commits: 8cf85e3ceda4, 5cc5c981eeb8; files: src/plugins/setup-registry.ts, src/plugins/runtime.ts, src/plugins/cli-registry-loader.ts)
  • vincentkoc: Authored merged setup-registry diagnostic work in feat(plugins): warn on ignored setup runtime #71253, whose diagnostics this PR now exposes. (role: adjacent diagnostic feature owner; confidence: medium; commits: 5b8bd6371c66; files: src/plugins/setup-registry.ts)

Rank-up moves

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

  • Emit the setup-entry load warning for one-shot provider and CLI-backend resolution, then add a focused throwing-loader regression test.

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 7ed321d into main Aug 16, 2026
254 checks passed
@steipete
steipete deleted the codex/autoqa-plugin-cleanup-visibility branch August 16, 2026 13:03
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 17, 2026
…openclaw#124570)

Three silent-failure sinks in the plugin lifecycle, all violating
'every action ends in a visible outcome or a recorded reason':

- cleanupReplacedPluginHostRegistry collects per-hook cleanup failures
  instead of throwing (it must finish every plugin), but both callers
  discarded the returned failures array entirely — broken session-
  extension/scheduler teardown vanished. The shared funnel now warns
  per failure with plugin and hook ids.
- setup-registry dropped broken setup entries with catch{return null}
  and threw-away registration errors with catch{return false}, silently
  removing a plugin's providers/CLI backends/migrations from
  onboarding. Both now push typed diagnostics (setup-entry-load-failed,
  setup-registration-failed) — and since the diagnostics array had no
  operator surface at all, the registry build now warns once per
  uncached build for every diagnostic (including the previously
  invisible descriptor-drift ones).
- loadPluginCliDescriptors swallowed total load failures behind a muted
  per-plugin logger; a failure removes every plugin command from
  help/dispatch and must not vanish with it. One warn on the catch.
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: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant