GeezerVison is showing github.com — feat(permission): wire permission.ask plugin hook by yohi · Pull Request #30509 · anomalyco/opencode
Conversation
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
- 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
|
The following comment was made by an LLM, it may be inaccurate:
I found one potentially related PR:
Related PR:
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The following comment was made by an LLM, it may be inaccurate:
I found one potentially related PR:
Related PR:
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:
-
- 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.
-
- 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.
-
- 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!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Why is this not merged yet? Who needs to approve this?
|
wild-feather, DKotsyuba, themouette, adams79, and ReduxST reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Please accept this pull request as soon as possible!
|
themouette, wild-feather, adams79, and ReduxST reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Jul 29, 2026
|
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 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|