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

Method _fail_pending_requests

python/copilot/_jsonrpc.py:283–304  ·  view source on GitHub ↗

Fail all pending requests when process exits

(self)

Source from the content-addressed store, hash-verified

281 self.on_close()
282
283 def _fail_pending_requests(self):
284 """Fail all pending requests when process exits"""
285 # Build error message with stderr output
286 stderr_output = self.get_stderr_output()
287 return_code = None
288 if hasattr(self.process, "poll"):
289 return_code = self.process.poll()
290
291 if stderr_output:
292 error_msg = f"CLI process exited with code {return_code}\nstderr: {stderr_output}"
293 elif return_code is not None:
294 error_msg = f"CLI process exited with code {return_code}"
295 else:
296 error_msg = "CLI process exited unexpectedly"
297
298 # Fail all pending requests
299 with self._pending_lock:
300 for request_id, future in list(self.pending_requests.items()):
301 if not future.done():
302 exc = ProcessExitedError(error_msg)
303 loop = future.get_loop()
304 loop.call_soon_threadsafe(future.set_exception, exc)
305
306 def _read_exact(self, num_bytes: int) -> bytes:
307 """

Callers 1

_read_loopMethod · 0.95

Calls 3

get_stderr_outputMethod · 0.95
ProcessExitedErrorClass · 0.85
pollMethod · 0.80

Tested by

no test coverage detected