acp: Set agent server cwd from project paths#52005
Merged
Conversation
Add Project::default_path_list and reuse it for agent session work directories and ACP server startup so agent processes start in the project context by default We previously removed all cwd from this hoping to have a global process shared, but it doesn't work for remote projects. Since we're at the project boundary anyway, we might as well start it up in a similar spot as a new thread.
3 tasks
benbrandt
commented
Mar 20, 2026
| .default_path_list(cx) | ||
| .ordered_paths() | ||
| .next() | ||
| .cloned() |
Member
Author
There was a problem hiding this comment.
Same as we do for new session for now
benbrandt
commented
Mar 20, 2026
| } else { | ||
| PathList::new(&worktree_roots) | ||
| } | ||
| } |
Member
Author
There was a problem hiding this comment.
Pulled the central logic here
bennetbo
approved these changes
Mar 20, 2026
toshmukhamedov
pushed a commit
to toshmukhamedov/zed
that referenced
this pull request
Mar 20, 2026
## Context Add Project::default_path_list and reuse it for agent session work directories and ACP server startup so agent processes start in the project context by default We previously removed all cwd from this hoping to have a global process shared, but it doesn't work for remote projects. Since we're at the project boundary anyway, we might as well start it up in a similar spot as a new thread. ## Self-Review Checklist <!-- Check before requesting review: --> - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - acp: Make sure the agent server is started in a project directory
maan2003
reviewed
Mar 23, 2026
| .next() | ||
| .cloned() | ||
| }) { | ||
| child.current_dir(cwd); |
Contributor
There was a problem hiding this comment.
@benbrandt this might have broken acp on remote projects.
failed to spawn command cd "/home/maan2003/src/codex" && "fish" "-c" "ssh -o 'ControlMaster=no' -o 'ControlPath=/tmp/zed-ssh-sessionGIul5x/ssh.sock' -q -T devbox \"cd \\\"/home/maan2003\\\" && exec env 'SSH_AUTH_SOCK=/..<bunch of env variables>' codex-acp\""
it tries to cd locally for a remote project, which doesn't work because path doesn't exist locally.
AmaanBilwar
pushed a commit
to AmaanBilwar/zed
that referenced
this pull request
Mar 23, 2026
## Context Add Project::default_path_list and reuse it for agent session work directories and ACP server startup so agent processes start in the project context by default We previously removed all cwd from this hoping to have a global process shared, but it doesn't work for remote projects. Since we're at the project boundary anyway, we might as well start it up in a similar spot as a new thread. ## Self-Review Checklist <!-- Check before requesting review: --> - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - acp: Make sure the agent server is started in a project directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Add Project::default_path_list and reuse it for agent session work
directories and ACP server startup so agent processes start in the
project context by default
We previously removed all cwd from this hoping to have a global process
shared, but it doesn't work for remote projects. Since we're at the
project boundary anyway, we might as well start it up in a similar spot
as a new thread.
Self-Review Checklist
Release Notes: