Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix Copilot CLI mission control remote flows#312240

Open
pierceboggan wants to merge 7 commits intomainfrom
pierceboggan/mission-control-id
Open

Fix Copilot CLI mission control remote flows#312240
pierceboggan wants to merge 7 commits intomainfrom
pierceboggan/mission-control-id

Conversation

@pierceboggan
Copy link
Copy Markdown
Contributor

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/sessions traffic is routed through MissionControlApiClient, but the broader Copilot CLI integration plumbing is unchanged.
  • The session.start payload still uses producer: 'copilot-developer-cli'.
  • The Mission Control Copilot-Integration-Id header is still copilot-developer-cli for now because we temporarily reverted that part to keep testing unblocked.
  • The new tests cover the Mission Control client header, the AutoModeSessionManager fallback, remote-vs-local permission resolution, and forwarding session.idle to clear remote running state.

How to test:

  • Open a Copilot CLI chat session and verify it no longer fails with AutoModeSessionManager is not a constructor.
  • Enable /remote, trigger a permission-gated tool call, and confirm the request can be approved from either VS Code or github.com.
  • Run a command remotely and verify the github.com session no longer leaves the gray "Running ..." status behind after the tool finishes.

Copilot AI review requested due to automatic review settings April 23, 2026 21:59
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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 MissionControlApiClient usage in the Copilot CLI remote flow and adds a focused unit test verifying the Mission Control integration header and endpoint routing.
  • Adds an AutoModeSessionManager compatibility 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.idle so 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

Comment on lines 1071 to 1075
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;
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +557 to +560
return handleMcpPermission(
permissionRequest, toolParentCallId,
this._toolsService, toolInvocationToken, this.logService, permissionToken,
);
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

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) {

Copilot uses AI. Check for mistakes.
roblourens
roblourens previously approved these changes Apr 23, 2026
roblourens
roblourens previously approved these changes Apr 23, 2026
import { IFetcherService } from '../../../../platform/networking/common/fetcherService';

/** Integration id for requests originating from the Copilot CLI /remote feature. */
const INTEGRATION_ID = 'copilot-developer-cli';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

let's revert this change to use the constant.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants