Skip to content

acp: Set agent server cwd from project paths#52005

Merged
benbrandt merged 1 commit intomainfrom
acp-project-working-dir
Mar 20, 2026
Merged

acp: Set agent server cwd from project paths#52005
benbrandt merged 1 commit intomainfrom
acp-project-working-dir

Conversation

@benbrandt
Copy link
Copy Markdown
Member

@benbrandt benbrandt commented 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

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • acp: Make sure the agent server is started in a project directory

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.
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 20, 2026
@zed-codeowner-coordinator zed-codeowner-coordinator bot requested review from a team, cameron1024, mikayla-maki, osyvokon and smitbarmase and removed request for a team March 20, 2026 11:02
@zed-community-bot zed-community-bot bot added the staff Pull requests authored by a current member of Zed staff label Mar 20, 2026
.default_path_list(cx)
.ordered_paths()
.next()
.cloned()
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as we do for new session for now

} else {
PathList::new(&worktree_roots)
}
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled the central logic here

@benbrandt benbrandt merged commit 8f0826f into main Mar 20, 2026
42 checks passed
@benbrandt benbrandt deleted the acp-project-working-dir branch March 20, 2026 14:20
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
.next()
.cloned()
}) {
child.current_dir(cwd);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
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 staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants