Skip to content

TUI user-message preview causes agents to answer twice #124

Description

@furgalep

Problem

The TUI exposes a preview of the newest user message to the agent before that message is delivered through the normal user_messages queue. Agents frequently interpret that preview as the actual queued message and respond to it immediately. When the queue subsequently pumps, the agent receives the same user message through the normal channel and answers it a second time.

This makes the message lifecycle ambiguous to the agent and results in duplicate answers, duplicated work, and confusing conversation history.

Observed behavior

  1. The user submits a message.
  2. The agent sees the message text in a TUI/turn preview or notification.
  3. The agent treats that preview as actionable input and responds.
  4. The normal user-message queue pumps and delivers the same message.
  5. The agent responds again.

Expected behavior

A user message should have one unambiguous delivery path and be handled exactly once. If a preview must be exposed to the agent, it should be clearly marked as non-actionable/already pending delivery, and the runtime should prevent it from being mistaken for a second message.

Possible directions

  • Do not place user-message preview content in the agent context before queue delivery.
  • Replace the content preview with metadata only (for example, “user message pending”).
  • Give previews and queued messages a stable message ID and deduplicate handling.
  • Clarify the agent/runtime contract so only messages consumed from user_messages are actionable.

Acceptance criteria

  • A newly submitted user message causes one agent handling turn, not one for the preview and another after queue delivery.
  • Tests cover a user message arriving while an agent turn is active and verify exactly-once handling.
  • The TUI still provides useful pending-message feedback without exposing ambiguous actionable content to the agent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions