-
Notifications
You must be signed in to change notification settings - Fork 1.4k
More tests for Copilot CLI and refactor permission handling #1871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1701c32 to
1da1332
Compare
1da1332 to
a6332d4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the CopilotCLI session permission handling architecture, moving from a centralized permission handler to a session-based approach. The changes improve modularity by allowing each session to manage its own permission requests through attached handlers, and add comprehensive test coverage for the new architecture.
Key Changes
- Refactored permission handling from global
CopilotCLIPermissionsHandlerclass to session-level handlers viaCopilotCLISessionOptions - Added stream attachment mechanism to sessions, separating stream lifecycle from request handling
- Introduced comprehensive unit tests for CopilotCLI chat session participant
- Extracted
UncommittedChangesStepconstant to improve maintainability
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| src/extension/agents/copilotcli/node/copilotCli.ts | Removed CopilotCLIPermissionsHandler class and introduced CopilotCLISessionOptions interface with permission handler registration |
| src/extension/agents/copilotcli/node/copilotcliSession.ts | Added attachPermissionHandler and stream attachment methods; refactored handleRequest to remove stream parameter |
| src/extension/agents/copilotcli/node/copilotcliSessionService.ts | Updated session creation/retrieval to use new options interface; removed isEmpty tracking from session items |
| src/extension/agents/copilotcli/node/permissionHelpers.ts | Added requestPermission helper function to encapsulate permission request logic |
| src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts | Refactored request handling flow; replaced vscode.commands calls with IRunCommandExecutionService |
| src/extension/chatSessions/vscode-node/copilotCloudSessionsProvider.ts | Extracted UncommittedChangesStep constant for consistency |
| src/extension/chatSessions/vscode-node/test/copilotCLIChatSessionParticipant.spec.ts | New comprehensive test file covering participant request handling scenarios |
| src/extension/agents/copilotcli/node/test/copilotcliSession.spec.ts | Updated tests to reflect new permission handler and stream attachment APIs |
| src/extension/agents/copilotcli/node/test/copilotCliSessionService.spec.ts | Updated tests to work with new CopilotCLISessionOptions interface |
No description provided.