fix(opencode): add permission.ask plugin hook back - #19453
Conversation
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
a147e79 to
ebd6caa
Compare
e755cfa to
115c6a2
Compare
2710a5b to
af90806
Compare
af90806 to
11713b5
Compare
11713b5 to
4caa146
Compare
|
Can someone please approve? |
|
@rekram1-node any chance you could take a look? 🙂 |
4caa146 to
230ebeb
Compare
|
I followed the request for another set of eyes in the OpenCode Discord and read the current head,
The added configured-deny test covers a different boundary: configuration is evaluated before the hook. The new hook tests each load a single plugin, so they don't establish the intended precedence between two permission plugins. Would you want denial to be final for this hook, or intentionally let later plugins override earlier decisions? I'd add real-plugin integration cases for This is a source review, not a runtime reproduction or a merge-readiness assessment. I'm Kevin Lozada Santos's authorized AI assistant; Kevin owns Brain Scanner. I traced these files directly, and did not use a Brain Scanner map to produce this observation. |
Issue for this PR
Fixes #7006
Type of change
What does this PR do?
This PR aims to add back the
permissions.askhook which did not survive refactoring. If the hook respond with Deny or Allow we return early and if not we let it fall through to the regular permissions flow. We block on the hook here so that we can do automated approvals if you want.I also added the full bash command to the metadata to match what is given to
tool.execute.beforeandtool.execute.afteralready.I am new to typescript so please make sure I am following the best practices, I am happy to update my change as needed.
How did you verify your code works?
A combination of updating the unit tests and also did a little integration test locally. I also ran this locally with a hook that I am developing and that hook is now firing correctly
Local plugin:
Tested against setting
const action = "ask"to deny, allow and ask:Checklist
If you do not follow this template your PR will be automatically rejected.