Skip to content

fix(plugin): surface unreadable plugin package.json in compat check - #43334

Closed
Hexc01 wants to merge 1 commit into
anomalyco:devfrom
Hexc01:plugin-compat-gate
Closed

Hexc01 wants to merge 1 commit into
anomalyco:devfrom
Hexc01:plugin-compat-gate

Conversation

@Hexc01

@Hexc01 Hexc01 commented Aug 19, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #43094

Type of change

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

What does this PR do?

checkPluginCompatibility used to swallow package.json read failures and return as if the gate passed. That meant an unreadable or malformed plugin manifest skipped the engines.opencode check with no error.

If the package cannot be read, throw a named error so the existing compatibility stage skips the plugin and surfaces the failure. Version mismatch and major-0 skip behavior are unchanged.

How did you verify your code works?

From packages/opencode:

bun test test/plugin/shared.test.ts

All passed, including cases for missing/malformed package.json, unsatisfied range, satisfied range, and major-0 skip.

Screenshots / recordings

N/A

Checklist

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

@Hexc01

Hexc01 commented Aug 19, 2026

Copy link
Copy Markdown
Author

Hi @rekram1-node — sorry for another ping. When you have a moment, would you mind taking a look at this one as well?

What this fixes
checkPluginCompatibility used to swallow package.json read failures and return as if the compatibility gate passed. An unreadable or malformed plugin manifest could skip engines.opencode entirely with no error (#43094).

What I changed

  • If package.json cannot be read or is invalid JSON, throw a clear error instead of silently returning
  • Let the existing loader compatibility stage skip the plugin and surface the failure
  • Left version-mismatch errors and the major-0 skip path unchanged
  • Added unit tests in test/plugin/shared.test.ts for missing/malformed package.json, unsatisfied range, satisfied range, and major-0 skip

Verification

  • bun test test/plugin/shared.test.ts (packages/opencode) — all passed
  • Pre-push typecheck passed

Happy to adjust wording or behavior if you prefer a different approach. Thanks so much for your time.

Do not treat a failed package.json read as a compatibility pass.
@Hexc01
Hexc01 force-pushed the plugin-compat-gate branch from 7e082e1 to 4251a94 Compare August 26, 2026 14:00
@Hexc01

Hexc01 commented Aug 26, 2026

Copy link
Copy Markdown
Author

Hi @rekram1-node @kitlangton — gentle follow-up on this smaller reliability fix when you have time.

Issue
#43094 — checkPluginCompatibility treated an unreadable/malformed package.json as a silent pass.

Current state

  • Rebased onto latest dev just now
  • Single focused commit + unit tests in test/plugin/shared.test.ts
  • CI was green before the rebase

Change

  • Fail closed when the plugin package cannot be read
  • Keep engines.opencode mismatch errors and major-0 skip behavior unchanged

No rush — just wanted it back on radar after sitting for a few days. Thanks either way.

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

@github-actions github-actions Bot closed this Sep 19, 2026
iceteaSA pushed a commit to iceteaSA/opencode that referenced this pull request Sep 23, 2026
Do not treat a failed package.json read as a compatibility pass.

(cherry picked from anomalyco#43334)
iceteaSA added a commit to iceteaSA/opencode that referenced this pull request Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: checkPluginCompatibility silently skips when a plugin's package.json cannot be read

1 participant