Fix connect mode with Jupyter Server vanilla (no collaboration packages)#96
Open
andrii-i wants to merge 28 commits into
Open
Fix connect mode with Jupyter Server vanilla (no collaboration packages)#96andrii-i wants to merge 28 commits into
andrii-i wants to merge 28 commits into
Conversation
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.
Fixes #93
Problem
Connect mode requires Y.js infrastructure (FileID API, collaboration room WebSocket) for every remote operation and fails against vanilla
jupyter_serverwith no collaboration packages installed (as seen in CI failures in #91). Vanilla jupyter_server provides everything needed: the kernel WebSocket already delivers all execution outputs (the remote executor currently discards them), and the Contents API reads and writes notebooks.Changes
nb connectprobesPOST /api/fileid/index, storesydoc_availablein.jupyter/cli.json, printsMode: directorMode: collaborative.GET /api/fileid/idcannot be used as the probe: it 404s for unindexed paths even when the extension is installed, so fresh servers would always probe as vanilla.POST /api/fileid/indexis registered by jupyter-server-documents only (verified against all three server types). Ad-hoc--server/--tokenprobes per command,--skip-validationskips the probe.execute_code_kernel_ws()inremote/mod.rscollects outputs from kernel WS messages (stream, execute_result, display_data, error, clear_output), same set as the local executor. Coalesces consecutive same-name streams and defersclear_output(wait=True)until the next output, matching nbclient. Every recv is bounded by the per-cell deadline.websocket.rsnegotiates thev1.kernel.websocket.jupyter.orgsubprotocol and fails fast if not accepted, since the client only speaks v1 binary framing.executesaves the notebook with outputs viaPUT /api/contents/{path}when no Y.js backend is present. The notebook is read from the server first, so the write-back is a consistent read-modify-save.cell add/update/deleteandoutput clearshare awith_contents_api()read-modify-save helper incommon.rs. Results print only after the save succeeds.tokio::select!in the Y.js output loop gained a deadline arm; previously a missedStatus(Idle)blocked forever. Same defect Fix execute hang in remote mode #89 fixes, deduplicate on rebase.jupyter-collaboration#95.Testing
End-to-end against real servers in clean venvs.
nb connectmode detectedexecute, error capture, stream coalescing--server/--token,--skip-validationjupyter-server-documents must be tested with a fresh
JUPYTER_DATA_DIR: the fileid database is user-global and a stale probe record masks detection bugs.Merge order
No hard ordering, second to merge rebases:
jupyter-collaboration#95, extend the probe to treatPUT /api/collaboration/session/{path}success as Y.js-capable so jupyter-collaboration routes to the realtime path