Skip to content

ACP: user_message_chunk incorrectly emitted during session/prompt turn #21708

@RAIT-09

Description

@RAIT-09

Description

During a normal session/prompt turn, the ACP agent echoes back the user's message as a session/update with user_message_chunk. This causes ACP clients (e.g. Zed EditorObsidian Agent Client) to display the user message twice.

Per the ACP spec, user_message_chunk should only be sent during session/load or session/fork to replay conversation history — not during an active prompt turn. The client already knows the message it sent, so echoing it back is incorrect and results in duplication.

This behavior was introduced in #18625, which intentionally added user_message_chunk emission on the live prompt path to align output between the live and replay paths. While the goal of consistency is understandable, the ACP prompt turn lifecycle does not include user_message_chunk, and compliant clients interpret it as a new message — causing the duplication.

If the underlying need is to expose the internal messageId to clients (e.g. for revert), that should be addressed through a different mechanism (such as including it in the session/prompt response) rather than echoing back user messages during the prompt turn.

Related: RAIT-09/obsidian-agent-client#209

I'd like to submit a PR to fix this.

Plugins

No response

OpenCode version

1.4.1

Steps to reproduce

  1. Connect to OpenCode via an ACP client (e.g. Zed Editor, Obsidian Agent Client)
  2. Send any prompt (e.g. "Hello World")
  3. The user message is immediately displayed twice — once from the client's own input, and once from the echoed user_message_chunk session/update

Screenshot and/or share link

Image Image

Operating System

No response

Terminal

No response

Metadata

Metadata

Assignees

Labels

acpbugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions