Fix repeated prompts in opencode acp#53216
Merged
benbrandt merged 3 commits intozed-industries:mainfrom Apr 8, 2026
Merged
Conversation
benbrandt
reviewed
Apr 6, 2026
| // Some ACP servers echo user chunks back over updates, which would duplicate | ||
| // context chips/message text unless ignored while a turn is active. | ||
| if self.running_turn.is_none() { | ||
| self.push_user_content_block(None, content, cx); |
Member
There was a problem hiding this comment.
I think it would be better to do some check of if we are currently in a user mesage and if the content would match the current message?
Contributor
Author
There was a problem hiding this comment.
updated the logic and ran the same test already present
Member
There was a problem hiding this comment.
Potentially too "fuzzy" a match.. but given that they will probably replay the whole thing probably ok
|
OpenCode agent started to behave differently after the recent update that caused the duplicate prompt. My first impression was that the changed behaviour was caused by the duplicate prompt. But the agent also seems to have lost file references. This is an issue to be able to instruct the agent to read or update a specific file. |
benbrandt
approved these changes
Apr 8, 2026
piper-of-dawn
pushed a commit
to piper-of-dawn/zed
that referenced
this pull request
Apr 25, 2026
### Summary Fixes duplicated Prompts/context in ACP threads after sending a message, as reported in zed-industries#53201. ### Root Cause The thread already inserts the user prompt optimistically at send time. If an ACP server also echoes UserMessageChunk updates for the same prompt, the same content is appended again, which can duplicate rendered context sections. ### Fix Ignore echoed UserMessageChunk updates while a turn is actively running, so user prompt content is not appended twice. ### Validation - Reproduced with OpenCode ACP flow from the issue. - Confirmed duplication appears after send (not in the input box). - Confirmed duplicate Prompts/context no longer appears with the fix. ### Video [Screencast from 2026-04-06 08-21-32.webm](https://github.com/user-attachments/assets/33075312-9af7-4dd5-a2a3-5e1169b80243) ### Self-Review Checklist - [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 Closes zed-industries#53201 ## Release Notes - Fixed duplicated Prompts/context in ACP conversations when servers echo user message chunks after send.
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.


Summary
Fixes duplicated Prompts/context in ACP threads after sending a message, as reported in #53201.
Root Cause
The thread already inserts the user prompt optimistically at send time.
If an ACP server also echoes UserMessageChunk updates for the same prompt, the same content is appended again, which can duplicate rendered context sections.
Fix
Ignore echoed UserMessageChunk updates while a turn is actively running, so user prompt content is not appended twice.
Validation
Video
Screencast.from.2026-04-06.08-21-32.webm
Self-Review Checklist
Closes #53201
Release Notes: