Skip to content

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

Closed as not planned

Description

@To-Term

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

Activity

  1. github-actions commented on Oct 13, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions