Skip to content

Agent Permission not work as expected #9927

Closed

Description

@beatwade

Description

  1. [init] create custom agent md format write constraint permissions
permission:
  skill:
    "req-create*": deny 
  1. [behavior]
    the skill req-create still work
Image
  1. [debug] log
    INFO 2026-01-22T02:30:11 +0ms service=permission permission=skill pattern=req-create ruleset=[{"permission":"","action":"allow","pattern":""},{"permission":"doom_loop","action":"ask","pattern":""},{"permission":"external_directory","pattern":"","action":"ask"},{"permission":"external_directory","pattern":"/Users/mac/.local/share/opencode/tool-output","action":"allow"},{"permission":"external_directory","pattern":"/Users/mac/.local/share/opencode/tool-output/","action":"allow"},{"permission":"question","action":"deny","pattern":""},{"permission":"plan_enter","action":"deny","pattern":""},{"permission":"plan_exit","action":"deny","pattern":""},{"permission":"read","pattern":"","action":"allow"},{"permission":"read","pattern":".env","action":"ask"},{"permission":"read","pattern":".env.","action":"ask"},{"permission":"read","pattern":".env.example","action":"allow"},{"permission":"webfetch","action":"allow","pattern":""},{"permission":"external_directory","action":"allow","pattern":""},{"permission":"write","action":"deny","pattern":""},{"permission":"edit","action":"deny","pattern":""},{"permission":"bash","pattern":"","action":"ask"},{"permission":"bash","pattern":"git diff","action":"allow"},{"permission":"bash","pattern":"git log*","action":"allow"},{"permission":"bash","pattern":"grep ","action":"allow"},{"permission":"read","action":"deny","pattern":""},{"permission":"webfetch","action":"deny","pattern":""},**{"permission":"skill","pattern":"req-create","action":"deny"},**{"permission":"external_directory","pattern":"/Users/mac/.local/share/opencode/tool-output","action":"allow"},{"permission":"external_directory","pattern":"/Users/mac/.local/share/opencode/tool-output/*","action":"allow"}] evaluate

you can see these lines:
first : "permission":"","action":"allow","pattern":""}
then: override {"permission":"skill","pattern":"req-create*","action":"deny"}

Plugins

No response

OpenCode version

1.1.31

Steps to reproduce

just create a custom agent

---
name: phase-router
description: test
mode: primary
permission:
  skill:
    "req-create*": deny 
---

the skill will trigger as normal without any restriction

Screenshot and/or share link

No response

Operating System

macos

Terminal

iterm2

Activity

  1. github-actions commented on Jan 22, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    These issues describe similar permission enforcement problems where configured restrictions (especially with wildcard/specific patterns) are not being properly applied.

    Feel free to ignore if none of these address your specific case.

  2. khimaros commented on Feb 7, 2026

    @khimaros
    Contributor

    is this the same cause as edit permission misbehaving?

    for example:

    permission:
        edit:
            "*": deny
            "foo/*": allow
            "foo/bar.md": ask
    
  3. johanlundberg commented on Feb 9, 2026

    @johanlundberg

    I'm seeing the same issue with bash permission rules from config not being enforced.

    Config (~/.config/opencode/opencode.json):
    bash: {
    *: ask,
    pytest *: allow,
    tail *: allow
    }

    Command that triggers the permission prompt:
    PYTHONPATH=src pytest -vvv src/webapp/tests/test_app.py 2>&1 | tail -20

    OpenCode correctly decomposes this into pytest * and tail * — the "Always allow" dialog says:

    This will allow the following patterns until OpenCode is restarted

    • pytest *
    • tail *

    So the pattern matching/decomposition logic works. But two things are broken:

    1. Config rules not applied — The exact same "pytest *": "allow" and "tail *": "allow" patterns already in my config don't prevent the prompt.
    2. "Always allow" doesn't persist within the session — After choosing "Always allow", the same command still prompts for permission again in the same session.

    This suggests the session-based "always allow" uses different (working) decomposition logic than the config-based rule evaluation, and even the session-based rules aren't actually being stored/consulted on subsequent calls.

  4. github-actions commented on Apr 11, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions