Skip to content

Commit e60754a

Browse files
committed
Merge branch 'main' of https://github.com/github/copilot-sdk into options-private
2 parents a5a70a2 + 21a586d commit e60754a

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

go/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ go run chat.go
2525
package main
2626

2727
import (
28+
"context"
2829
"fmt"
2930
"log"
3031

@@ -274,6 +275,7 @@ Enable streaming to receive assistant response chunks as they're generated:
274275
package main
275276

276277
import (
278+
"context"
277279
"fmt"
278280
"log"
279281

python/copilot/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,7 @@ async def _execute_tool_call(
15891589
toolTelemetry={},
15901590
)
15911591

1592-
return self._normalize_tool_result(result)
1592+
return self._normalize_tool_result(cast(ToolResult, result))
15931593

15941594
def _normalize_tool_result(self, result: ToolResult) -> ToolResult:
15951595
"""

python/copilot/jsonrpc.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,23 @@ async def stop(self):
104104
self._stderr_thread.join(timeout=1.0)
105105

106106
async def request(
107-
self, method: str, params: Optional[dict] = None, timeout: float = 30.0
107+
self, method: str, params: Optional[dict] = None, timeout: Optional[float] = None
108108
) -> Any:
109109
"""
110110
Send a JSON-RPC request and wait for response
111111
112112
Args:
113113
method: Method name
114114
params: Optional parameters
115-
timeout: Request timeout in seconds (default 30s)
115+
timeout: Optional request timeout in seconds. If None (default),
116+
waits indefinitely for the server to respond.
116117
117118
Returns:
118119
The result from the response
119120
120121
Raises:
121122
JsonRpcError: If server returns an error
122-
asyncio.TimeoutError: If request times out
123+
asyncio.TimeoutError: If request times out (only when timeout is set)
123124
"""
124125
request_id = str(uuid.uuid4())
125126

@@ -141,7 +142,9 @@ async def request(
141142
await self._send_message(message)
142143

143144
try:
144-
return await asyncio.wait_for(future, timeout=timeout)
145+
if timeout is not None:
146+
return await asyncio.wait_for(future, timeout=timeout)
147+
return await future
145148
finally:
146149
with self._pending_lock:
147150
self.pending_requests.pop(request_id, None)

python/copilot/session.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import asyncio
99
import inspect
1010
import threading
11-
from typing import Any, Callable, Optional
11+
from typing import Any, Callable, Optional, cast
1212

1313
from .generated.rpc import SessionRpc
1414
from .generated.session_events import SessionEvent, SessionEventType, session_event_from_dict
@@ -336,7 +336,7 @@ async def _handle_permission_request(
336336
result = handler(request, {"session_id": self.session_id})
337337
if inspect.isawaitable(result):
338338
result = await result
339-
return result
339+
return cast(PermissionRequestResult, result)
340340
except Exception: # pylint: disable=broad-except
341341
# Handler failed, deny permission
342342
return {"kind": "denied-no-approval-rule-and-could-not-request-from-user"}
@@ -388,7 +388,7 @@ async def _handle_user_input_request(self, request: dict) -> UserInputResponse:
388388
)
389389
if inspect.isawaitable(result):
390390
result = await result
391-
return result
391+
return cast(UserInputResponse, result)
392392
except Exception:
393393
raise
394394

0 commit comments

Comments
 (0)