anomalyco / anomalyco/opencode

permission.ask plugin hook is never triggered

Open
#47,674 1 comment 1 reaction 1 assignee View on GitHub

@kitlangton is already working on this.

Since Sep 6, 2026.

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

Description

packages/plugin/src/index.ts:261 declares a permission.ask hook:

"permission.ask"?: (input: Permission, output: { status: "ask" | "deny" | "allow" }) => Promise<void>

Nothing ever calls it. trigger( appears in six places across the repo —
shell.env (x2), experimental.chat.system.transform,
experimental.chat.messages.transform (x2) and tool.definition — and
permission.ask is not among them.

So a plugin that registers the hook is silently ignored: no warning, no error,
the handler simply never runs.

Reproduce

Plugin:

export default async () => ({
  "permission.ask": async (input, output) => {
    console.log("permission.ask fired", input.permission)
    output.status = "deny"
  },
})

Point opencode.json at it and ask the agent to run any shell command. The
command runs, nothing is logged, and the hook never fires.

Why it matters

There is no other interception point for permission decisions. Denying has to
be done by throwing from tool.execute.before, allowing has to be done by
auto-answering the permission.asked event after the prompt has already
appeared, and permission requests that are not tool calls (external_directory,
sandbox escalation) never reach a plugin at all.

Happy to send a PR — I have one working.

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.