Repository navigation
Description
Description
Agent frontmatter permissions rules with action: "skill", effect: "allow" have no effect for subagents in V2. The child session appears to evaluate only the parent/global ruleset, so a global { "action": "skill", "resource": "*", "effect": "deny" } (the allowlist pattern from the permissions docs) hides and rejects skills that the subagent explicitly allows in its own frontmatter.
The docs describe the opposite behavior:
- /v2/docs/permissions — "Lower-priority configuration is loaded first, global rules are appended next, and agent rules are appended last" (last matching rule wins)
- /v2/docs/agents — "Global
permissionsapply before agent-specific rules, so later agent rules can refine them" - /v2/docs/skills — loading a skill "Checks the selected agent's
skillpermission"; "Place the same rules underagents.<id>.permissionsto apply them only to one agent"
Observed on v2.0.11: the skill is absent from the subagent's available-skills catalog (the catalog mirrors the primary's global-allow view — 37 skills — rather than anything derived from the subagent's own frontmatter), and the skill tool call fails with {"error":{"type":"permission.rejected","message":"Permission denied: "skill"}}.
Steps to reproduce
- Global config
~/.config/opencode/opencode.json:
{ "permissions": [
{ "action": "skill", "resource": "*", "effect": "deny" },
{ "action": "skill", "resource": "other-skill", "effect": "allow" }
] }-
Create
~/.config/opencode/skills/my-test-skill/SKILL.mdwith frontmattername: my-test-skilland a description (ID is path-derived, sonamematching the directory is irrelevant to the bug). -
Create
~/.config/opencode/agents/my-reviewer.md:
---
description: Loads a skill
mode: subagent
permissions:
- { action: skill, resource: my-test-skill, effect: allow }
---
Call the skill tool with id "my-test-skill" and report the exact result.- From the primary agent, launch
my-reviewerand let it run its instruction. - Observed:
my-test-skillmissing from the subagent's skill catalog; theskillcall returns{"error":{"type":"permission.rejected","message":"Permission denied: skill"}}. - Expected: the agent-level allow is the last matching rule, so the skill is advertised and loads without approval.
Proposed solution
Include the subagent's own permission rules in the child session's derived ruleset, appended after the global rules per the documented merge order. The V1 lineage of this bug is analyzed in #33223 (deriveSubagentSessionPermission reads input.subagent.permission only for task/todowrite checks and never includes it in the output) — worth checking whether the V2 derivation inherited the same shape. Related: #26758, #27497 (fixes #27201, #27654), #35238.
Plugin suggestion
While unfixed, a plugin-side workaround is currently impossible because the derived child-session permission set is never surfaced. Exposing a permission-derivation hook (e.g. an event/execute-style hook receiving the child session's effective permission set before the first tool call) would let deployments audit or patch derived rules, and would enable the "permission derivation receipt" test suggested in #33223's comments (fail when a subagent rule was silently dropped).
Plugins
@prevalentware/opencode-goal-plugin@^0.1.48 plus a local secret-masking plugin; neither touches permissions. The repro above requires no plugins.
OpenCode version
v2.0.11
Operating System
Ubuntu 24.04.5 LTS (x86_64)
Terminal
Reproduced headless via the agent API (no TUI involved).
Activity
feat(skills): implement Phases 1-2 — interim reviewer-skill allows (f…
martin-braun commentedon Sep 23, 2026
Confirmed, the V2 permissions do not work as documented. I had to revert my migration to the V1 format. However, the V2 permissions in opencode.json work.
opencodejr commentedon Oct 28, 2026
Thanks for the detailed report. I could reproduce this on 2.0.11, but not on the latest
dev(fa1260d).What I found:
description,modeandpermissionsin the frontmatter), 2.0.11 worked. The subagent listedmy-test-skillin its skill catalog and loaded it, even with the globalskill * deny.name: my-reviewer;tools:,version:or any other unknown key does the same), I got what you describe: the skill was missing from the subagent's catalog and theskillcall was denied. In 2.0.x, any key the V2 agent schema doesn't know makes the file be read in the V1 format, and the V2permissions:list is dropped. That was tracked in agents: markdown frontmatter "permissions" (V2) parsed but never applied to sessions #50598 (and agents: an unknown frontmatter key swallows the permissions block into request.body and drops the rules #57819) and fixed by fix(core): read agent files with V2 fields as V2 #58218. With that fix, a file that usespermissions,request,systemordisabledis read as V2, and V1 fields in it are ignored with a warning in the log. The fix is in v2.1.4 and later.dev, both variants work: the skill is listed for the subagent and loads.So this is likely already fixed, and the fix should be in the next release you upgrade to. If your real agent file has extra keys like
name:, removing them is a workaround on older versions.Related issues:
permissions:dropped when the frontmatter has a non-V2 key), fixed by fix(core): read agent files with V2 fields as V2 #58218The bot will close this issue in 1 day unless you reply that it still happens, e.g. on v2.1.4 or newer, or with an agent file that has only V2 fields.
opencodejr commentedon Oct 29, 2026
Closing this as completed, since there was no reply in the past day.
You saw this on 2.0.11. I could only make it happen there when the agent file had a key that isn't a V2 field, such as
name:ortools:. A key like that made the file be read in the V1 format, and the V2permissions:list was dropped. On the latestdev(fa1260d) the subagent lists the skill and loads it, with or without such a key. The fix is #58218 (tracked in #50598). It is already in v2.1.4 and later, so upgrading should resolve this. On older versions, removing the extra keys from the frontmatter works around it.If it still happens on v2.1.4 or newer, please comment here or open a new issue with your agent file's frontmatter. Thanks for the detailed report!