Handle websocket error gracefully + add retry logic#149
Merged
mishushakov merged 24 commits intomainfrom Oct 7, 2025
Merged
Conversation
jakubno
commented
Sep 22, 2025
jakubno
commented
Sep 22, 2025
jakubno
commented
Sep 22, 2025
jakubno
commented
Sep 22, 2025
87a0b15 to
1950089
Compare
mishushakov
reviewed
Sep 23, 2025
mishushakov
reviewed
Sep 23, 2025
mishushakov
reviewed
Sep 25, 2025
mishushakov
reviewed
Sep 25, 2025
mishushakov
reviewed
Sep 25, 2025
jakubno
commented
Sep 26, 2025
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Bug: Reconnect Hangs on Blocked Receive Task
The reconnect method awaits self._receive_task without cancelling it first. If the receive task is blocked waiting for WebSocket messages, this can cause the reconnect process to hang indefinitely, unlike the close() method's approach.
template/server/messaging.py#L70-L78
code-interpreter/template/server/messaging.py
Lines 70 to 78 in 8818ce7
mishushakov
reviewed
Oct 7, 2025
mishushakov
approved these changes
Oct 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handle connection error between the server and kernel gracefully
Add reconnect logic
Note
Adds WebSocket reconnect with retries and ping timeout, conditionally sets auth header in Python clients, and surfaces connection-loss errors to prevent hangs.
template/server/messaging.py):reconnect()withMAX_RECONNECT_RETRIESandPING_TIMEOUT; wrap send in retry loop catchingConnectionClosedError/WebSocketExceptionand reconnecting.ErrorandUnexpectedEndOfExecutionfor ongoing executions to avoid hangs.message_idandExecutionright before send; serialize request with_get_execute_request.python/e2b_code_interpreter/*):headerswithX-Access-Tokenonly if token present for both async and syncrun_codeandcreate_code_context.@e2b/code-interpreter-template(add retry) and@e2b/code-interpreter-python(fix header issue).Written by Cursor Bugbot for commit e51313b. This will update automatically on new commits. Configure here.