Fix Copilot CLI mission control remote flows#312240
Fix Copilot CLI mission control remote flows#312240pierceboggan wants to merge 7 commits intomainfrom
Conversation
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR fixes remaining Copilot CLI /remote (Mission Control) regressions by isolating Mission Control traffic behind a dedicated API client, adding an SDK auto-mode compatibility fallback, and ensuring remote permission/idle states propagate correctly.
Changes:
- Introduces
MissionControlApiClientusage in the Copilot CLI remote flow and adds a focused unit test verifying the Mission Control integration header and endpoint routing. - Adds an
AutoModeSessionManagercompatibility fallback for SDK versions where the export isn’t constructable, with a covering test. - Updates remote-session behavior to (a) accept permission approvals from either local VS Code prompts or Mission Control commands and (b) forward
session.idleso remote “Running…” UI clears; includes new tests.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/chatSessions/copilotcli/node/test/testHelpers.ts | Extends mock session manager to retain constructor options for new auto-mode fallback tests. |
| extensions/copilot/src/extension/chatSessions/copilotcli/node/test/missionControlApiClient.spec.ts | Adds coverage for Mission Control request routing + Copilot-Integration-Id header. |
| extensions/copilot/src/extension/chatSessions/copilotcli/node/test/copilotcliSession.spec.ts | Adds tests for remote-vs-local permission resolution and forwarding session.idle. |
| extensions/copilot/src/extension/chatSessions/copilotcli/node/test/copilotCliSessionService.spec.ts | Tests SDK auto-mode manager constructability fallback path. |
| extensions/copilot/src/extension/chatSessions/copilotcli/node/missionControlApiClient.ts | Aligns the API client with DI via parameter decorators and clarifies integration ID intent. |
| extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts | Adds AutoModeSessionManagerCompat and uses it when SDK manager isn’t constructable. |
| extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts | Routes Mission Control calls via the API client; adds remote permission response handling and forwards session.idle. |
Copilot's findings
- Files reviewed: 7/7 changed files
- Comments generated: 2
| headers: { 'Authorization': `token ${githubToken}`, 'Accept': 'application/json' }, | ||
| }); | ||
| if (!repoResponse.ok) { | ||
| this._stream?.markdown(l10n.t('Unable to enable remote control: could not resolve repository {0}/{1}.', nwo.owner, nwo.repo)); | ||
| return; |
There was a problem hiding this comment.
MissionControlApiClient.createSession supports authOptions.createIfNone for an interactive permissive-auth upgrade, but /remote currently calls it with {} and only renders a markdown error on PermissiveAuthRequiredError. Since /remote is explicitly user-initiated, consider passing a createIfNone detail (localized) so the permission-upgrade prompt can be shown inline when needed.
| return handleMcpPermission( | ||
| permissionRequest, toolParentCallId, | ||
| this._toolsService, toolInvocationToken, this.logService, permissionToken, | ||
| ); |
There was a problem hiding this comment.
The permission-level auto-approve case is handled twice: there’s an early return above (lines 511-516), and then it’s checked again inside the try (lines 557-560). The second check is redundant/unreachable and makes the control flow harder to follow; it should be removed so the remaining branches are just “Mission Control active” vs “local prompt”.
See below for a potential fix:
if (this._mcState) {
Co-authored-by: Copilot <[email protected]>
| import { IFetcherService } from '../../../../platform/networking/common/fetcherService'; | ||
|
|
||
| /** Integration id for requests originating from the Copilot CLI /remote feature. */ | ||
| const INTEGRATION_ID = 'copilot-developer-cli'; |
There was a problem hiding this comment.
let's revert this change to use the constant.
Co-authored-by: Copilot <[email protected]>
This fixes the remaining Mission Control issues in the Copilot CLI remote flow so remote sessions behave correctly end to end without changing the broader Copilot CLI integration behavior.
The change keeps Mission Control scoped to its dedicated client, adds an SDK compatibility fallback for
AutoModeSessionManager, and fixes the two remote session regressions we hit while testing: permission prompts can now be approved from either VS Code or github.com, and the remote UI now clears stale "Running ..." status when a turn goes idle.A few non-obvious details are worth calling out:
/agents/sessionstraffic is routed throughMissionControlApiClient, but the broader Copilot CLI integration plumbing is unchanged.session.startpayload still usesproducer: 'copilot-developer-cli'.Copilot-Integration-Idheader is stillcopilot-developer-clifor now because we temporarily reverted that part to keep testing unblocked.AutoModeSessionManagerfallback, remote-vs-local permission resolution, and forwardingsession.idleto clear remote running state.How to test:
AutoModeSessionManager is not a constructor./remote, trigger a permission-gated tool call, and confirm the request can be approved from either VS Code or github.com.