project: Restart context servers when their working directory changes (#61365)

# Objective

Fixes #60879

Open Zed from Finder/Dock and the agent's MCP servers run from `/`
instead of your project. They get spawned before any worktree exists, so
there's no root to give them and they grab Zed's own cwd. The worktree
shows up right after, but `maintain_servers` only restarts on a config
change and the working dir isn't part of the config, so nothing kicks
it.

## Solution

Track each server's working dir and restart when it changes. Direction 1
from @SomeoneToIgnore's triage. Could also defer startup until the first
worktree lands, happy to switch if you'd rather.

## Testing

Added a test: file-only worktree (root is `None`) → start server → add a
real worktree → server restarts. Fails without the fix.
- Fixed agent MCP servers running from the wrong directory when started
before a worktree was available
ac44e9f5dfApoorva Verma committed on 7/22/2026, 7:45:18 PM· committed by GitHubparent547a6cd
2 files changedLine totals unavailable