#15618: fix(plugins): reject async plugin registration instead of silently ignoring
stale
size: XS
Cluster:
Plugin Management Enhancements
## Summary
- When a plugin's `register()` returned a Promise, only a warn diagnostic was emitted
- The plugin was still pushed to the registry as "loaded" despite incomplete registration
- Any tools, hooks, or channels registered in the async portion were silently lost
## Fix
- Mark async-registering plugins with `status: "error"` instead of marking them as loaded
- Upgrade diagnostic from warn to error level
- Use `continue` to skip the normal registration path
## Test plan
- [x] Existing plugin loader tests pass
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This change updates the plugin loader (`src/plugins/loader.ts`) to treat plugins whose `register()` returns a Promise as a hard error rather than a warning. In that case, the loader now marks the plugin record with `status: "error"`, attaches an error message, emits an `error`-level diagnostic, and `continue`s to skip the normal successful-registration path.
This aligns the registry state (`registry.plugins`) with the system’s actual behavior: async work after `register()` cannot be awaited here, so any tools/hooks/channels registered later would otherwise be silently lost while the plugin still appeared "loaded".
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- The change is narrowly scoped to the plugin registration path, preserves existing control flow for synchronous plugins, and improves correctness by preventing async-registering plugins from being reported as loaded. No additional behavior changes were found outside the intended error handling and diagnostic level update.
- No files require special attention
<sub>Last reviewed commit: e4df1d0</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#7204: Plugins: default non-bundled plugins off
by veganmosfet · 2026-02-02
77.7%
#20402: Pr/load openclaw plugins async
by ramarnat · 2026-02-18
77.5%
#21660: fix(plugins): require explicit allowlist for non-bundled plugins
by AI-Reviewer-QS · 2026-02-20
77.1%
#20499: test(plugins): add bundled+config duplicate discovery regression
by dcol91863 · 2026-02-19
76.8%
#2556: fix(plugin-install): handle existing plugins and filter workspace deps
by longmaba · 2026-01-27
76.4%
#21871: fix(plugins): suppress false duplicate warning when user-installed ...
by hydro13 · 2026-02-20
76.3%
#18966: fix(config): downgrade unknown bundled plugin references to warnings
by moxunjinmu · 2026-02-17
75.3%
#12048: fix: deduplicate config warnings to log once instead of on every re...
by mcaxtr · 2026-02-08
74.6%
#9603: fix: initialize global hook runner on plugin registry cache hit
by kevins88288 · 2026-02-05
74.4%
#13109: fix(plugins): inject globalThis.require for CJS interop in jiti-loa...
by mcaxtr · 2026-02-10
74.3%