mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-11 04:00:38 +00:00
fix(code-runtime-python): bind RuntimeError inside the module-level _pump_replies
The previous commit bound _RuntimeError in _run, but _pump_replies is a separate module-level function, so its except _RuntimeError referenced an out-of-scope local and raised NameError instead of catching the closed-loop failure — killing the pump and timing out the run. Bind _RuntimeError at the top of _pump_replies too. The closed-loop pump test now passes.
This commit is contained in:
@@ -1122,6 +1122,12 @@ async def _pump_replies(
|
||||
pending: dict[int, tuple[asyncio.AbstractEventLoop, asyncio.Future[Any]]],
|
||||
pending_lock: "threading.Lock",
|
||||
) -> None:
|
||||
# The exception class the closed-loop catch below resolves is bound into a
|
||||
# LOCAL here. This bootstrap IS `__main__`, so `__main__.RuntimeError = ...`
|
||||
# would otherwise rebind the module global the `except RuntimeError` clause
|
||||
# resolves at runtime, and a closed-loop scheduling failure would then escape
|
||||
# the catch, killing the pump and stranding every later reply.
|
||||
_RuntimeError = RuntimeError
|
||||
"""Background task: read reply frames and settle pending futures.
|
||||
|
||||
Cancelled after ``done`` is posted. Unknown ids and post-settlement replies
|
||||
|
||||
Reference in New Issue
Block a user