Skip to content

opencode: subagents launched from T3 Code ignore agent permissions #38100

Open

Description

@XScythe

Summary

Subagents launched from an OpenCode session running inside T3 Code ignore their agent permissions. A custom agent with edit: deny, and even the built-in explore agent, can call write and create files. The same agents launched with opencode run --standalone enforce their permissions correctly.

Environment

  • opencode version: 2.3.0
  • OS: Linux 7.0.0-1017-aws x86_64
  • Terminal: Unavailable: running under T3 Code, no terminal env vars
  • Shell: /bin/bash
  • Install/channel: latest
  • Active plugins: opencode-ponytail

Reproduction

  1. Create ~/.config/opencode/agents/review.md:
    ---
    description: Reviews changes
    mode: subagent
    model: github-copilot/claude-sonnet-5.5#medium
    permissions:
      - action: edit
        resource: "*"
        effect: deny
    ---
    Review the current changes.
  2. In a T3 Code thread using the OpenCode harness (tested in both full-access and approval-required runtime modes), ask the main agent to launch the review subagent (or the built-in explore subagent) and have it create a file with the write tool.
  3. Run the same agent with opencode run --standalone --auto --agent review "create ./t.txt with the write tool".

Expected Behavior

The subagent has no write tool, or the call is denied. This is what happens in step 3: review reports no write tool, and a touch through shell returns permission.rejected.

Actual Behavior

In step 2 the subagent has a write tool and the call succeeds with "Created file successfully". The built-in explore, which denies everything except reads, search, web, and shell, also gets write. The agent's model setting is still applied (Haiku or Sonnet as configured), so the agent file is loaded. Only permissions are dropped.

Additional Context

  • Reproduced consistently: 3 of 3 attempts in a full-access thread, plus a write tool still present in an approval-required thread.
  • The server log has no permission entries for these subagent sessions.
  • It is unclear whether this is in T3 Code's OpenCode integration or in OpenCode's handling of permissions for child sessions started by an external client.

Metadata

Metadata

Assignees

No one assigned

    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