Skip to content

[Bug]: A project on \\wsl.localhost added to the Windows backend takes 61 s per turn (8 s on the WSL backend) and git status hits the 30 s timeout; only the folder picker guards against it #37045

Closed

Description

@juliusmarminge

Problem

A project whose path is \\wsl.localhost\<distro>\... can be added to the Windows backend, and then everything that touches the repository is five to seventy times slower than it should be. A replayed turn takes 61 s end to end (8 s for the same repository through the WSL backend, 10.8 s for an NTFS clone). git status averages 23 s and regularly runs into the server's 30 s git timeout, so the branch and Changes summary often never update.

The folder picker already refuses such a path unless a matching WSL backend is running ("Could not add WSL project"). The other ways in do not: a path typed or pasted into the Add project box, and t3 project add.

Steps to reproduce

  1. Windows with WSL2 and a git repository inside the distro, for example a clone of this repository at /home/ubuntu/t3code.
  2. In Windows: git config --global --add safe.directory "*" (Git for Windows refuses the path otherwise, because the owner differs).
  3. Run the app with the Windows backend.
  4. Add the project by typing \\wsl.localhost\Ubuntu\home\ubuntu\t3code into the Add project box, or with t3 project add \\wsl.localhost\Ubuntu\home\ubuntu\t3code.
  5. Start a thread and send a few messages. Watch how long each turn takes to finish and whether the branch and Changes rows update.

Numbers

Windows Server 2025, 4 vCPU (Xeon Platinum 8473C), 16 GB, NTFS, Git for Windows 2.56.1, Node 26.13.1, Defender on with default settings, WSL2 Ubuntu 24.04 (ext4), commit a62bc81, dev server from source with the Replay provider.

The same clean clone of this repository (no node_modules, branch main tracking origin/main) in three places, same script, six turns each. Span durations are from each run's server.trace.ndjson.

Windows backend, \\wsl.localhost path Windows backend, NTFS clone WSL backend, the same ext4 clone
t3 project add 13.8 s 2.8 s 2.4 s
First thread start (one replayed turn) 65.5 s 12.3 s 11.3 s
Replayed turn end to end, median of 6 (min to max) 61.1 s (55.5 to 90.3) 10.8 s (10.1 to 10.9) 8.0 s (7.9 to 8.2)
RunFinalizationService.finalize, median (n=9) 45.4 s (max 73.1) 1.6 s 0.64 s
VcsStatusBroadcaster.refreshLocalStatus, median 32.8 s 1.45 s 0.66 s
ws.rpc.vcs.refreshStatus, median 53.5 s 3.4 s 1.4 s
runGitCommand, median / p95 670 ms / 30,004 ms 59 / 430 ms 22 / 170 ms

Git time by command in the \\wsl.localhost run (386 git processes, 1,360 s of process time in total):

Command Runs Average Longest
status --porcelain=2 --branch 18 23.4 s 30.2 s
diff-index -M --numstat 15 22.0 s 30.2 s
untracked scan (-c core.fsmonitor=false ...) 44 8.5 s 16.5 s
ls-files --others 9 5.2 s 5.2 s
symbolic-ref, config --get, rev-parse many 0.4 to 1.0 s 2.2 s

The 30.2 s maximum is the server's git timeout killing the command.

Plain file access from Windows shows why. Same tree with node_modules installed, Windows Node and Git for Windows, median of 3, on a second machine of the same kind (Xeon Platinum 8370C):

Operation \\wsl.localhost NTFS
Walk the source tree (32,326 files, no node_modules, no .git) 19,967 ms 690 ms
stat 1,000 files 3,372 ms 65 ms
Read 1,000 files 12,098 ms 200 ms
realpath 200 files 6,678 ms 30 ms
git status --porcelain=v2 --branch 6,242 ms (first run 157,638) 276 ms
git diff --numstat 5,775 ms 187 ms
fs.watch(dir, { recursive: true }) fails with EISDIR arms in under 1 ms

git status there also lists files as modified that are clean inside the distro, and git diff prints "Function not implemented" for symlinks.

Where it comes from

