Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
|
|
||
| except asyncio.CancelledError: | ||
| return | ||
| response = BaseResponse(success=False, error="Request was cancelled") |
There was a problem hiding this comment.
Caught CancelledError re-raises at subsequent await points
High Severity
Catching asyncio.CancelledError at line 249 without calling asyncio.current_task().uncancel() leaves the task's internal cancellation flag set. The asyncio event loop will re-raise CancelledError at the next await point (await asyncio.to_thread(...) on line 272). Since CancelledError is a BaseException (not Exception) in Python 3.10+, the except Exception on line 273 won't catch it. The error propagates uncaught and the response is never sent — the exact problem this PR aims to fix.


Description
process_requesttask was cancelled (e.g. client disconnect, task cancellation), the server returned without sending any ZMQ response — leaving the client hanging until the 10-hour default timeout. Now sends an error response so the client slot is freed immediately.msgpack.packb(response.model_dump())throws (e.g. on a malformed or huge response), the exception was unhandled andsocket.send_multipartwas never reached — again leaving the client hanging. Now catches serialization errors and sends a plain error response.Type of Change
Testing
uv run pytestlocally.Checklist
Additional Notes
Note
Medium Risk
Changes error-handling in the ZMQ request/response path to avoid dropping replies; a mistake could alter client-visible behavior or mask underlying failures, but scope is limited to response generation.
Overview
Prevents ZMQ clients from hanging when a
process_requesttask is cancelled by returning aBaseResponseerror instead of silently exiting.Hardens response sending by catching exceptions during msgpack serialization and emitting a fallback error payload, ensuring
send_multipartstill runs and the client receives a failure response.Written by Cursor Bugbot for commit d26f327. This will update automatically on new commits. Configure here.