You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
permission.ask plugin hook is never triggered #47674
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.
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.
In OpenCode V2 the replacement is ctx.permission.hook("evaluate"), which runs for every permission check (tool calls and external_directory) before any prompt is shown:
export default {
id: "my-policy",
async setup(ctx) {
await ctx.permission.hook("evaluate", async (event) => {
// event: { sessionID, agent, action, resources, metadata, source, effect, message }
if (event.action === "shell" && event.resources.some((r) => r.startsWith("rm "))) {
event.effect = "deny" // or "allow" to skip the prompt, or "ask" to force one
event.message = "Blocked by policy"
}
})
},
}
Setting allow skips the prompt, deny blocks the action with your message, and ask forces a prompt. An explicit deny in config is final and doesn't reach the hook. Docs: Plugins → Permission hooks and Migrate plugins from V1.
Activity
github-actions commentedon Sep 6, 2026
This issue might be a duplicate of existing issues. Please check:
permission.askplugin hook is defined but not triggered #7006:permission.askplugin hook is defined but not triggered (open)permission.askis typed and documented but never triggered #46809: plugin:permission.askis typed and documented but never triggered (closed)Please review these before proceeding, and consider adding your findings or a
+1to one of the existing issues instead.rekram1-node commentedon Oct 14, 2026
In OpenCode V2 the replacement is ctx.permission.hook("evaluate"), which runs for every permission check (tool calls and external_directory) before any prompt is shown:
Setting allow skips the prompt, deny blocks the action with your message, and ask forces a prompt. An explicit deny in config is final and doesn't reach the hook. Docs: Plugins → Permission hooks and Migrate plugins from V1.