Skip to content

fix(core): reject plugin effects that return a non-Effect - #64115

Open
phon-t wants to merge 1 commit into
anomalyco:devfrom
phon-t:plugin-effect-check
Open

phon-t wants to merge 1 commit into
anomalyco:devfrom
phon-t:plugin-effect-check

Conversation

@phon-t

@phon-t phon-t commented Nov 15, 2026 •

Copy link
Copy Markdown

Issue for this PR

Fixes #63816

Type of change

  • Bug fix

What does this PR do?

A plugin whose effect returns a Promise — the easy mistake of writing an async effect, or returning a 1.x-style hook map — passed the loader's "is a function" check, then hung activation forever: /api/provider and /api/model 503'd with "Location plugins did not finish activating" and the TUI had no models. Activation now checks the return value of effect and, when it is not an Effect, fails that plugin with a clear message and marks it failed, so activation completes and the provider catalog stays available.

No feature flag is needed for this bug fix.

How did you verify your code works?

  • Added packages/core/test/plugin/effect-return.test.ts: activates a plugin with an async effect returning {} and one returning a hook map, and asserts both end up failed with the "must return an Effect" message and awaitActivation resolves. The test hangs on dev (30s timeout) and passes with the fix.
  • bun test --timeout 30000 test/plugin/effect-return.test.ts test/plugin/module.test.ts in packages/core: 10 pass, 0 fail.
  • bun run typecheck in packages/core: no errors.

Screenshots / recordings

Not applicable — server-side behavior, no 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: #63814

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Nov 15, 2026

@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. With the issue's effect: async () => ({}) plugin, the base returns 503 "Location plugins did not finish activating" from /api/provider and /api/model, before and after a 20 s wait. With this PR, both return 200 with the catalog. I ran the reproduction from #63816 against both checkouts from source. effect-return.test.ts and module.test.ts pass (10/10), and tsc -b for packages/core is clean.

Checking at the call site in plugin.ts is the right layer: it is the one place where every plugin's effect runs, and the loader can't check the return value without calling it. A failed result goes to the same error entry as other load failures. A synchronous throw from effect still fails the plugin as before. The test is small and clear.

Public API: unchanged. This only adds a runtime check and an error message in core.

No blocking concerns.

Related: #63814

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Nov 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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: non-Effect "effect" export hangs activation, 503s /api/provider and /api/model

1 participant