Skip to content

WSL sandbox: first-run helper download (~100MB) runs inside the 60s preparation timeout; slow connections get misleading "WSL did not respond" error #62650

Description

@mipaaa

Reproduction steps

  1. Windows 11 (10.0.26200) + WSL2, default distro Ubuntu-24.04 with bubblewrap
    installed and functional (the exact probe/smoke-test commands from
    crates/sandbox/src/windows_wsl.rs run in ~100ms when invoked manually).
  2. Use a slow internet connection (mobile tether — the helper tarball takes
    well over 60 seconds).
  3. Trigger the first sandboxed agent terminal command after installing or
    updating Zed (any project, any command — e.g. uname -a).

Current vs. Expected behavior

Current: every sandboxed terminal command fails after exactly 60s:

WARN [agent::tools::terminal_tool] Failed to create a WSL sandbox for an
agent terminal command: WSL did not respond within 60 seconds while
preparing the sandboxed command

The message blames WSL responsiveness, but WSL is healthy: wsl.exe -e echo ok,
login shells (sh -lc/bash -lc), the bwrap smoke test with the full namespace
flag set, wslpath translation, and \wsl.localhost access all complete in
~80-100ms when run manually.

Root cause (from source, v1.15.0): wrap_invocationensure_wsl_zed_helper
(crates/sandbox/src/windows_wsl.rs) runs HELPER_PROVISION_SCRIPT, which
downloads the Linux zed helper tarball from cloud.zed.dev via curl/wget
INSIDE the 60s WSL_SANDBOX_WRAP_TIMEOUT that also bounds the probe and path
resolution. On slow connections the download cannot finish; the timeout kills
wsl.exe mid-download. Repeated attempts leave orphaned temp dirs (the EXIT
trap never runs), each holding a partial tarball:

$ ls -d /tmp/zed-wsl-helper-*
/tmp/zed-wsl-helper-3GiCfD  /tmp/zed-wsl-helper-obM1sY  /tmp/zed-wsl-helper-uvKwii

After manually pre-provisioning the helper (~/.local/libexec/zed/stable plus
the .zed-wsl-helper-version marker), the timeout disappeared — the download
was the only thing exceeding the budget.

Expected: helper provisioning should not share the per-command 60s budget —
run it as a background/first-class step with progress and resume support, or
at minimum the timeout error should state that the helper download was still
in progress rather than "WSL did not respond".

Related (same first-run path): once downloaded, the helper needs
libasound.so.2 and likely other libs that minimal WSL distros lack:

/home/<user>/.local/libexec/zed/stable/libexec/zed-editor: error while
loading shared libraries: libasound.so.2: cannot open shared object file

That at least fails fast with a clear message, but the sandbox stays dead
until the user installs undocumented runtime deps (sudo apt install
libasound2t64 here). Documenting or detecting them would help.

Workaround: manually download and install the helper + marker file, then
install missing libs (ldd ... | grep "not found").

Zed version and system specs

Zed: v1.15.0+stable.339.e17dc4f9d50db73a458b64dcce50ecd4878b98a3
OS: Windows 10.0.26200
WSL: Ubuntu-24.04, kernel 6.6.87.2-microsoft-standard-WSL2
Internet: slow mobile connection (the trigger)

Attach Zed log file

Zed.log
2026-08-14T21:12:27+03:00 WARN  [agent::tools::terminal_tool] Failed to create a WSL sandbox for an agent terminal command: Windows sandboxing via WSL is unavailable: Bubblewrap (`bwrap`) is not installed in the default WSL distro
2026-08-14T21:30:54+03:00 WARN  [agent::tools::terminal_tool] Failed to create a WSL sandbox for an agent terminal command: Windows sandboxing via WSL is unavailable: Bubblewrap (`bwrap`) is not installed in the default WSL distro
2026-08-14T21:44:09+03:00 WARN  [agent::tools::terminal_tool] Failed to create a WSL sandbox for an agent terminal command: WSL did not respond within 60 seconds while preparing the sandboxed command
2026-08-14T21:45:39+03:00 WARN  [agent::tools::terminal_tool] Failed to create a WSL sandbox for an agent terminal command: WSL did not respond within 60 seconds while preparing the sandboxed command
2026-08-14T21:50:16+03:00 WARN  [agent::tools::terminal_tool] Failed to create a WSL sandbox for an agent terminal command: WSL did not respond within 60 seconds while preparing the sandboxed command
2026-08-14T21:56:08+03:00 WARN  [agent::tools::terminal_tool] Failed to create a WSL sandbox for an agent terminal command: WSL did not respond within 60 seconds while preparing the sandboxed command
2026-08-14T22:09:59+03:00 WARN  [agent::tools::terminal_tool] Failed to create a WSL sandbox for an agent terminal command: WSL did not respond within 60 seconds while preparing the sandboxed command

Relevant Zed settings

settings.json

Relevant Keymap

keymap.json

(for AI issues) Model provider details

No response

If you are using WSL on Windows, what flavor of Linux are you using?

Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:needs triagetriage is not complete: no `area:*` label, or no `severity:*`/`reach:*` for Bugs/Crashes

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions