anomalyco / anomalyco/opencode

v2: deferred plugin transform failure leaves readiness latch closed and bricks catalog

Open
#44,920 0 comments 2 reactions 1 assignee View on GitHub

@kitlangton is already working on this.

Since Aug 25, 2026.

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

Description

Problem

Direct failures from a plugin's setup/effect are isolated by Plugin.load(...).pipe(Effect.exit). A transform failure is not isolated when State.batch defers its materialization until after that boundary:

  1. setup registers a transform while Plugin.activate is batched.
  2. The callback is stored without being invoked, so the plugin is marked active.
  3. State.batch later materializes the transform and it throws.
  4. The defect escapes into PluginSupervisor.activate.

The supervisor catches it before opening readiness:

yield* activate()
if (observed === target) yield* ready.open
.pipe(Effect.catchCause((cause) => Effect.logError("failed to reload plugins", { cause })))

The latch therefore remains closed and PluginSupervisor.flush never completes.

This is narrower than a direct setup throw or a PluginModule decode failure; both are already isolated.

Repro

export default {
  id: "broken-transform",
  async setup(ctx) {
    await ctx.command.transform(() => {
      throw new Error("broken deferred transform")
    })
  },
}

The observed plugin used the obsolete commands.update() API. That plugin is invalid, but its transform failure should not block unrelated startup.

ERROR failed to reload plugins
      TypeError: commands.update is not a function
ERROR Model catalog initialization timed out  service=model.catalog

Impact

model.list times out waiting for plugin readiness. TUI location sync then rejects as a whole and displays Session location unavailable for an existing directory, with empty catalog pickers. Direct provider API requests still succeed.

Expected

  • Attribute the transform failure to its plugin and remove the failed registration.
  • Mark the plugin failed rather than active.
  • Settle readiness so healthy plugins, catalog reads, and location startup continue.
  • Do not present this service error as a missing directory.

Environment

  • OpenCode: 0.0.0-beta-18155 (d6deb62379)
  • OS: Windows 11

Related: #35963, #42878, #36117.

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.