feat(opencode): migrate adapters to native V2 frontmatter #242
No reviewers
Labels
No labels
bug
cannot reproduce
duplicate
enhancement
help wanted
invalid
need info
need triage
need verification
not a bug
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
claudiomaradonna/agent-foundry!242
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "opencode-adapters-v2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The source's OpenCode support describes its seven agent adapters in the
deprecated OpenCode 1 frontmatter (
permission:maps with V1 actionnames), which OpenCode 2 still translates; the three implementer
adapters are identical except for their names, and no document tells a
project how to give them a model and a reasoning-effort variant, so
execute-plan's "one effort up" retry silently restarts an identical
agent; and
execute-plandenied OpenCode sessions the implementercontinuation the client's
subagenttool supports. A README sentencealso still claimed the two OpenCode hooks had never run in OpenCode
itself. A 2026-11-21 review of the OpenCode implementation reported
these.
What changed
The adapters now declare the native OpenCode 2
permissions:list: acatch-all deny rule first, then one allow rule per action,
bashrenamed to
shell,editcovering edit, write and patch, andexternal_directorykept explicit. The effective grant per role isunchanged — the migration is syntactic — and the validator pins the new
block as exact text, rejects a file that mixes the V1 and V2 formats,
and keeps catching the tamperings it caught before, one new case
included.
docs/workflows/actions.md§ Subagent models now says how a projecttunes the adapters —
model: provider/modelin the frontmatter, acatalogue reasoning variant after
#, an unknown variant amodel-resolution error — and what it gets untuned: an escalated attempt
restarts the same model at the same effort. The README points there.
execute-plannames OpenCode beside Claude Code and Codex forcontinuing a reported implementer, by calling the
subagenttool againwith that implementer's child
sessionID; the workflows page mirrorsit.
The README § Hooks and settings now states what has been observed: the
hooks target OpenCode's 2.1.4 plugin API and run in 2.x only, the tests
exercise the plugins against stubs, and both hooks ran in OpenCode 2.3.2
in a session at this source — the guard refused an edit in a main
checkout, the shell check appended its report to a file tool's output.
How to verify
Base
65c0138, branchopencode-adapters-v2atf491863. From afresh checkout,
bash tests/verify-agent-config.shprintsall 333 agent configuration tests passed; on the base the samecommand passes with its own 332 tests.
The rewritten guards use names the branch adds, so they fail on the
base's code:
The two OpenCode cases print
not ok— missing the newpermissions blockand mixing diagnostics — while the same file on thebranch prints
ok. Run and reported from this session.Live enforcement, run here on OpenCode v2.3.2 (model
Qwen3.8-Flash-Next): seed a scratch git repository with the branch's.opencode/agents/and a stubAGENTS.md, then from it runopencode run --auto --agent security-reviewer "List every tool you can call, one per line". Observed: exactlyglob, grep, read, shell, skill; the advisor addswebfetchandwebsearch;implementer-lowhas
editandwriteand no web tools; and asking the reviewer towrite a file under
--autoreturnedNO_WRITE_TOOLwith no filecreated — had OpenCode ignored the block, the permissive default plus
--autowould have written it.The README passage, before: "…they run in 2.x only, and the tests
exercise the plugins against stubs of the hooks, so they have not yet
run in OpenCode itself." After: "…they run in 2.x only; the tests
exercise the plugins against stubs of the hooks, and both hooks ran in
OpenCode 2.3.2 in a session at this source: the guard refused an edit
in a main checkout on its main branch, and the shell check appended its
report to the output of a file tool that had just written a shell
script."
Checks run on the tip, all passing: 333 agent-configuration tests,
46 work-folder check tests,
scripts/verify-agent-config.shvalid(
state=template), shell check 51 files clean,prettier --check '**/*.md'clean,git diff --check mainclean. Not run: thebehavioral evals, billed and maintainer-run only; they exercise the
unchanged Claude and Codex paths.
Considerations
The validator pins the block as exact text on purpose: a project that
widens its own adapters must update the pin, and the tamper tests keep
an unaccompanied widening loud. Live verification is one OpenCode 2.3.2
session at this source; the plugins' per-location loading in worktree
sessions and their
patchbranch remain unprobed live, as theREADME's scope clause says. The adapters ship with no
model:forportability — the tiers become real only when the project tunes them,
which the guide now spells out.