Repository navigation
fix(acp): stop echoing edited files to the client - #52466
Merged
Merged
Conversation
Ichinose-Kazuki
pushed a commit
to Ichinose-Kazuki/opencode
that referenced
this pull request
Oct 7, 2026
This was referenced Oct 7, 2026
Closed
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.
#35457 | #50740
Fixes #50740
Why the change
Core has already written the file by the time an ACP edit, write, or patch tool succeeds, so sending the whole file back to the client with
fs/write_text_filedid nothing useful, and in Zed it rewrote the line endings.Special things to note
AcpThread::write_text_filediffs the new content into a buffer and saves it again (crates/acp_thread/src/acp_thread.rs:6421-6513). Buffers normalise line endings to LF (crates/text/src/text.rs:48-49) and save with one guessed line ending (crates/project/src/buffer_store.rs:399-413), which breaks files with mixed or stray\rendings. The echo also races Zed's reload of the file core already wrote (crates/language/src/buffer.rs:~1795, 1722-1751). The review log gains almost nothing, because tracking starts from the already-written buffer (crates/action_log/src/action_log.rs:185).clientCapabilities.fs.writeTextFiletoo.Change outline
What happens when an edit tool succeeds:
Files changed:
packages/cli/ ├── src/acp/ │ ├── connection.ts # drop writeTextFile request │ ├── event.ts # drop the syncEditedFiles call and the writeTextFile turn input │ ├── permission.ts # drop syncEditedFiles │ └── service.ts # stop capturing clientCapabilities.fs.writeTextFile └── test/acp/ └── permission.test.ts # no fs/write_text_file even when the client advertises it; preview tests no longer assert writes