Replace the current port-reservation-based kernel launch (which has a TOCTOU race around port reuse — the original #1772 issue) with IPC transport (Unix domain sockets / named pipes) for the kernel's Jupyter control/shell/iopub/stdin/heartbeat channels.
Why now
- The TCP port-retry dance is fragile: we pick a port, kernel may bind late, port collisions cause silent failures or require restart.
- IPC sockets have no port namespace collision surface.
- jupyter_client supports IPC transport (
transport: "ipc") — kernel-side wiring is minimal.
- Aligns with
runtimed-agent architecture (already Unix-socket based).
Work
- Design spec: what exactly do we change in
kernel-launch, JupyterKernel, and the connection-info JSON written to disk? Where do the 5 IPC socket files live (daemon base dir? worktree-scoped?)?
- Implementation in
crates/kernel-launch + crates/runtimed/src/jupyter_kernel.rs.
- Per-kernel cleanup: socket files need to be removed on kernel shutdown AND orphan-reaped by
process_groups if the kernel crashes.
- Windows story: jupyter_client's IPC support uses named pipes — verify it works or keep TCP for Windows.
Scope gate
Prerequisite: confirm ipykernel honors transport: ipc on all supported Python versions. If there's any gap, falls back to TCP there.
Related
Replace the current port-reservation-based kernel launch (which has a TOCTOU race around port reuse — the original #1772 issue) with IPC transport (Unix domain sockets / named pipes) for the kernel's Jupyter control/shell/iopub/stdin/heartbeat channels.
Why now
transport: "ipc") — kernel-side wiring is minimal.runtimed-agentarchitecture (already Unix-socket based).Work
kernel-launch,JupyterKernel, and the connection-info JSON written to disk? Where do the 5 IPC socket files live (daemon base dir? worktree-scoped?)?crates/kernel-launch+crates/runtimed/src/jupyter_kernel.rs.process_groupsif the kernel crashes.Scope gate
Prerequisite: confirm ipykernel honors
transport: ipcon all supported Python versions. If there's any gap, falls back to TCP there.Related