Clear dead kernel client after execution failure - #41
Open
PiotrCzapla wants to merge 1 commit into
Open
Conversation
PiotrCzapla
marked this pull request as ready for review
August 14, 2026 12:15
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.
Claude was still trying to use the old connection even when it saw the message. So it hung for 2 minutes and was really confused. It is likely due to the fact that we were investigating rustygate issues before, but still, the idea to close the connection and start a new kernel automatically seems like a good default.
Here is the PR made by codex, intended for your llm, I haven't read it just the code changes and they look fine.
Summary
Close and clear the kernel client after
DeadKernelError. The next MCPexecutecan then create a fresh kernel instead of waiting on a dead WebSocket.The user-facing death message now describes the recovery behavior, and the existing real lifecycle test checks that the stale client pointer is cleared.
Root cause
execute_outsreturned a death note but leftClient.kcset. The MCP frontend checks that pointer to decide whether it should auto-connect. After a kernel or RustyGate restart, the stale object prevented auto-connect and later executions could hang indefinitely.Checks
nbdev-test --path nbs/00_core.ipynb --n_workers 1 --cell_timeout 90nbdev-test --path nbs/01_mcp.ipynb --n_workers 1 --cell_timeout 90nbdev-exportgit diff --check