Skip to content

Expose respondToExitPlanMode in the copilot-sdk package - blocking VS plan mode integration #1053

@nicolasdossantos

Description

@nicolasdossantos

Summary

The copilot-sdk package does not expose respondToExitPlanMode, even though the full SDK (sdk/index.d.ts) has it. VS receives ExitPlanModeRequestedEvent with the available actions but has no way to respond. The CLI auto-proceeds with the recommended action, bypassing the user's choice.

Evidence

Full SDK (@github/copilot/sdk/index.d.ts) — HAS it:

// Line 13896 — method on session class
respondToExitPlanMode(requestId: string, response: ExitPlanModeResponse): void;

// Line 17077 — hook on session base
protected onExitPlanMode?: (request: ExitPlanModeRequest) => Promise<ExitPlanModeResponse>;

// Line 10224 — response type
type ExitPlanModeResponse = {
    approved: boolean;
    selectedAction?: ExitPlanModeAction; // "exit_only" | "interactive" | "autopilot" | "autopilot_fleet"
    autoApproveEdits?: boolean;
    feedback?: string;
};

Thin wrapper (copilot-sdk/session.d.ts) — MISSING:

  • session-events.d.ts line 2943 references it in a comment: "used to respond via session.respondToExitPlanMode()" — but the method does not exist on the CopilotSession class
  • session.d.ts exposes registerPermissionHandler and registerUserInputHandler — no registerExitPlanModeHandler
  • extension.js handles permission.requested and tool.call broadcasts — no handler for exit_plan_mode.requested
  • types.d.ts SessionConfig has onPermissionRequest and onUserInputRequest — no onExitPlanMode

What VS sees:

  • ExitPlanModeRequestedEvent fires correctly with RequestId, Summary, Actions[], RecommendedAction
  • No way to call respondToExitPlanMode(requestId, response)
  • CLI auto-proceeds after timeout, ignoring the user

What we need

Either of:

  1. A method on CopilotSession:
respondToExitPlanMode(requestId: string, response: ExitPlanModeResponse): void;
  1. A callback on SessionConfig:
onExitPlanMode?: (request: ExitPlanModeRequest) => Promise<ExitPlanModeResponse>;

Both patterns already exist for permissions (onPermissionRequest / registerPermissionHandler) and user input (onUserInputRequest / registerUserInputHandler). This would follow the same pattern.

Impact

This blocks VS from offering plan approval with mode selection.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions