Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Looks good. I ran the issue's ACP stdio reproduction against a real opencode acp from source. On the base, the shell working directory and the grep directory were sent as locations on the pending, in-progress and completed updates (6 directory locations). With this change, no locations were sent for either call. The ACP tests in packages/cli pass (101) and tsc -b is clean.
Public API: unchanged. Only the content of ACP locations changes, and the shell working directory is still sent in rawInput.cwd.
No blocking concerns.
This branch has not been deployed
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.
What was wrong
Over ACP, opencode reported directories as tool call
locations. Zed opens a buffer for every location, so each update tried to read a folder as a file. On a remote worktree that shows up asreading bytes of the file "/var/www"/Binary files are not supportederrors on every tool call update, which also adds load to an already unstable remote connection.Root cause
toLocationsinpackages/cli/src/acp/tool.tsreturned:shellcall (the session cwd when none was given),glob, which is always a directory,pathforgrepandread, both of which also accept directories.The permission request fallback in
permission.tsalso turnedexternal_directorygrants like/dir/*into a/dirlocation.Fix
shellandglobno longer report locations. The shell working directory is still sent inrawInput.cwd.locationFromdrops paths that exist and are directories. Paths that can't be inspected, such as a file a tool is about to create, are still reported.Opencode does not send
fs/read_text_filerequests, so locations were the only source of these reads. Zed should still refuse to open a directory as a buffer (zed-industries/zed#48240). This PR only stops opencode from triggering that.No feature flag: this is a bug fix.
How verified
packages/cli/test/acp/translate.test.tsrunsshell,glob,grepandreadcalls on a real temp directory and file throughACPTranslate.fold. It failed before the change (directory locations on the pending, in-progress and completed updates) and passes now. Existing assertions that expected directory locations were updated.bun teston the ACP unit tests inpackages/cli(97 pass) andbun typecheckinpackages/cli.opencode acpover stdio, mock model making ashellcall and agrepon a directory). Before:BUG: opencode sent 6 directory location(s) to the ACP client. After:OK: no directory locations sent.Visual
Closes #52952