copilotcli: Enhance permission handling in Copilot CLI#310359
Merged
DonJayamanne merged 6 commits intomainfrom Apr 16, 2026
Merged
copilotcli: Enhance permission handling in Copilot CLI#310359DonJayamanne merged 6 commits intomainfrom
DonJayamanne merged 6 commits intomainfrom
Conversation
Contributor
Screenshot ChangesBase: Changed (13)blocks-ci screenshots changedReplace the contents of Updated blocks-ci-screenshots.md<!-- auto-generated by CI — do not edit manually -->
#### editor/codeEditor/CodeEditor/Dark

#### editor/codeEditor/CodeEditor/Light
 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves Copilot CLI session initialization and refactors permission handling by moving most permission-decision logic out of CopilotCLISession into dedicated helpers. It also ensures deferred repository hooks are loaded as part of session creation/get, which should make repo-related functionality available earlier in CLI sessions.
Changes:
- Load deferred repository hooks during both session creation and session retrieval.
- Refactor permission handling into dedicated
handle*Permissionfunctions and introduce pure builders for shell/MCP confirmation params. - Update unit tests to target the new pure builders and keep
requiresFileEditconfirmationcoverage.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts | Loads deferred repo hooks during createSession and getSession. |
| extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts | Replaces in-class permission handling with calls into permissionHelpers handlers. |
| extensions/copilot/src/extension/chatSessions/copilotcli/node/permissionHelpers.ts | Adds handler functions for read/write/shell/mcp permissions and shared invocation logic. |
| extensions/copilot/src/extension/chatSessions/copilotcli/node/test/permissionHelpers.spec.ts | Updates tests to cover new pure param builders; removes broader mapping tests. |
Copilot's findings
- Files reviewed: 4/4 changed files
- Comments generated: 5
roblourens
approved these changes
Apr 16, 2026
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.
Improve permission handling by ensuring deferred repository hooks are loaded during session creation in the Copilot CLI. This change enhances the overall functionality and responsiveness of the CLI. Testing can be done by initiating sessions and verifying that the hooks are correctly loaded.