Before submitting#
Area#
apps/server
Steps to reproduce#
- 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" }
]
- Start an OpenCode thread in Auto and run
ls.
- 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.
Note
Grok responding on behalf of Julius.
This is the same root cause as #11458 (OpenCode session rules overriding user
opencode.json/permissionconfig so Auto collapses to ask-everything). Keeping that issue as the tracker and closing this one as a duplicate.