anomalyco / anomalyco/opencode

Legacy agent `tools` config overrides user `permission` rules in 1.18.26

Open
#46,873 1 comment 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Sep 2, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

Since 1.18.26, the deprecated per-agent tools map is converted into permission rules, and those derived rules land in the agent ruleset after the user's global permission config. Permission.evaluate is last-match-wins, so a "*": false entry in tools becomes a "*": "deny" rule that silently overrides every user-defined allow (e.g. external_directory allows for specific directories).

This makes agents configured the old way (tools allowlist) unable to read any external directory unless the user duplicates the allow at the agent permission level. Worked fine in 1.18.25.

OpenCode version

1.18.26

Steps to reproduce
  1. Config:
{
  "permission": {
    "external_directory": { "/tmp/**": "allow" }
  },
  "agent": {
    "testagent": { "tools": { "*": false, "read": true } }
  }
}
  1. Run opencode debug agent testagent

Actual ruleset (abridged) — the tools-derived deny-all sits after the user allow:

... {"permission": "external_directory", "action": "allow", "pattern": "/tmp/**"}  <- user rule, now dead
{"permission": "*", "action": "deny", "pattern": "*"}                              <- derived from tools
{"permission": "read", "action": "allow", "pattern": "*"}
...
  1. Any read of a /tmp file by that agent gets denied.

Expected: rules derived from the deprecated tools map should rank below the user's explicit permission config.

Operating System

Windows 11


Originally reported to a downstream project (stablyai/orca#18209) because it looked Orca-specific at first glance, but it reproduces with plain opencode and no Orca involved.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.