mirror of
https://github.com/zed-industries/zed.git
synced 2026-12-02 21:40:41 +01:00
ed8dc1b6ca
## Summary Fix TCP-based debug adapters timing out in dev containers. The adapter runs inside the container, but Zed connects to a host loopback port whose forwarding request Docker exec silently ignores. Add a TCP-to-stdio helper to the existing remote server so the TCP connection is established inside the container and DAP traffic travels over Docker exec stdio. Keep adapter logs off the DAP stream, flush messages promptly, and terminate spawned adapters when the client disconnects. Child and descendant sessions open new proxy connections to the existing adapter instead of starting it again. Existing local, SSH, WSL, and native stdio paths remain in place. Closes #57021 ## Testing - `ITERATIONS=20 cargo test --locked --offline -p remote -p dap --lib`: 62 remote tests and 7 DAP tests passed, including child/descendant connection reuse and existing SSH/WSL/Docker tests. - Seven TCP helper tests passed on Linux using the exact repository module and the real `util` crate, covering bidirectional forwarding, flushing, adapter launch/log separation, timeout, early exit, and cleanup after client disconnect. - `./script/clippy -p remote -p dap` passed with all targets/features and warnings denied. - `cargo check --locked --offline -p project -p remote_server -p gpui_platform --features gpui_platform/runtime_shaders` passed. The normal macOS shader build requires the Metal Toolchain, which is unavailable on this machine; the supported runtime-shaders feature was used for the check. - rustfmt checks and `git diff --check` passed. Manual transport-level verification used Python 3.14 and debugpy 1.8.20 in a Debian-based Docker container without published ports. The previous host-loopback connection was refused. With the Rust helper, initialize, launch, breakpoint verification/hit, stackTrace, evaluate (`value == 41`), continue, exit code 0, and disconnect passed. Connecting to a separately started adapter without spawning another process also passed. To verify in Zed, open a Python dev container with debugpy installed and no published DAP port, start a `Debugpy` launch configuration for the current file, set a breakpoint, inspect a variable, continue, and stop. The user subsequently built and launched the patched Zed locally and confirmed that the debugger works in the dev container through the Zed GUI. Real JavaScript/SSH/WSL sessions have not been exercised; those paths were checked through tests and compilation. ## Self-review - [x] Reviewed the diff for quality, security, reliability, and performance. - [x] Tests cover the new or changed behavior. - No UI layout changes. ## Suggested .rules additions For the debugger crate's rules: "When adding a remote DAP transport, preserve child-connection semantics: child and descendant sessions reconnect to the parent adapter server without starting another adapter process." Release Notes: - Fixed Python debugging with Debugpy in dev containers. --------- Co-authored-by: Kirill Bulatov <mail4score@gmail.com>