Skip to content

V2: subagent frontmatter skill allows ignored (global deny wins) #50149

Closed

Description

@darellchua2

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 permissions apply before agent-specific rules, so later agent rules can refine them"
  • /v2/docs/skills — loading a skill "Checks the selected agent's skill permission"; "Place the same rules under agents.<id>.permissions to 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

  1. Global config ~/.config/opencode/opencode.json:
{ "permissions": [
    { "action": "skill", "resource": "*", "effect": "deny" },
    { "action": "skill", "resource": "other-skill", "effect": "allow" }
] }
  1. Create ~/.config/opencode/skills/my-test-skill/SKILL.md with frontmatter name: my-test-skill and a description (ID is path-derived, so name matching the directory is irrelevant to the bug).

  2. 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.
  1. From the primary agent, launch my-reviewer and let it run its instruction.
  2. Observed: my-test-skill missing from the subagent's skill catalog; the skill call returns {"error":{"type":"permission.rejected","message":"Permission denied: skill"}}.
  3. 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

  1. martin-braun commented on Sep 23, 2026

    @martin-braun

    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.

  2. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report. I could reproduce this on 2.0.11, but not on the latest dev (fa1260d).

    What I found:

    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:

    The 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.

  3. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    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: or tools:. A key like that made the file be read in the V1 format, and the V2 permissions: list was dropped. On the latest dev (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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions