fix(acp): emit writeTextFile for file edits when client advertises fs.writeTextFile#28734
Open
bcdady wants to merge 2 commits into
Open
fix(acp): emit writeTextFile for file edits when client advertises fs.writeTextFile#28734bcdady wants to merge 2 commits into
bcdady wants to merge 2 commits into
Conversation
….writeTextFile Fixes anomalyco#4240 Store clientCapabilities from the ACP initialize handshake on ACPConfig. Add sessionID to the file.edited bus event so the ACP agent can look up the right session. On each file.edited event, if the client advertised fs.writeTextFile, push the updated file contents to the ACP client via connection.writeTextFile, enabling Zed's native diff-review UI. Update SDK generated types (EventFileEdited) in both v1 and v2 to include the new sessionID field.
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found a related PR: Related PR:
Why it's related: According to your PR description, PR #22674 is the original submission of this exact fix. You mention: "This is a re-submission of the same fix from PR #22674, which addressed the same issue but went stale. The diff is functionally identical; it has been rebased onto the current Since PR #22674 went stale and you're resubmitting the rebased fix as PR #28734, ensure PR #22674 is closed/marked as superseded before merging this one. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
6 tasks
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 #4240
Type of change
What does this PR do?
When running OpenCode in ACP mode (e.g. inside Zed), file edits are applied silently — Zed's native "Review changes" button never appears. This is because the ACP agent wasn't calling
writeTextFileback to the client after edits.Three things were missing:
clientCapabilitiesfrom the ACPinitializehandshake was never persisted, so the agent couldn't check whether the client supportsfs.writeTextFilefile.editedbus event had nosessionIDfield, so the ACP agent couldn't look up the right session to notifyfile.editedcase in the ACP agent event handlerThis PR adds all three. On each file edit, if the client advertised
fs.writeTextFile, the agent now reads the file from disk and sends its contents to the client viaconnection.writeTextFile, which triggers Zed's diff-review UI.The SDK generated types (
EventFileEdited) in both v1 and v2 are updated to include the newsessionIDfield.This is a rebase of PR #22674 onto current
devHEAD. That PR addressed the same issue but went stale.How did you verify your code works?
Tested locally in Zed with
opencode acp. After the fix, the "Review changes" button appears after each file edit, matching the behavior described in the issue.Screenshots / recordings
N/A — behaviour matches the Gemini CLI screenshots already in issue #4240.
Checklist