Skip to content

Release lock for interruptable client requests#237

Open
mishushakov wants to merge 14 commits intomainfrom
fix-interrupt
Open

Release lock for interruptable client requests#237
mishushakov wants to merge 14 commits intomainfrom
fix-interrupt

Conversation

@mishushakov
Copy link
Copy Markdown
Member

@mishushakov mishushakov commented Mar 24, 2026

fixes #213

@cursor
Copy link
Copy Markdown

cursor bot commented Mar 24, 2026

PR Summary

Medium Risk
Changes execution streaming behavior and adds server-side kernel interruption via Jupyter REST API on disconnect; mistakes could interrupt valid runs or add extra traffic, but scope is contained to messaging/streaming.

Overview
Client disconnects now actively stop kernel execution. During streaming, the server periodically emits keepalive messages and, if the request task is cancelled (disconnect), calls the Jupyter POST /api/kernels/{id}/interrupt endpoint (via httpx) to interrupt the current kernel run and free the context for later executions.

Adds regression tests in JS and Python (sync/async) that simulate a timed-out client run followed by a successful subsequent execution, plus a changeset bump for @e2b/code-interpreter-template.

Written by Cursor Bugbot for commit 9fc79d7. This will update automatically on new commits. Configure here.

@mishushakov mishushakov enabled auto-merge (squash) March 24, 2026 19:11
@mishushakov mishushakov disabled auto-merge March 25, 2026 09:02
Copy link
Copy Markdown
Member

@jakubno jakubno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a correct fix. The executions in jupyter are in serial. What you would need to do here is to interrupt the execution on client disconnect

@jakubno jakubno self-assigned this Mar 25, 2026
@ValentaTomas ValentaTomas removed their request for review March 25, 2026 16:27
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@mishushakov mishushakov requested a review from jakubno March 25, 2026 21:33
@mishushakov mishushakov requested a review from jakubno March 27, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

asyncio.Lock in messaging.py not released on client disconnect → cascading timeouts

2 participants