Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Copilot CLI chat session flow to handle plan-exit approval and permission prompts via core confirmation tools (through IToolsService) rather than via per-session permission handlers.
Changes:
- Add handling for
exit_plan_mode.requestedinCopilotCLISession, showing a confirmation prompt and responding to the SDK with approval/denial. - Remove the old
attachPermissionHandlerwiring from the VS Code participant contribution and shift permission prompting torequestPermission(...)usingIToolsService. - Update unit/e2e tests to validate confirmation-tool invocation and new session/command behaviors (e.g.,
/compact, yielding/steering).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/cli.stest.ts | Introduces a test IToolsService to auto-approve confirmations and asserts confirmation invocations instead of session permission handlers. |
| src/extension/chatSessions/vscode-node/test/copilotCLIChatSessionParticipant.spec.ts | Adds coverage for slash-command mapping and yielding behavior; adjusts mock clearing. |
| src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts | Removes participant-level permission handler attachment (permission prompting now handled in-session). |
| src/extension/chatSessions/copilotcli/node/test/copilotcliSession.spec.ts | Updates permission-related tests to use FakeToolsService confirmation results; adds /compact and steering-after-failure tests. |
| src/extension/chatSessions/copilotcli/node/copilotcliSession.ts | Implements exit-plan-mode approval via core confirmation tool; routes permission requests through requestPermission(...). |
Comments suppressed due to low confidence (1)
src/extension/chatSessions/copilotcli/node/copilotcliSession.ts:343
invokeToolis called withCancellationToken.Nonein the exit_plan_mode.requested handler. Since this listener is registered insidehandleRequestImpl, it has access to the request'stoken; usingNoneprevents cancellation/timeout from propagating and can leave the confirmation UI hanging after the request is cancelled. Pass the active request token instead.
const result = await this._toolsService.invokeTool(ToolName.CoreConfirmationTool, {
input: params,
toolInvocationToken: this._toolInvocationToken,
}, CancellationToken.None);
mjbvz
previously approved these changes
Mar 10, 2026
56f7ee4 to
661891c
Compare
661891c to
95bed31
Compare
justschen
approved these changes
Mar 10, 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.
No description provided.