From 4b55ad731886b544e45fb4b602e2f1e9292068d7 Mon Sep 17 00:00:00 2001 From: haosenwang1018 Date: Tue, 24 Feb 2026 04:25:21 +0800 Subject: [PATCH] fix(python): add timeout parameter to FleetApi.start() fleet.start is a long-running blocking RPC that only responds once the fleet completes and the session goes idle. It inherits the default 30s timeout from JsonRpcClient.request(), making it unusable for any non-trivial workload (#539). Add an explicit timeout parameter (default 600s) and pass it through to the underlying request() call. Fixes #539 --- python/copilot/generated/rpc.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/python/copilot/generated/rpc.py b/python/copilot/generated/rpc.py index 3b87bea5..ebb6ac7e 100644 --- a/python/copilot/generated/rpc.py +++ b/python/copilot/generated/rpc.py @@ -1015,10 +1015,23 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def start(self, params: SessionFleetStartParams) -> SessionFleetStartResult: + async def start( + self, params: SessionFleetStartParams, *, timeout: float = 600.0 + ) -> SessionFleetStartResult: + """Start a fleet. + + Args: + params: Fleet start parameters. + timeout: Request timeout in seconds. Defaults to 600s (10 min) + because fleet.start blocks until the fleet completes and + the session goes idle, which routinely exceeds the default + 30s JSON-RPC timeout. + """ params_dict = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return SessionFleetStartResult.from_dict(await self._client.request("session.fleet.start", params_dict)) + return SessionFleetStartResult.from_dict( + await self._client.request("session.fleet.start", params_dict, timeout=timeout) + ) class SessionRpc: