anomalyco / anomalyco/opencode
v2: deferred plugin transform failure leaves readiness latch closed and bricks catalog
@kitlangton is already working on this.
Since Aug 25, 2026.
- 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:
setupregisters a transform whilePlugin.activateis batched.- The callback is stored without being invoked, so the plugin is marked active.
State.batchlater materializes the transform and it throws.- 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
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.