\\wsl.localhost is a 9P network share; every file operation is a round trip into the VM. The guard that sends such a path to the WSL backend exists only in the picker flow: CommandPalette.tsx, handleOpenProjectFromFileManager calls parseWslUncPath and resolveWslProjectSelection. The typed-path flow (handleAddProject) passes the path straight to the Windows backend, and neither the CLI nor the server checks it.

Expected

The typed path and t3 project add behave like the folder picker: a \\wsl.localhost\<distro>\... or \\wsl$\<distro>\... path is opened by the matching WSL backend, or refused with the same message when none is running, instead of being opened through the share by the Windows backend.

Related

#36675 is the mirror image: the WSL backend opening a project on a Windows drive through /mnt/c.

Activity

  1. added
    bug
    needs-triage
    on Nov 15, 2026
  2. Exotic209093 commented on Nov 17, 2026

    @Exotic209093
    Contributor

    I looked into this on main at 215bd59 (code only, I didn't reproduce it at runtime).

    The only guard is the folder picker in the web app (apps/web/src/components/CommandPalette.tsx:2827-2895, using parseWslUncPath from apps/web/src/wslPaths.ts:30). It sends a \wsl.localhost\ or \wsl$\ folder to a running WSL backend, or refuses with a toast, and never hands the share path to the Windows backend. Every other way of adding a project reaches ProjectService.create (apps/server/src/project/ProjectService.ts:396) with no WSL check: a typed or pasted path in the palette (CommandPalette.tsx:2046), t3 project add (apps/server/src/cli/project.ts:490), MCP t3_project_create, t3 . and open-with (apps/web/src/desktopAppActivation.ts:82), onboarding, mobile's typed path, and moving a project to a new folder through project.update.

    The smallest fix I can see is a refusal in ProjectService.create (and update when workspaceRoot changes) on Windows hosts for paths matching ^[\/]{2}wsl(\.localhost|\$)[\/], returning ProjectInvalidError before it stats the share, which is why t3 project add took 13.8 s here. That covers every entry point at once and matches what the picker already does. I have it with a test that fails on main and passes with the fix. Existing projects on a share keep working, since the check only runs when the root is set or changed.

    Before opening a PR I'd like a maintainer to confirm blocking rather than warning is wanted, since it takes away the option of adding such a path when no WSL backend is running. Routing typed paths to the WSL backend the way the picker does would be a separate web change.

  3. juliusmarminge commented on Nov 19, 2026

    @juliusmarminge
    MemberAuthor

    New measurement: most of the git status time in this issue is not the share. It is the index.

    Git inside the distro writes real device, inode and owner values into the index. Git for Windows sees zeros for all of them, treats every file as possibly changed, and reads every file through the share. It would normally save the corrected index, but the server runs Git with GIT_OPTIONAL_LOCKS=0, so it never does and every poll repeats the read. This is the mirror image of what #37715 describes for /mnt/c.

    A clean clone of this repository inside the distro (32,396 tracked files, no node_modules), opened from Windows as \\wsl.localhost\Ubuntu\..., Git for Windows 2.56.1, GIT_OPTIONAL_LOCKS=0:

    Index git status --porcelain=2 --branch
    Written by Linux Git 107.9, 79.5, 78.3 s
    Written by Linux Git, with -c core.checkStat=minimal 3.7 s
    After one plain Windows git status rewrote it 3.7, 3.8, 3.8 s

    So about 75 of the 78 s is the repeated read, and the share itself costs about 3.7 s. That also explains why status in the app kept hitting the 30 s limit here while later runs by hand took 6 s: the first run by hand had fixed the index.

    It leaves damage behind too. After Windows rewrote the index, the WSL backend's own status on that checkout (ext4, GIT_OPTIONAL_LOCKS=0) took 3.7 to 3.9 s per poll instead of 97 to 101 ms, and the index file was owned by root.

    Routing or refusing these paths, as this issue asks, is still the right fix: 3.7 s per status and 71 files wrongly listed as modified remain. But if such a project is ever opened this way, core.checkStat=minimal for share paths takes it from timing out to slow.

    Windows Server 2025, 4 vCPU (Xeon Platinum 8573C), 16 GB, WSL 3.0.5 (kernel 6.18), Ubuntu 24.04 with Git 2.43, Defender on with default settings, commit c242558.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugneeds-triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions