#20407·orca

[Bug]: orca-opencode-status.js fails to load on OpenCode 2.x — V2 loader requires setup()/effect(), and V2 events differ from the V1 hooks

Author: liobrCreated Sep 12, 2026Updated Sep 17, 2026

Operating system

macOS 26.5 (arm64)

Orca version

v1.4.197 → v1.4.200 (both reproduce; the generated plugin source is unchanged in v1.4.200 and on main)

Summary

With OpenCode 2.x, Orca's generated orca-opencode-status.js never loads, so OpenCode session status never reaches the Orca sidebar, and every OpenCode launch shows:

Plugin failed: ~/Library/Application Support/orca/opencode-hooks/shared/plugins/orca-opencode-status.js
Run /plugins to view details.

/plugins lists it as failed, local. ~/.local/share/opencode/log/opencode.log shows:

level=WARN message="failed to load plugin"
target="~.../orca-opencode-hooks/shared/plugins/orca-opencode-status.js"
cause="Cause([Fail(PluginModule.LoadError: Plugin must export a default definition with an id and an effect or setup function.
(cause: SchemaError(Missing key at [\"default\"][\"effect\"] Missing key at [\"default\"][\"setup\"])))])"

This is not #16245 (OpenCode 1.1.23's function-based loader calling the object). OpenCode 2.x rejects the module before calling anything.

Details

Orca v1.4.197 and v1.4.200 (latest)
OpenCode CLI v2.0.1 (@opencode/[email protected] via bun global; v2.0.2 also available)
@opencode-ai/plugin pinned in opencode-hooks/shared/package.json 1.17.15
Local plugin file ~/Library/Application Support/orca/opencode-hooks/shared/plugins/orca-opencode-status.js

Root cause: OpenCode 2's loader contract changed

OpenCode 2's external plugin loader accepts only a default export shaped { id, effect } or { id, setup } (see packages/core/src/config/plugin/external.ts; tracked upstream as anomalyco/opencode#42878). It ignores server().

Orca currently emits (same on v1.4.200 and main, src/main/opencode/status-plugin-factory-source.ts):

export default {
  id: "orca-opencode-status",
  server: OrcaOpenCodeStatusPlugin,
};

server() was correct for OpenCode 1.18.x — PR #14612 / STA-3097 validated that contract against opencode 1.18.18 — but V2 reads only setup/effect. OpenCode's V2 docs ("Support V1") recommend a dual export: spread a V2 Plugin.define({ id, setup }) definition and add V1 server() for older builds.

Second blocker: the V2 event model differs

Adding a setup() makes the module load, but no status flows. The factory's handler targets V1 event names and the properties envelope; OpenCode 2 emits different types with a data envelope.

Observed with a setup() shim subscribed via ctx.event.subscribe on OpenCode 2.0.1 (names):

session.tool.called, session.tool.progress, session.tool.input.ended,
session.reasoning.delta, session.reasoning.ended, session.step.streamed,
catalog.updated, skill.updated, agent.updated, command.updated, ...

The factory expects: session.created, session.status, session.idle, session.error, message.updated, message.part.updated, message.part.delta, permission.asked, permission.replied, question.asked/question.replied/question.rejected, reading event.properties.*.

So the OpenCode 2 port needs to map V2 session/turn/tool/reasoning events (and permission/question paths) onto the existing /hook/opencode payloads (SessionBusy, SessionIdle, MessagePart, PermissionRequest, AskUserQuestion). A schema-only setup() shim is a silent no-op, which is worse than the visible failure.

Repro

  1. Orca v1.4.197/1.4.200 with agent hooks enabled, opencode v2.0.1 on PATH in an Orca terminal.
  2. Launch opencode in an Orca pane.
  3. Observe the toast and the failed entry in /plugins; the WARN appears in opencode.log, and Orca sidebar status for the pane never changes.

Local verification (for reference)

  • Adding a setup() that satisfies the V2 schema and hot-reloading makes the loader report success (file watcher reloads with no failed to load plugin entry).
  • With that shim active, the V2 event stream was confirmed live, and the factory matched none of the V2 event shapes. No Orca status posts were produced.
  • A locally patched file is not a durable fix: #16245 shows Orca rewrites the generated plugin, and app updates regenerate it.

Related

  • #16245, #15897 — earlier OpenCode 1.x loader-shape failures.
  • PR #14612 / STA-3097 — previous export-shape fix, validated against OpenCode 1.18.18.
  • anomalyco/opencode#42878 — V2 loader only accepts { id, effect } / { id, setup } and logs the same SchemaError.