Skip to content

fix(plugin): tolerate unreadable local manifests - #59848

Open
Aafimalek wants to merge 2 commits into
anomalyco:devfrom
Aafimalek:plugin-manifest
Open

Aafimalek wants to merge 2 commits into
anomalyco:devfrom
Aafimalek:plugin-manifest

Conversation

@Aafimalek

@Aafimalek Aafimalek commented Oct 28, 2026 •

Copy link
Copy Markdown

Issue for this PR

Fixes #59750

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

An unreadable local package.json could abort plugin discovery and leave every plugin unavailable. Treat a manifest read failure like an invalid or missing manifest, so resolution can fall back to conventional entrypoints.

How did you verify your code works?

  • bun test test/host.test.ts --rerun-each 10 in packages/plugin
  • bun run test, bun typecheck, and bun run typecheck:tsc in packages/plugin
  • bun run check at the repository root

The unreadable-manifest regression fails on the unmodified base and passes with the fix. It uses a directory at package.json to exercise a real read error on Windows and Unix.

Visual

<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72" fill="none">
  <rect x="8" y="12" width="224" height="48" rx="8" stroke="currentColor" opacity=".35"/>
  <circle cx="32" cy="36" r="6" fill="currentColor" opacity=".3"/>
  <path d="M44 36h44" stroke="currentColor" opacity=".3"/>
  <path d="m100 31 6 5-6 5" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
  <circle cx="129" cy="27" r="5" fill="currentColor"><animate attributeName="opacity" values=".45;1;.45" dur="2s" repeatCount="indefinite"/></circle>
  <circle cx="129" cy="45" r="5" fill="currentColor"><animate attributeName="opacity" values="1;.45;1" dur="2s" repeatCount="indefinite"/></circle>
  <path d="M143 27h65M143 45h65" stroke="currentColor" stroke-width="3" stroke-linecap="round"/>
</svg>

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #52618, #49982, #57089

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix works. I ran the reproduction script from #59750 from source with bad/package.json replaced by a directory. On the base, plugin loading dies with EISDIR, and /api/plugin and /api/provider come back empty, both at first boot and after POST /api/location/reload. With this change, both local plugins are active and the providers are listed in both cases. The plugin and core tests pass, and the new core test fails without the fix.

The public API is unchanged.

The change in packageManifest is sound. A missing package.json still falls back to the conventional entry files, because its read error is caught as well.

The new packages/core test in supervisor-reload.test.ts can be dropped so the change stays minimal: the small Host.resolve test in packages/plugin/test/host.test.ts already covers the fixed behaviour.

Related: #52618, #49982, #57089

)

describe("PluginSupervisor reload", () => {
it.live("loads configured plugins when one manifest cannot be read", () =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Host.resolve test in packages/plugin/test/host.test.ts already covers this one-function fix. This full-supervisor test adds a lot of setup for the same case and can be dropped to keep the change minimal.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My earlier point is addressed: the packages/core test is gone, and the regression test in packages/plugin passes. The fix itself hasn't changed since I verified it with the reproduction script from #59750. The public API is unchanged. I have no further concerns.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plugin: an unreadable package.json in one local plugin directory removes every plugin and provider (2.2.0)

1 participant