anomalyco / anomalyco/opencode

code mode: execute dispatcher bypasses ask permission for nested plugin tools

Open
#47,177 2 comments 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Sep 4, 2026.

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

Description

Summary

In a Code Mode session, plugin tools invoked through the execute dispatcher do not surface the configured ask permission. A mutation tool declared with options.permission mapped to an ask rule executes silently, with no permission prompt in the client.

Environment

  • opencode version: 0.0.0-beta-18999 (opencode2, beta channel)
  • OS: Linux Cyber-Nekokoya 7.2.2-zen1-1-zen x86_64 (Arch)
  • Terminal: TERM=xterm-256color, COLORTERM=truecolor
  • Shell: /usr/bin/zsh
  • Install/channel: beta (local @opencode-ai/cli)
  • Active plugins:
    • server (auto-discovered local): session-tools.ts, systemd-user-tools.ts
    • cli.json TUI plugins: ./plugins/sandbox-toggle, ./plugins/git-write-toggle

Reproduction

  1. Global opencode.jsonc has rules such as { "action": "systemd_user_start", "resource": "*", "effect": "ask" }.
  2. A server plugin exposes a tool with options: { permission: "systemd_user_start" } via context.tool.transform((e) => e.add(...)).
  3. In a Code Mode session, invoke that tool through the dispatcher, e.g. an execute block calling tools["systemd_user_start"]({ unit: "wivrn.service" }).
  4. Observe: the unit starts/stops successfully, and the client never shows an ask prompt (no permission.asked event; compare with early-session direct tool calls, which did produce asking id=per_... log lines).

Expected Behavior

The docs for the execute action state each nested tool still enforces its own permission. An ask rule should prompt the user (or be rejected when no interactive channel is available).

Actual Behavior

The ask rule is bypassed: mutation tools execute silently through the execute dispatcher. In our session systemd_user_start/stop for wivrn.service ran with no confirmation. Risk: any ask-class plugin tool is unenforced in Code Mode.

Additional Context

  • Reproducible consistently via execute.
  • Direct (non-dispatcher) tool calls in the same environment do prompt, so the bypass appears specific to the Code Mode dispatcher path.
  • No saved "allow always" approval exists for these actions; config rules are intact ask.

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.