fix(permissions): fix permission request with sub-agents#162
Merged
Conversation
The permission request seems to have changed it's format I updated the permission handling to support both format This should fix #156
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes permission request handling to support a new format where permission event properties are nested under a tool object, while maintaining backward compatibility with the old flat format. The issue appears to have emerged with changes to sub-agent permission requests.
Key Changes
- Updated permission request detection logic to support both nested (
permission.tool.callID/messageID) and flat (permission.callID/messageID) formats - Added subscription to
permission.askedevent in addition to existingpermission.updatedevent - Enhanced auto-scroll behavior when permission prompts are rendered
- Added test data and configuration for the new permission format
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lua/opencode/event_manager.lua | Added optional tool field to OpencodePermission type definition for nested format support |
| lua/opencode/ui/renderer.lua | Updated permission event handlers to extract callID/messageID from either nested or flat format; added permission.asked event subscription and auto-scroll on permission updates |
| lua/opencode/ui/formatter.lua | Enhanced permission matching logic to check both nested tool format and legacy flat format when determining whether to display permission prompts |
| tests/replay/renderer_spec.lua | Added new test case identifier to skip list for full session tests |
| tests/data/*.json | Added test data files for the new permission format in approve/deny/ask scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

The permission request seems to have changed it's format
I updated the permission handling to support both format
This should fix #158