Branch switches invalidate and eagerly resend full Git history over SSH, delaying protocol responses and potentially contending with terminal traffic
Reproduction steps
On the SSH host, clone FreeBSD with its full main-branch history:
git clone --single-branch --no-tags --branch main https://github.com/freebsd/freebsd-src.git cd freebsd-src git switch --create repro-base 04fcf30961266cd77139b40774cb0d6ef6eb2be5 git branch repro-next f6db138f97b78e641b07a7c3695ccf62b0f42f28Open the repository over SSH in Zed. Wait for initial loading to finish, then open the integrated terminal.
Switch to
repro-nextusing Zed’s branch picker. Type in the terminal and try opening a file.After responsiveness returns, switch back to
repro-baseand repeat.
The branches differ by one commit, one file, and one added line. The test repository had approximately 313,000 commits.
Current vs. Expected behavior
Expected: Switching between branches that differ by one line leaves integrated terminal typing and file opening responsive.
Current: Both become sluggish after the switch, then recover. This reproduced in both directions on FreeBSD using Zed 1.20.2 with fresh Mac configuration/data and isolated remote Zed state.
Why I suspect history transfer:
The public FreeBSD test used original release binaries without protocol interception:
| Measurement | Forward switch | Reverse switch |
|---|---|---|
| Proxy write-syscall bytes | 27,180,250 | 27,180,912 |
| One-second samples showing blocked pipe writes | 27/70 | 23/70 |
Both captures cover 10 seconds before the observed HEAD change through 60 seconds after. Blocked writes continued after the sampled Git history process disappeared. These byte counts include all proxy writes, not specifically history messages or exact network traffic.
An earlier test on Zed 1.19.2 with a private repository identified the bulk messages as GetInitialGraphDataResponse. We compared the same branch switch with a diagnostic wrapper forwarding everything versus removing only history response bodies while preserving protocol bookkeeping:
| Measurement | Normal history | History bodies removed |
|---|---|---|
| History bytes forwarded to SSH | 35,319,640 | 5,130 |
| History stream duration | 29.66 s | 1.56 s |
| One-second samples showing blocked proxy writes | 30/100 | 0/100 |
The run with history bodies removed did not lag. Source inspection of that version showed that branch changes clear the history cache and the Git panel preloads the full history even outside the History tab. The measured for-each-ref operation ended before the long transfer.
Together, these results point to history transfer as a contributor. The terminal shares the SSH connection with Zed’s protocol, so transport contention could explain delayed echo. Direct typing latency was not measured, and the public test’s payload types were not decoded.
Zed version and system specs
Zed: v1.20.2+stable.360.7c451e694f3c52ee0aeb01d7e28b5fa18cd0ad2f (Zed) OS: macOS 26.6.2 Memory: 36 GiB Architecture: aarch64
Remote host: Ubuntu 22.04, x86_64.
Remote server used in the trial: 1.19.2+stable.356.df181c6f58d02677b385fa947d6bfde6d3530078.
Attach Zed log file
Zed log contains no relevant entries during the reproduction
Relevant Zed settings
settings.jsonRelevant 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?
None
Source: zed-industries/zed