anomalyco / anomalyco/opencode
V2 external plugins silently fail to register agents/tools after startup
@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
- 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) }) - Reference it from the
pluginarray in opencode.json - Start opencode and list agents —
demonever appears, and nothing is logged
Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
Windows Terminal
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.