MCPcopy Index your code
hub / github.com/github/copilot-sdk / delete_session

Method delete_session

python/copilot/client.py:3045–3076  ·  view source on GitHub ↗

Permanently delete a session and all its data from disk, including conversation history, planning state, and artifacts. Unlike :meth:`CopilotSession.disconnect`, which only releases in-memory resources and preserves session data for later resumption, this method

(self, session_id: str)

Source from the content-addressed store, hash-verified

3043 return SessionMetadata.from_dict(session_data)
3044
3045 async def delete_session(self, session_id: str) -> None:
3046 """
3047 Permanently delete a session and all its data from disk, including
3048 conversation history, planning state, and artifacts.
3049
3050 Unlike :meth:`CopilotSession.disconnect`, which only releases in-memory
3051 resources and preserves session data for later resumption, this method
3052 is irreversible. The session cannot be resumed after deletion.
3053
3054 Args:
3055 session_id: The ID of the session to delete.
3056
3057 Raises:
3058 RuntimeError: If the client is not connected or deletion fails.
3059
3060 Example:
3061 >>> await client.delete_session("session-123")
3062 """
3063 if not self._client:
3064 raise RuntimeError("Client not connected")
3065
3066 response = await self._client.request("session.delete", {"sessionId": session_id})
3067
3068 success = response.get("success", False)
3069 if not success:
3070 error = response.get("error", "Unknown error")
3071 raise RuntimeError(f"Failed to delete session {session_id}: {error}")
3072
3073 # Remove from local sessions map if present
3074 with self._sessions_lock:
3075 if session_id in self._sessions:
3076 del self._sessions[session_id]
3077
3078 async def get_last_session_id(self) -> str | None:
3079 """

Calls 2

requestMethod · 0.45
getMethod · 0.45