Repository navigation
fix(acp): omit directory paths from tool-call locations - #52956
Closed
Francis13CR wants to merge 1 commit into
Closed
Francis13CR wants to merge 1 commit into
Francis13CR wants to merge 1 commit into
Conversation
`toLocations` reported directories as tool-call locations: the resolved working directory for `bash`/`shell`, and the search root for `grep`/`glob`/`context`. ACP clients treat `locations` as file references and open a buffer for each one. On a remote project (for example Zed with zed-remote-server) opening a directory fails (`reading bytes of the file "<dir>"` / `Binary files are not supported`), and because locations are re-sent on every running tool-call update, the client retries on every update. This floods the connection, causes foreground hangs, and can desync the agent panel so a turn that actually completes is shown as canceled. Only report locations that are files: - `bash`/`shell`: drop the workdir location. It is already exposed via `rawInput.cwd`, so nothing is lost. - `grep`/`glob`/`context`/`external_directory` and `read`/`edit`/`write`: filter out paths that resolve to a directory. Unknown paths (such as a `write` target that does not exist yet) are kept, since they are not known to be directories. The now-unused `cwd` parameter of `toLocations` is removed; callers keep passing the workdir to `rawInput`, which still surfaces it.
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
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.
Issue for this PR
Closes #52952
Type of change
What does this PR do?
toLocationsinpackages/opencode/src/acp/tool.tsreturned directories as tool-call locations: the shell working directory forbash/shell, and the search root forgrep/glob/context.ACP clients open a buffer for each reported location. On a remote project (Zed +
zed-remote-server), opening a directory fails (reading bytes of the file "/var/www"/Binary files are not supported). Because these locations are re-sent on every running tool-call update, the client retries continuously, which floods the connection and desyncs the agent panel — a turn that actually finishes on the server gets shown as canceled.This reports only file locations:
bash/shell: the workdir location is dropped. It is still exposed viarawInput.cwd.grep/glob/context/external_directoryandread/edit/write: paths that resolve to a directory are filtered out. A path that doesn't exist (for example awritetarget) is kept, since it isn't known to be a directory.The now-unused
cwdparameter oftoLocationsis removed; callers still pass the workdir torawInput.How did you verify your code works?
From
packages/opencode:bun test test/acp/tool.test.ts→ 10 pass.I updated the existing
bashexpectations (the workdir is no longer a location) and added a regression test that creates a real temp directory and file and asserts the directory is filtered while the file is kept.Screenshots / recordings
Not a UI change.
Checklist