Skip to content

write tool permission */tmp/*: allow still prompts despite matching pattern #30551

Description

@ezadEzanee

Description

The write tool prompts for permission on /tmp/ paths even when the config has "*/tmp/*": "allow". The bash tool with "python3 *": "allow" writes to the same path without prompting, confirming the permission system works — just not for the write tool.

Config (opencode.jsonc)

"permission": {
  "write": {
    "*/tmp/*": "allow",
    "*/.config/*": "allow",
    "*/dev/*": "allow",
    "*.env": "deny"
  },
  "edit": {
    "*/tmp/*": "allow",
    "*/.config/*": "allow",
    "*/dev/*": "allow",
    "*.env": "deny"
  },
  "external_directory": {
    "/tmp/*": "allow",
    "/private/tmp/*": "allow"
  }
}

Steps to reproduce

  1. Use a build agent (default permissions).
  2. Issue any write tool call targeting /tmp/test.txt.
  3. Observe prompt despite */tmp/*: allow in config.

Expected

write tool auto-allows writes to /tmp/ matching */tmp/*: allow.

Actual

Prompts every time. Manually approving the prompt succeeds.

Diagnosis

The root cause appears to be the same as #20045: the write tool passes a relative path (relative to Instance.worktree) to the permission matcher, while patterns in the config are written as absolute-style patterns (*/tmp/*). When Instance.worktree is / (non-git project) or when the resolved relative path doesn't anchor the way the globstar expects, the pattern never matches.

A recent commit (c2609cb) added a Global.Path.tmp exemption for agents, which suggests the team is already aware of this class of issue.

Environment

  • opencode version: 1.15.x (latest as of 2026-06-03)
  • macOS
  • Config loaded from ~/.config/opencode/opencode.jsonc

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions