anomalyco / anomalyco/opencode
Config permissions/agents overrides cannot override built-in agent policies (external_directory always asks)
Open
@kitlangton is already working on this.
Since Aug 20, 2026.
2.0
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 7h 2m
- Merged PRs (30d)
- 384
Description
Summary
Config-based YOLO / auto-approve does not work in opencode2 beta: setting permissions (V2 array) and agents.<id>.permissions to allow does not override built-in agent policies, so external_directory access still requires approval (ask) even with an allow-all rule.
Environment
- opencode version: 0.0.0-beta-17728
- OS: Linux 7.0.0-29-generic (Ubuntu) x86_64
- Terminal: TERM_PROGRAM=Orca TERM=xterm-256color COLORTERM=truecolor
- Shell: /bin/bash
- Install/channel: beta
- Server: background service http://0.0.0.0:49374
- Config: ~/.config/opencode/opencode.json
Reproduction
- Add the following to the global config:
{
"$schema": "https://opencode.ai/config.json",
"permissions": [{ "action": "*", "resource": "*", "effect": "allow" }],
"agents": {
"build": {
"permissions": [{ "action": "external_directory", "resource": "*", "effect": "allow" }]
}
}
}
- Restart the server:
opencode2 service restart - Run:
opencode2 run -m <model> "read /etc/hostname" - Result: permission is still requested
! permission requested: external_directory (/etc/*); auto-rejecting
Read /etc/hostname failed
The user declined this tool call
Expected Behavior
An allow-all rule (global or per-agent) should allow all tool actions including external directory access, so no permission prompt appears.
Actual Behavior
External directory access still asks. The built-in external_directory: ask policy wins over the user's allow rules.
Root Cause Analysis
- The
permissionsarray IS parsed:opencode2 debug agentsshows{action: "*", resource: "*", effect: "allow"}at the start of every agent's effective permission array. - V2 permission evaluation uses "last matching rule wins" (
findLast). The built-in agent policy rule{external_directory, *, ask}appears AFTER the user's allow-all, so it wins and the request is rejected/asked. agents.<id>.permissionsconfig overrides are NOT appended: debug agents output shows they are missing from the end of the built-in agents' permission arrays.- Source: the agent builder reads
cfg.agent(singular) but the config schema field isagents(plural), with no conversion — so JSON-configured agent overrides are ignored in this beta.
Suggested Fix
- Convert the V2
agentsfield into theagentobject used by the agent builder (packages/opencode/src/agent/agent.ts), or make the builder read the plural field - Or ensure user-specified agent rules are appended after built-in policies so they can override them
Workarounds
- CLI:
opencode2 run --auto/--yolo(client sends "once" for permission requests) — works - Web UI: click "Always allow" per project (manual)
Related known issues
- #9661/#21119 Web Revert/Fork actions missing/broken over the versions (web client session/state issues)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.