Repository navigation
Closed
Description
User Story
As an apexyard adopter running OpenCode V2, I want the shipped opencode adapter to load and enforce the gates so that I get the same mechanical enforcement as on V1, instead of a silent no-op.
Acceptance Criteria
-
harness-adapters/opencodedepends on the V2 plugin package and its default export is a single object that satisfies both plugin APIs: the V1 factory underserver(), and the V2 entrypoint fromPlugin.define({ id, setup })spread into the same object. - Under V2, the adapter registers through
ctx.tool.hook("execute.before", ...)and throws when a gate exits 2, so the tool call is denied. - Tool-id mapping covers V2:
shellmaps to thebashgate set, andbashkeeps working for V1.editandwritekeep their current mapping. - The
patchtool has a decided, tested behaviour: either run the Edit-wired gates with a reconstructedfile_pathset, or be documented as unrouted with a log line. No undocumented silent skip. - The gate logic stays in
gate-dispatcher.tsandderive-gates.ts. This change adds a transport only. - V1 does not regress: the existing test suite passes and a V1-shaped plugin still loads.
- New tests cover the V2 path: allow, deny (exit 2 throws), ops-root resolution, session-id handling, and tool-id mapping.
-
harness-adapters/opencode/README.md,docs/harnesses/opencode.md, anddocs/opencode-adapter.mdstate that V1 and V2 are both supported, and that V2 requires directory paths for configured local plugins. - The
batchbypass note is removed.anomalyco/opencode#5894closed as stale, the maintainer could not reproduce it, and V2 has nobatchtool.
Design Notes
- V2 does not run V1 plugins. The current adapter therefore loads as a no-op: no error, no gate.
- The dual-export shape is the one the vendor documents in its own migration guide, so one package serves both versions.
- Error behaviour stays as it is today: a gate that cannot produce an exit status fails closed, and an unresolved ops root runs with no gates.
- Open question for the build: a subagent runs in a different session id. The ticket marker is tree-based, so it should still resolve. Add a test with a subagent-shaped event.
- Related: [CI] Conformance CI: zero-cost hybrid (opencode daily on the free model, pi and codex manual and release evidence) #1916 pins
[email protected]in the conformance job. When that pin moves past the V2 plugin API, this adapter must not silently stop enforcing.
Out of Scope
- Publishing the adapter to npm.
- Moving the conformance CI pin (tracked in [CI] Conformance CI: zero-cost hybrid (opencode daily on the free model, pi and codex manual and release evidence) #1916).
- Adding new gates.
Effort Estimate
TBD
Glossary
| Term | Definition |
|---|---|
| Gate | A mechanical check that denies a tool call when a governance rule is not met. |
| Plugin transport | The harness-specific code that connects the shared gate logic to a harness plugin API. |
| OpenCode V2 plugin API | The Plugin.define({ id, setup }) API that replaces the V1 plugin factory. |
| Code Mode | V2's execute tool that runs scripted tool calls. Nested calls still pass through execute.before. |
| Fail closed | A gate error denies the tool call. |
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix(me2resh#1956): close the patch gate hole and restore V1 support
test(me2resh#1956): cover a subagent-shaped V2 event
docs(me2resh#1956): correct the dual-support claims and patch wording
fix(me2resh#1956): tighten patch de-duplication and the version guard
docs(me2resh#1956): fix the 29 docs-lint writing faults
docs(me2resh#1956): split two semicolon sentences the advisory check …
fix(me2resh#1956): send the session cwd to the gate hooks
docs(me2resh#1956): clear the writing-profile advisories
fix(me2resh#1956): fail closed outside the ops root and on missing ed…
docs(me2resh#1956): split the ops-root fallback sentence
feat(#1956): port the opencode gate adapter to the V2 plugin API (#1959)
atlas-apex commentedon Nov 6, 2026
Delivered in #1959 (90c5e06). Thank you @zeyadsleem for the report and @ahmed-bermawy for the port. The change is on
devnow and ships in the next release. Until then, an ops fork can pick it up with/update --from-dev, which pulls pre-release work.