GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(permission): wire permission.ask plugin hook by yohi · Pull Request #30509 · anomalyco/opencode

Conversation

@yohi

@yohi yohi commented Jun 3, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #7006
Closes #22311

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Properly wires the permission.ask plugin hook by adding Plugin.trigger right before the prompt. This allows plugins to
intercept and return allow or deny. It passes a shallow copy of the request info to prevent accidental mutation by plugins,
and uses Effect.catchCause so plugin defects don't crash the core flow.

How did you verify your code works?

Injected a mocked PluginLayer into next.test.ts and added specific test cases for plugin allow, deny, and exception
paths. All 82 tests pass successfully.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jiehanzheng, rafaelspecta, michal-billtech, awcjack, ReduxST, zpetterd, and glmn reacted with thumbs up emoji
All reactions
  • 👍 7 reactions
yohi added 3 commits June 3, 2026 14:17
@yohi
feat(permission): wire permission.ask plugin hook
a60ce94
Closes anomalyco#7006
Closes anomalyco#22311
@yohi
fix: address review comments for feat/permission-ask-hook
d7203b8
- Handle plugin errors in permission.ask hook and fallback to ask
- Add test cases for allow, deny, and error paths in plugins
- Add documentation for empty ruleset on plugin denial
@yohi
fix(permission): prevent plugin mutation of permission request data b…
3b35211
…y passing a copy
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

I found one potentially related PR:

Related PR:

  • fix(opencode): add permission.ask plugin hook back #19453 - fix(opencode): add permission.ask plugin hook back
    • fix(opencode): add permission.ask plugin hook back #19453
    • This appears to be a previous attempt to add the permission.ask plugin hook. Your PR (30509) may be addressing the same feature or fixing/completing what was attempted before.

The other search result (#12520) is unrelated to permissions.

Since #19453 exists, you may want to check if it was closed/abandoned and whether your PR supersedes it or builds upon it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@yohi
Merge branch 'dev' into feat/permission-ask-hook
934f17d
@yohi

yohi commented Jun 3, 2026

Copy link
Copy Markdown
Author

The following comment was made by an LLM, it may be inaccurate:

I found one potentially related PR:

Related PR:

  • fix(opencode): add permission.ask plugin hook back #19453 - fix(opencode): add permission.ask plugin hook back

    • fix(opencode): add permission.ask plugin hook back #19453
    • This appears to be a previous attempt to add the permission.ask plugin hook. Your PR (30509) may be addressing the same feature or fixing/completing what was attempted before.

The other search result (#12520) is unrelated to permissions.

Since #19453 exists, you may want to check if it was closed/abandoned and whether your PR supersedes it or builds upon it.

Thanks for the pointer! I reviewed #19453.

While both PRs aim to wire the permission.ask hook, this new PR (#30509) supersedes it by addressing critical safety and
reliability concerns:

    1. Safety (Mutation Prevention): This PR passes a shallow copy of the request info to the plugins, preventing malicious or
      buggy plugins from mutating the pending request state.
    1. Reliability (Error Handling): This PR wraps Plugin.trigger with Effect.catchCause. If a plugin throws an exception or
      defect, it gracefully falls back to the standard user prompt instead of crashing the agent's core execution flow.
    1. Testing: This PR includes comprehensive test coverage for allow, deny, and error paths using a mocked PluginLayer.

I believe this makes it a safer and more complete implementation. Please let me know what you think!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@yohi
yohi marked this pull request as ready for review June 3, 2026 05:56
yohi added 6 commits June 3, 2026 16:36
@yohi
Merge branch 'dev' into feat/permission-ask-hook
ce447d3
@yohi
Merge branch 'dev' into feat/permission-ask-hook
9808d8c
@yohi
Merge branch 'dev' into feat/permission-ask-hook
f1cfe37
@yohi
Merge branch 'dev' into feat/permission-ask-hook
fb76051
@yohi
Merge branch 'dev' into feat/permission-ask-hook
bd5d4b4
@yohi
Merge branch 'dev' into feat/permission-ask-hook
80b8f62
@rafaelspecta

rafaelspecta commented Jun 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Why is this not merged yet? Who needs to approve this?

wild-feather, DKotsyuba, themouette, adams79, and ReduxST reacted with thumbs up emoji
All reactions
  • 👍 5 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DKotsyuba

DKotsyuba commented Jun 24, 2026

Copy link
Copy Markdown

Please accept this pull request as soon as possible!

themouette, wild-feather, adams79, and ReduxST reacted with thumbs up emoji
All reactions
  • 👍 4 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@yohi yohi mentioned this pull request Jul 11, 2026
docs: OpenCode側のpermission.ask未発火に対する暫定アダプター運用を明記 yohi/chronos-gate#22
Merged
This was referenced Jul 29, 2026
fix(plugin): restore permission ask hook #39442
Closed
permission.ask plugin hook is defined but not triggered #7006
Closed
@github-actions github-actions Bot mentioned this pull request Aug 14, 2026
feat(permission): restore permission ask hook safely #42633
Closed
3 of 6 tasks
@github-actions github-actions Bot mentioned this pull request Sep 6, 2026
fix(opencode): run the documented permission.ask plugin hook #47675
Closed
3 of 6 tasks
@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thdxr thdxr closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Wire the permission.ask plugin hook permission.ask plugin hook is defined but not triggered

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@yohi @rafaelspecta @DKotsyuba @thdxr
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.