fix(plugins): fall back to bundled plugin when npm spec resolves to non-OpenClaw package#32096
Conversation
Greptile SummaryThis PR fixes a two-part bug where Changes:
Issue found:
Confidence Score: 4/5
Last reviewed commit: b006503 |
Additional Comments (1)
When the fallback is triggered by Consider distinguishing the two reasons: (This would require hoisting Prompt To Fix With AIThis is a comment left during a code review.
Path: src/cli/plugins-cli.ts
Line: 683
Comment:
**Misleading warning message for non-OpenClaw plugin case**
When the fallback is triggered by `isNotAnOpenClawPluginError` (i.e. the npm package _was_ found and downloaded, but it isn't an OpenClaw plugin), the message `"npm package unavailable for ${raw}"` is factually incorrect — the package exists; it just doesn't implement `openclaw.extensions`. This could confuse users into thinking the npm package doesn't exist at all.
Consider distinguishing the two reasons:
```suggestion
theme.warn(
isPackageNotFoundInstallError(result.error)
? `npm package unavailable for ${raw}; using bundled plugin at ${shortenHomePath(bundledFallback.localPath)}.`
: `npm package "${raw}" is not a valid OpenClaw plugin; using bundled plugin at ${shortenHomePath(bundledFallback.localPath)}.`,
),
```
(This would require hoisting `shouldTryBundledFallback`'s sub-conditions so both are still available here.)
How can I resolve this? If you propose a fix, please make it concise. |
…on-OpenClaw package (openclaw#32019) When `openclaw plugins install diffs` downloads the unrelated npm package `diffs@0.1.1` (which lacks `openclaw.extensions`), the install fails without trying the bundled `@openclaw/diffs` plugin. Two fixes: 1. Broaden the bundled-fallback trigger to also fire on "missing openclaw.extensions" errors (not just npm 404s) 2. Match bundled plugins by pluginId in addition to npmSpec so unscoped names like "diffs" resolve to `@openclaw/diffs` Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address Greptile review: show "not a valid OpenClaw plugin" when the npm package was found but lacks openclaw.extensions, instead of the misleading "npm package unavailable" message. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d214958 to
bca352e
Compare
|
Landed via temp rebase onto main.
Thanks @scoootscooob! |
* main: (154 commits) fix: harden exec allowlist regex literal handling (openclaw#32162) (thanks @stakeswky) fix(exec): escape regex literals in allowlist path matching fix: OpenAI OAuth TLS preflight gating (openclaw#32051) (thanks @alexfilatov) Auth: gate OpenAI OAuth TLS preflight in doctor Fix TLS cert preflight classification false positive Add OpenAI OAuth TLS preflight and doctor prerequisite check fix(gateway): hot-reload channelHealthCheckMinutes without full restart refactor: harden plugin install flow and main DM route pinning fix: propagate whatsapp inbound fromMe context (openclaw#32167) (thanks @scoootscooob) fix(whatsapp): propagate fromMe through inbound message pipeline refactor: harden msteams lifecycle and attachment flows fix(config): move sensitive-schema hint warnings to debug test(perf): reduce heavy fixture and guardrail overhead perf(core): speed up routing, pairing, slack, and security scans refactor: unify queueing and normalize telegram slack flows fix: harden bundled plugin install fallback semantics (openclaw#32096) (thanks @scoootscooob) fix(plugins): prefer bundled plugin ids over bare npm specs fix: distinguish warning message for non-OpenClaw vs missing npm package fix(plugins): fall back to bundled plugin when npm spec resolves to non-OpenClaw package (openclaw#32019) fix: harden msteams revoked-context fallback delivery (openclaw#27224) (thanks @openperf) ...
Closes #32019
Summary
openclaw plugins install diffsdownloads the unrelated npm packagediffs@0.1.1(a simple object-diff utility by synder) which lacksopenclaw.extensions@openclaw/diffspluginfindBundledPluginByNpmSpeconly matches bynpmSpec(@openclaw/diffs), not bypluginId(diffs)Changes
src/cli/plugins-cli.ts: addisNotAnOpenClawPluginError()check; broaden fallback trigger to also fire on missing/emptyopenclaw.extensionserrorssrc/plugins/bundled-sources.ts: match bundled plugins bypluginIdin addition tonpmSpecsrc/plugins/bundled-sources.test.ts: new test for pluginId-based lookupWhat did NOT change
Test plan
findBundledPluginByNpmSpec({ spec: "diffs" })resolves via pluginId when npmSpec is@openclaw/diffsnpx tsgotype check passes (pre-existing error in gateway-chat.ts only)🤖 Generated with Claude Code