Files
zed/crates/collab
Azeem Shaik 1a28cff4b4 git: Stop remote operations blocking commit views (#64720)
# Objective

Fixes #64078

Opening a commit from the git panel, git graph, or blame waits until any
in-flight fetch, pull, or push has finished. `show` and
`load_commit_diff` went through the per-repository serial job queue, so
a click on a commit sat behind the whole network round trip.

## Solution

Commit reads are addressed by SHA, so their result doesn't depend on
what else is queued. This takes them off the queue the way #62536 did
for blob reads:

1. `Repository::show_commit` and `Repository::load_commit_diff` spawn
directly instead of going through `send_job`, bounded by the same
semaphore as blob reads, and return a `Task` instead of a
`oneshot::Receiver`.
2. The semaphore is renamed from `blob_read_limiter` to
`object_read_limiter` since it now covers commits too.
3. `Repository::show` stays queued for the ref picker, which passes
branch and tag names rather than shas. Both share one body in
`show_internal`.

`handle_show` serves both from the same `GitShow` message, so it routes
by whether the payload parses as a full object id, which is how git
itself resolves a 40-hex string.

Worth noting one behaviour change in shallow clones: opening a boundary
commit while `git fetch --unshallow` is already running used to wait for
the fetch, and now shows the shallow boundary notice straight away with
the button disabled until the fetch completes. The "Fetch Full History"
button itself awaits the fetch explicitly before reloading, so it is
unaffected.

## Testing

Added three tests:

- `git_store::tests::test_commit_reads_do_not_wait_on_job_queue` holds
the job queue with a job that never completes and asserts `show_commit`
and `load_commit_diff` resolve anyway, while `show` still waits. It
fails on `main` with `show_commit waited on the job queue`.
- `git_store::tests::test_commit_reads_share_object_read_limit` holds
every permit with blob reads and asserts both commit reads wait until
one is released.
-
`collab::git_tests::test_show_rpcs_are_routed_by_revision_kind_on_host`
has a guest send `GitShow` with a sha and with a ref name while the host
queue is held; the sha is answered, the ref name waits.

Green: `cargo test -p project --lib git_store` (22), `cargo test -p
git_ui --lib` (157), `cargo test -p collab --test collab_tests
git_tests` (13), `./script/clippy`.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments — none added
- [x] The content adheres to Zed's UI standards — no UI changes
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

Five-commit repository with a remote that holds every fetch for ten
seconds. Fetch is clicked, then commits in the History tab.

**Before**


https://github.com/user-attachments/assets/6c79f870-62cd-487b-be9f-7eefbb52b008


**After**


https://github.com/user-attachments/assets/30680d1d-f19f-4407-90bf-11054ff3dd69

---

Release Notes:

- Fixed commit details and diffs waiting behind an in-progress fetch,
pull, or push before opening
2026-09-27 19:37:50 +00:00
..
…
…
…
…

Zed Server

This crate is what we run at https://collab.zed.dev.

It contains our back-end logic for collaboration, to which we connect from the Zed client via a websocket after authenticating via https://zed.dev, which is a separate repo running on Vercel.

Local Development

Database setup

Before you can run the collab server locally, you'll need to set up a zed Postgres database. Follow the steps sequentially:

  1. Ensure you have postgres installed. If not, install with brew install postgresql@15.
  2. Follow the steps on Brew's formula and verify your $PATH contains /opt/homebrew/opt/postgresql@15/bin.
  3. If you hadn't done it before, create the postgres user with createuser -s postgres.
  4. You are now ready to run the bootstrap script:
script/bootstrap

This script will set up the zed Postgres database, and populate it with some users. It requires internet access, because it fetches some users from the GitHub API.

The script will create several admin users, who you'll sign in as by default when developing locally. The GitHub logins for the default users are specified in the seed.default.json file.

To use a different set of admin users, create crates/collab/seed.json.

{
  "admins": ["yourgithubhere"],
  "channels": ["zed"]
}

Testing collaborative features locally

In one terminal, run Zed's collaboration server and the livekit dev server:

foreman start

In a second terminal, run two or more instances of Zed.

script/zed-local -2

This script starts one to four instances of Zed, depending on the -2, -3 or -4 flags. Each instance will be connected to the local collab server, signed in as a different user from seed.json or seed.default.json.

Deployment

We run two instances of collab:

Both of these run on the Kubernetes cluster hosted in Digital Ocean.

Deployment is triggered by pushing to the collab-staging (or collab-production) tag in GitHub. The best way to do this is:

  • ./script/deploy-collab staging
  • ./script/deploy-collab production

You can tell what is currently deployed with ./script/what-is-deployed.