MCPcopy Create free account
hub / github.com/github/copilot-sdk / _handle_exit_plan_mode_request

Method _handle_exit_plan_mode_request

python/copilot/session.py:2539–2566  ·  view source on GitHub ↗

Handle an exitPlanMode.request callback from the runtime.

(self, request: dict)

Source from the content-addressed store, hash-verified

2537 raise
2538
2539 async def _handle_exit_plan_mode_request(self, request: dict) -> ExitPlanModeResult:
2540 """Handle an exitPlanMode.request callback from the runtime."""
2541 with self._exit_plan_mode_handler_lock:
2542 handler = self._exit_plan_mode_handler
2543
2544 if not handler:
2545 return {"approved": True}
2546
2547 handler_start = time.perf_counter()
2548 typed_request = ExitPlanModeRequest(
2549 summary=request.get("summary", ""),
2550 actions=request.get("actions") or [],
2551 recommendedAction=request.get("recommendedAction", "autopilot"),
2552 )
2553 if request.get("planContent") is not None:
2554 typed_request["planContent"] = request["planContent"]
2555
2556 result = handler(typed_request, {"session_id": self.session_id})
2557 if inspect.isawaitable(result):
2558 result = await result
2559 log_timing(
2560 logger,
2561 logging.DEBUG,
2562 "CopilotSession._handle_exit_plan_mode_request dispatch",
2563 handler_start,
2564 session_id=self.session_id,
2565 )
2566 return cast(ExitPlanModeResult, result)
2567
2568 async def _handle_auto_mode_switch_request(self, request: dict) -> AutoModeSwitchResponse:
2569 """Handle an autoModeSwitch.request callback from the runtime."""

Callers

nothing calls this directly

Calls 4

handlerFunction · 0.85
log_timingFunction · 0.85
ExitPlanModeRequestClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected