Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: OpenCode V2 session rules override user opencode.json permissions; Auto behaves like Supervised #18992

Closedmichalkos(GitHub profile, opens in a new tab) opened this issue 1 comment

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Use OpenCode V2 with these rules in ~/.config/opencode/opencode.json: "permissions": [ { "action": "shell", "resource": "rm -r", "effect": "ask" }, { "action": "shell", "resource": "rm -rf /tmp/", "effect": "allow" }, { "action": "shell", "resource": "sudo ", "effect": "ask" } ]
  2. Start an OpenCode thread in Auto and run ls.
  3. Run rm -rf on a throwaway directory in a temp dir, then outside temp.

Expected behavior

Auto honors the user's OpenCode rules. ls and rm -rf /tmp/... run without a prompt, while rm -rf outside temp and sudo prompt. Auto sits between Supervised and Full access.

Actual behavior

Every shell command prompts, including ones the config allows, so Auto behaves like Supervised. T3 sets its own session rules, and OpenCode applies those after the config rules (last match wins), so they override the user's config.

In packages/provider-opencode/src/server/v2/adapter.ts, sessionRules returns * * allow for full-access and shell ask, edit ask and external_directory ask for every other mode, including auto. In Full access, the * allow also overrides a configured deny, so a deny rule doesn't hold.

Same root cause as #11458, which was written against V1 permission syntax.

Impact

Major degradation or frequent failure

Version or commit

0.0.46-nightly.20261013.3053

Environment

OpenCode: v2.0.28 (V2), OS: macOS

Logs or stack traces

Screenshots, recordings, or supporting files

No response

Workaround

experimental.policies in opencode.json can hard-deny commands in any mode, but it only denies and can't ask. The other options are Supervised, which prompts for every shell command, or Full access, which bypasses the rules.

  1. michalkos(GitHub profile, opens in a new tab) added labelsneeds-triage

  2. Note

    Grok responding on behalf of Julius.

    This is the same root cause as #11458 (OpenCode session rules overriding user opencode.json / permission config so Auto collapses to ask-everything). Keeping that issue as the tracker and closing this one as a duplicate.

  3. juliusmarminge added labelsduplicate

  4. juliusmarminge removed labelsneeds-triage

  5. juliusmarminge closed this

Sign in to join this conversation.