Repository navigation
fix(opencode): support v2 plugins under the plain executable name - #22078
Conversation
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe plugin source generator now passes explicit agent configuration and supports next-event emission. OpenCode 2 setup skips hook registration when event hooks are unavailable. Contract tests now run against both Priority: ➖ Normal 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Dual-loader plain plugin —
getOpenCodePluginSource()now emits the v2setup()adapter andsession.next.*/permission.v2.*normalization alongside the v1server(), so an OpenCode 2 install namedopencodecan load it. The v2 setup path is neutralized for the wrong pane variant before it registers a prompt hook or event subscription. - Explicit
expectedAgent—getStatusPluginFactorySourceaccepts anexpectedAgentoverride, and the plain plugin pins'opencode'. This is load-bearing: the previous derivation wasemitNextEvents ? 'opencode2' : 'opencode', so flippingemitNextEventson without the override would have made the plain plugin inert under its own agent. - Regression tests — the v2 setup suite is parametrized over both agents, adds a wrong-variant test asserting no hook/subscription registration, and scrubs
ORCA_OPENCODE_AGENT; the plain-plugin byte-stability digest is updated (opencode2/mimo digests unchanged).
Verified locally: the three touched opencode suites (53 tests) and the full src/main/opencode src/main/mimo src/relay scope (1948 tests) pass. The new wrong-variant test genuinely fails without the if (!hooks.event) return async () => {} guard, so it is not theatre. Endpoint routing is unaffected — a plain v2 pane posts to /hook/opencode and server-side normalization is identical for both sources — and the mimo family source is byte-identical to before.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

ELI5
OpenCode 2 installed as
opencodereceives a plugin it cannot load. The plugin now supports both OpenCode versions, so its filename no longer determines which loader can use it.What Changed
The plain OpenCode plugin now includes the existing v2
setup()adapter and event normalization alongside its v1server()and named factory exports. It keeps the/hook/opencodeendpoint and pane-variant guard. An inactive variant returns from setup before registering subscriptions or prompt hooks.Why
The CLI name does not identify the installed major version. Supporting both loader contracts avoids subprocess version probes, cached-version mistakes, and gaps for commands typed into existing shell panes. The existing
opencode2plugin retains its endpoint. Quick-command prompts for bothopencodeandopencode2use the ready-state submission path so a v2 install under either executable name behaves consistently. This also removes the incompatible module content that previously failed again when rewritten on another pane spawn; this PR does not change file-write frequency.Linked Issue
Fixes #21974
Visual Proof
N/A — generated plugin contract change; no Orca UI layout changes. Live installed-binary verification was attempted but is incomplete: local v2.0.9 stalled during private-server startup and produced no hook callbacks before timeout. This is not claimed as an end-to-end pass.
Testing
opencodev2.0.9 run attempted with isolated generated plugin and HTTP callback capture; startup timed out without callbacks. No real Windows/Linux/SSH agent run claimed.AI Disclosure
Review
The shared generated plugin reaches local and relay installs without adding a wire field or a new process probe. Tests check that callbacks retain the selected agent endpoint. MiMo generation is unchanged.
Agent skill upstream boundary
Notes
This fixes loader compatibility, not picker version labels, shared-server pane ownership, or macOS privacy permissions. Existing shared OpenCode services may require restarting to load updated plugins.
Checklist