-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Description
Summary
Extensions that include support for debugging aren't loaded on remote hosts.
Description
Steps to trigger the problem:
- Install the Zed Ruby extension, which makes use of the new debug extension API
- SSH to a remote host that has ruby installed (use rvm, chruby, asdf, mise, whatever) as well as the debug gem installed (
gem install debug). - Use the following debug configuration:
[
{{
"label": "Debug current file",
"adapter": "rdbg",
"request": "launch",
"script": "$ZED_FILE",
"cwd": "$ZED_WORKTREE_ROOT"
}
]- Attempt to debug any Ruby script, I used:
(1..100).each do |i|
puts i
end
puts "finished"- Zed will fail to launch the debugger with the following:
error: RPC request GetDebugAdapterBinary failed: Failed to find a debug adapter
Expected Behavior:
Extensions with debuggers should work on remote hosts.
Actual Behavior:
Debuggers that are part of extensions aren't registered on the remote host.
Additional Details
I believe that I was able to resolve the issue of extension debuggers not being registered with the remote host with the attached patch file (although I don't seem to get schema autocomplete inside of "debug.json").
However, I was unable to get the debugger to properly connect to even a simple launch request. The command that was being run was done over ssh with some port forwarding, but the debugger seems to connect to the local forwarded port, with rdbg stating that it connects and then immediately disconnects. Here's the relevant logs after trying to debug with the attached patch file applied:
Starting debug adapter with command: "ssh" "-o" "ControlMaster=no" "-o" "ControlPath=/var/folders/_v/d5fbbbmn7lbdxt7rlctlkqkw0000gn/T/zed-ssh-session9KTjzt/ssh.sock" "ssh://ubuntu@orb" "-L" "50142:127.0.0.1:44569" "-t" "sh -c \"cd \\\"/home/ryan/dev/example_rails_project\\\"; <a bunch of env vars omitted for brevity> /home/ryan/.local/share/mise/installs/ruby/3.4.4/bin/bundle exec rdbg --open \'--port=44569\' \'--host=2130706433\' example.rb\""
2025-07-02T23:30:37-06:00 INFO [dap::transport] Debug adapter has connected to TCP server 127.0.0.1:50142
log from the adapter on StdErr: Pseudo-terminal will not be allocated because stdin is not a terminal.
2025-07-02T23:30:37-06:00 INFO [dap::transport] Debugger closed the connection
2025-07-02T23:30:37-06:00 ERROR [dap::transport] Error handling debugger input: Broken pipe (os error 32)
log from the adapter on StdErr: DEBUGGER: Debugger can attach via TCP/IP (127.0.0.1:44569)
log from the adapter on StdErr: DEBUGGER: wait for debugger connection...
I'm able to connect to the forwarded port using rdbg's built-in client, so I'm wondering if Zed is just too fast connecting. If I add in a executor.timer(Duration::from_millis(500)).await; inside the TcpTransport#connect method, then I'm able to debug the script properly. I wonder if there needs to be some more complicated retry logic or checking that a TCP stream is well and truly connected?
Zed Version and System Specs
Zed: v0.194.1 (Zed Preview)
OS: macOS 15.5.0
Memory: 16 GiB
Architecture: aarch64