anomalyco / anomalyco/opencode

V2 external plugins silently fail to register agents/tools after startup

Open
#42,280 0 comments 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Aug 13, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

External v2 plugins (configured via plugin in opencode.json, or scanned from config directories) are loaded by ConfigExternalPlugin in a forked fiber. That fiber inherits the ambient State batch from location startup, which runs inside State.batch(...) and drains its reload set as soon as the startup effect returns. By the time an async plugin load finishes (dynamic import, npm install), the batch has long committed, so the plugin's transform() calls enqueue their reload into a set nobody ever drains. The plugin appears to load without error, but the agents/tools/skills/commands it registers never materialize.

Plugins

Any v2 effect/promise plugin, e.g. a local file plugin that registers an agent via ctx.agent.transform

OpenCode version

dev branch (v1.18.18)

Steps to reproduce
  1. Write a v2 effect plugin that registers an agent, e.g. export default define({ id: "demo", effect: (ctx) => ctx.agent.transform((agents) => { agents.update("demo", (a) => { a.mode = "subagent" }) }).pipe(Effect.asVoid) })
  2. Reference it from the plugin array in opencode.json
  3. Start opencode and list agents — demo never appears, and nothing is logged
Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

Windows Terminal

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.