fix(ui): drop the slash-command echo of the local user message in the ACP adapter - #11671
Open
yixuanzhong wants to merge 1 commit into
Open
fix(ui): drop the slash-command echo of the local user message in the ACP adapter#11671yixuanzhong wants to merge 1 commit into
yixuanzhong wants to merge 1 commit into
Conversation
… ACP adapter Slash commands make the agent yield the user's own prompt back into the reply stream. The desktop already rendered that prompt when it was sent, so the echoed user_message_chunk either merges into the local message and doubles its text, or lands as a second identical user message once the server assigns it an id. Ignore a non-steer user text chunk that repeats the locally rendered user message.
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.
Fixes: #11670
Summary
Slash commands make the agent yield the user's own prompt back into the reply stream (
command_preamble/yield AgentEvent::Message(user_message)inagent.rs). The desktop already rendered that prompt locally when it was sent, so the echoeduser_message_chunkeither merged into the local message and doubled its text (/plan add tests/plan add tests, before #10716) or, now that the echo carries a server-generated id, landed as a second identical user bubble.This drops a non-steer
user_message_chunkwhose text equals the single text block of the last locally rendered user message, inapplyContentChunk. The check runs before the id lookup so it covers both shapes. Steer confirmations are untouched (they are reconciled by id and replace text rather than append), and the agent stream is unchanged for the CLI and other ACP clients.Testing
sessionNotificationAdapter.test.ts: the echo is dropped whether it arrives without an id or with a server id, the agent chunk that follows still lands as a separate message, and a genuine id-less user delta still merges.vitest run src/acp: 21 files, 175 tests pass.tsc --noEmit,eslint --max-warnings 0andprettier --checkclean on the touched files./plan ...and/goal ...on a build of this adapter; with the guard the command appears once.Related Issues
Discussion: #9261 (structured slash-command lifecycle events would remove the need for the echo altogether)
Screenshots/Demos (for UX changes)
Before: the sent
/goal ...message rendered twice in one bubble, joined with no separator.After: the message renders once.