Skip to content

Update GitHub Copilot npm and permission handling - #313364

Merged
Don Jayamanne (DonJayamanne) merged 4 commits into
mainfrom
don/drab-goose
Apr 30, 2026
Merged

Don Jayamanne (DonJayamanne) merged 4 commits into
mainfrom
don/drab-goose

Conversation

@DonJayamanne

Copy link
Copy Markdown
Contributor

Update the GitHub Copilot npm package version and modify permission handling to use 'approve-once' instead of 'approved' for better control over permission requests.

Copilot AI review requested due to automatic review settings April 29, 2026 22:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Copilot CLI integration to a newer @github/copilot SDK version and adjusts how Copilot CLI permission requests are approved, switching from persistent-style approvals (approved) to one-time approvals (approve-once).

Changes:

  • Bump @github/copilot from 1.0.34 to 1.0.39.
  • Update permission handling and related tests to return/expect { kind: 'approve-once' }.
  • Adjust Copilot CLI E2E test setup to use real auth/token flow and simplify session/service scaffolding.
Show a summary per file
File Description
extensions/copilot/test/e2e/cli.stest.ts Refactors CLI E2E harness to use env-based GitHub OAuth token + public CAPI endpoint; simplifies mocks and stream assertions.
extensions/copilot/src/extension/chatSessions/copilotcli/node/test/copilotcliSession.spec.ts Updates expectations for the new approve-once permission result kind.
extensions/copilot/src/extension/chatSessions/copilotcli/node/permissionHelpers.ts Switches permission handlers to return approve-once and updates confirmation-tool approval result.
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts Forces SDK sessions to require permissions via setPermissionsRequired(true).
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts Updates auto-approval and MC permission resolution to use approve-once.
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotCli.ts Prevents duplicate agents by tracking “known” agent source URIs.
extensions/copilot/package.json Updates @github/copilot dependency spec to ^1.0.39.
extensions/copilot/package-lock.json Locks @github/copilot (and platform packages) to 1.0.39.

Copilot's findings

Files not reviewed (1)
  • extensions/copilot/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

extensions/copilot/src/extension/chatSessions/copilotcli/node/permissionHelpers.ts:183

  • handleWritePermission still checks result.kind === 'approved' before calling trackEditIfNeeded, but confirmation now returns { kind: 'approve-once' }. As a result, edits approved via the interactive confirmation path will no longer be tracked (only auto-approved edits are tracked). Update the condition to match the new approval kind (or handle both kinds if backward compatibility is needed).
	const result = await invokeConfirmationTool(toolParams, toolParentCallId, toolsService, toolInvocationToken, logService, token);
	if (result.kind === 'approved' && editFile) {
		await trackEditIfNeeded(editTracker, toolCall, editFile, stream, logService);
	}
	return result;
  • Files reviewed: 7/8 changed files
  • Comments generated: 1

@DonJayamanne

Copy link
Copy Markdown
Contributor Author

Copilot Fix the test failures in src/extension/chatSessions/copilotcli/node/test/permissionHelpers.spec.ts
see failures here https://github.com/microsoft/vscode/actions/runs/25138101669/job/73681299108?pr=313364

Copilot AI commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Copilot Fix the test failures in src/extension/chatSessions/copilotcli/node/test/permissionHelpers.spec.ts
see failures here https://github.com/microsoft/vscode/actions/runs/25138101669/job/73681299...

Fixed in 4414174. Two issues were causing the failures:

  1. permissionHelpers.ts line 180 still checked result.kind === 'approved' after invokeConfirmationTool was updated to return 'approve-once' — this meant trackEditIfNeeded would never be called for interactive approvals. Updated to 'approve-once'.
  2. All 11 test assertions in permissionHelpers.spec.ts still expected 'approved' — updated them all to 'approve-once'.

All 45 tests now pass locally.

@DonJayamanne

Copy link
Copy Markdown
Contributor Author

Copilot fix the test failures in
See here for errors https://github.com/microsoft/vscode/actions/runs/25138986771/job/73687324187?pr=313364

Error: TypeError: sdkSession.setPermissionsRequired is not a function
 ❯ CopilotCLISessionService.createCopilotSession src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts:1238:14
 ❯ CopilotCLISessionService.createSession src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts:785:25
 ❯ CopilotCLIChatSessionParticipant.getOrCreateSession src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts:1887:4
 ❯ CopilotCLIChatSessionParticipant.handleRequestImpl src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts:1488:26
 ❯ CopilotCLIChatSessionParticipant.handleRequest src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts:1344:11
Error: TypeError: sdkSession.setPermissionsRequired is not a function
❯ CopilotCLISessionService.createCopilotSession src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts:1238:14
❯ CopilotCLISessionService.createSession src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts:785:25
❯ CopilotCLIChatSessionParticipant.handleDelegationFromAnotherChat src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts:2048:19
❯ CopilotCLIChatSessionParticipant.handleRequestImpl src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts:1452:12
❯ CopilotCLIChatSessionParticipant.handleRequest src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts:1344:11
❯ src/extension/chatSessions/vscode-node/test/copilotCLIChatSessionParticipant.spec.ts:1930:4

Copilot AI commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Copilot fix the test failures in
See here for errors https://github.com/microsoft/vscode/actions/runs/25138986771/job/73687324187?pr=313364

...

Fixed in 561b070. The new SDK version added setPermissionsRequired(required: boolean): void to the Session interface, which is called in createCopilotSession. MockCliSdkSession in testHelpers.ts didn't implement it — added a no-op stub to satisfy the interface.

@DonJayamanne
Don Jayamanne (DonJayamanne) merged commit 3b2b5e0 into main Apr 30, 2026
40 of 41 checks passed
@DonJayamanne
Don Jayamanne (DonJayamanne) deleted the don/drab-goose branch April 30, 2026 02:07
@vs-code-engineering vs-code-engineering Bot added this to the 1.119.0 milestone Apr 30, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Jun 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants