Skip to content

devcontainer: Fix project search returning no results on single-CPU containers#48798

Merged
osiewicz merged 1 commit intozed-industries:mainfrom
oliverbarnes:fix-search-in-devcontainer
Feb 9, 2026
Merged

devcontainer: Fix project search returning no results on single-CPU containers#48798
osiewicz merged 1 commit intozed-industries:mainfrom
oliverbarnes:fix-search-in-devcontainer

Conversation

@oliverbarnes
Copy link
Contributor

Closes #47489

The search worker pool was sized as num_cpus - 1, which spawned zero workers when a devcontainer exposed only 1 CPU. All search channels closed immediately and the search yielded zero results, while file finder and LSP symbols worked fine.

The fix ensures at least 1 worker is always spawned: (num_cpus - 1).max(1). A num_cpus override on TestDispatcher and a new test reproduce the bug with server_cx.executor().set_num_cpus(1).

Manual testing

Add a .devcontainer/ directory to a new project with these files:

// docker-compose.yml
services:
  dev:
    image: debian:bookworm-slim
    cpuset: "0"
    volumes:
      - ..:/workspace:cached
    command: sleep infinity
// devcontainer.json
{
  "name": "zed-sandbox (1 CPU)",
  "dockerComposeFile": "docker-compose.yml",
  "service": "dev",
  "workspaceFolder": "/workspace"
}

Build zed and point it at the new project:

cargo run -p zed -- ~/Repos/zed-sandbox-project

Open the built-in terminal, confirm nproc prints 1.

Finally, run a project search (Cmd+Shift+F) and search for contents that exist in it.

Results should appear 🎉

Release Notes:

  • Fixed project search returning no results in devcontainers with a single visible CPU.

…ontainers

When a devcontainer exposes only 1 CPU, the search worker pool was sized
as `num_cpus - 1 = 0`, so zero workers were spawned. This caused all
search channels to close immediately, producing zero results. File finder
and LSP symbols were unaffected since they use different code paths.

Ensure at least 1 worker is always spawned: `(num_cpus - 1).max(1)`.
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 9, 2026
@osiewicz osiewicz self-assigned this Feb 9, 2026
@osiewicz osiewicz merged commit 3b81feb into zed-industries:main Feb 9, 2026
29 checks passed
@osiewicz
Copy link
Member

osiewicz commented Feb 9, 2026

Thank you!

@oliverbarnes oliverbarnes deleted the fix-search-in-devcontainer branch February 9, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project Search does not work when running in devcontainer.

2 participants