Skip to content

Clear dead kernel client after execution failure - #41

Open
PiotrCzapla wants to merge 1 commit into
mainfrom
pc/clear-dead-kernel-client
Open

Clear dead kernel client after execution failure#41
PiotrCzapla wants to merge 1 commit into
mainfrom
pc/clear-dead-kernel-client

Conversation

@PiotrCzapla

@PiotrCzapla PiotrCzapla commented Aug 14, 2026

Copy link
Copy Markdown

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 MCP execute can 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_outs returned a death note but left Client.kc set. 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 90
  • nbdev-test --path nbs/01_mcp.ipynb --n_workers 1 --cell_timeout 90
  • nbdev-export
  • git diff --check

@PiotrCzapla
PiotrCzapla marked this pull request as ready for review August 14, 2026 12:15
@PiotrCzapla
PiotrCzapla requested a review from jph00 August 14, 2026 12:17
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.

1 participant