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
Plugin SDK: permission.ask hook is never called #9229
The permission.ask hook defined in the @opencode-ai/plugin SDK is never triggered because OpenCode's permission system uses PermissionNext.ask() which emits Bus events instead of calling Plugin.trigger("permission.ask", ...).
Expected Behavior
When a permission check requires user approval, plugins should receive the permission.ask hook callback as documented in the SDK.
Actual Behavior
The permission.ask hook is never called. Instead, permission.asked events are emitted via the Bus system and can only be captured through the generic event hook.
Root Cause Analysis
OpenCode has two permission modules:
permission/index.ts (legacy/unused) - Contains Permission.ask() that calls Plugin.trigger("permission.ask", ...) at line 134
permission/next.ts (actively used) - Contains PermissionNext.ask() that publishes Bus.publish(Event.Asked, info) at line 140
All actual permission checks use PermissionNext.ask(), which:
Emits permission.asked via the Bus system (triggers generic event hook)
Does NOT call Plugin.trigger("permission.ask", ...)
Activity
github-actions commentedon Jan 18, 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 triggeredThis appears to be the same issue with identical root cause analysis and suggested fixes. Feel free to ignore if your specific case differs.
permission.askplugin hook is defined but not triggered #7006