Skip to content

Add Jupyter DAP handler#1171

Open
lionel- wants to merge 16 commits intonotebook/dap-abstractionfrom
notebook/debugger
Open

Add Jupyter DAP handler#1171
lionel- wants to merge 16 commits intonotebook/dap-abstractionfrom
notebook/debugger

Conversation

@lionel-
Copy link
Copy Markdown
Contributor

@lionel- lionel- commented Apr 25, 2026

Branched from #1170
Backend side of posit-dev/positron#13205
Part of posit-dev/positron#12104

Implements notebook debugging via the Jupyter Debug Protocol. DAP messages flow through debug_request/debug_reply on the Control socket, with events forwarded as debug_event on IOPub.

Since notebook cells aren't files on disk, the Jupyter Debug Protocol uses dumpCell to write cell source code to deterministic temp files (path derived from a MurmurHash2 of the code). The frontend sends dumpCell before setBreakpoints, so breakpoints reference these temp files.

When execute requests contain a cellId, breakpoints and line directives are mapped to the temp files written by dumpCell. This allows users to execute and inject breakpoints at the same time, outside of a debugging session. Otherwise they'd need to start a debugging session with Debug Cell, then go back and reexecute cells containing breakpoints.

In addition:

  • Interrupts in notebook mode now quit the debugger with Q if active. This fits the notebook UX because, unlike in Console mode, the kernel remains busy for the duration of the debugging session, and the notebook UI shows an Interrupt button next to the cell. If we don't quit the debugger, the cell will remain in busy state after interrupting, which is confusing.

  • Debugging prompts created via browser() or debug() (as opposed to breakpoints) map to StdIn. Not the best UI in Positron (stdin prompts show via command palette) but much better than doing nothing. The alternative would be to initiate a full debug session from the backend, but this would require non-standard frontend changes.

Screen.Recording.2026-04-25.at.11.11.03.mov

@lionel- lionel- force-pushed the notebook/debugger branch from 6c8f97b to a6974a6 Compare April 25, 2026 14:11
@lionel- lionel- force-pushed the notebook/debugger branch 4 times, most recently from f0215b9 to 0a18932 Compare April 25, 2026 17:14
@lionel- lionel- force-pushed the notebook/debugger branch from f5c7e06 to 0726567 Compare April 25, 2026 20:28
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