Skip to content

regression: permission.ask plugin hook dropped in Effect refactor (38e0dc9) #28066

Closed

Description

@athal7

Summary

The permission.ask plugin hook was accidentally dropped during the "Move service state into InstanceState" refactor in commit 38e0dc9 (Mar 20 2026). The hook was present and working from the initial plugin implementation (ca03127, Aug 2025) through the last pre-refactor commit (f015154), but the call site was not ported to the Effect-native rewrite.

Before (f015154 — last working)

switch (
  await Plugin.trigger("permission.ask", info, {
    status: "ask",
  }).then((x) => x.status)
) {
  case "deny":
    throw new RejectedError(...)
  case "allow":
    // auto-allow without prompting

After (38e0dc9 — regression)

The Plugin.trigger("permission.ask", ...) call is gone. Permission.ask now evaluates the ruleset and either returns silently (allow), throws DeniedError (deny), or publishes Event.Asked to the bus — but never calls the plugin hook. The type declaration in packages/plugin/src/index.ts line 260 still ships, so plugin authors write handlers that silently do nothing at runtime.

Impact

Any plugin registering permission.ask to auto-allow read-only commands — the documented use case for this hook — has been silently broken since v1.x March 2026. The hook is still declared in @opencode-ai/plugin types and referenced in no docs or examples that would surface the regression.

Suggested fix

Re-add the Plugin.trigger call in packages/opencode/src/permission/index.ts inside Permission.ask, before the bus.publish(Event.Asked, info) line:

// After needsAsk check, before publishing the ask event:
const pluginResult = yield* Effect.promise(() =>
  Plugin.trigger("permission.ask", info, { status: "ask" as const })
)
if (pluginResult.status === "allow") return
if (pluginResult.status === "deny") return yield* new DeniedError(...)

// existing: create pending + publish

The exact Effect-idiomatic form may differ — the point is restoring the call site that was present before the refactor.

Activity

  1. github-actions commented on May 17, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    The new issue adds context about the specific refactor commit (38e0dc9) that dropped the call site, which could help with the fix, but the underlying problem is the same one tracked in #7006.

  2. athal7 commented on May 17, 2026

    @athal7
    ContributorAuthor

    Duplicate of #7006. The fix is already in PR #19453 awaiting review. Adding the specific regressing commit (38e0dc9) to #7006 for context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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