fix(jupyter): handle shutdown and interrupt requests per protocol#32359
Merged
bartlomieju merged 5 commits intodenoland:mainfrom Mar 2, 2026
Merged
fix(jupyter): handle shutdown and interrupt requests per protocol#32359bartlomieju merged 5 commits intodenoland:mainfrom
bartlomieju merged 5 commits intodenoland:mainfrom
Conversation
The Jupyter kernel was not sending replies for `shutdown_request` and `interrupt_request` messages on the control channel, causing conformance test timeouts. Now the kernel sends proper `shutdown_reply` (with the `restart` field echoed back) before exiting, and `interrupt_reply` after terminating V8 execution via `IsolateHandle::terminate_execution()`. Before each subsequent evaluation, `cancel_terminate_execution()` clears the termination flag so the kernel remains usable after an interrupt. Closes denoland#32357 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Instead of always replying "complete", check whether the code has balanced brackets, braces, parens, and terminated strings/comments. Returns "incomplete" for unterminated constructs and "invalid" for mismatched delimiters. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
rgbkrk
approved these changes
Feb 28, 2026
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.
Summary
shutdown_replyon the control channel before exiting, with therestartfield echoed back from the requestinterrupt_requestby callingv8::IsolateHandle::terminate_execution()to actually interrupt running JS code (e.g. infinite loops), then sendinterrupt_replycancel_terminate_execution()) before each evaluation so the kernel remains usable after an interruptis_complete_requestwith bracket/brace/paren balancing instead of always replying "complete" — also handles unterminated strings, template literals, and commentsis_completelogicVerified against the kernel-testbed conformance suite: 26/26 (100%), up from 92%.
Closes #32357
Test plan
jupyter_shutdown_reply— sends shutdown, verifies reply content and clean process exitjupyter_shutdown_restart_reply— verifiesrestart: trueis echoed backjupyter_interrupt_reply— verifies reply on control channeljupyter_interrupt_running_code— startswhile (true) {}, interrupts it, verifies the kernel can still execute code afterwardcheck_is_completecovering balanced/unbalanced brackets, strings, comments, template literals, and edge cases🤖 Generated with Claude Code