Skip to content

Agent sends duplicate message #20699

Closed as not planned
Closed as not planned

Description

@ColaHikari

Description

When a user sends a simple message like "hello!", the agent generates two assistant responses instead of one:

Message 1 (hidden from user, but visible to agent): Contains the greeting text
Message 2 (shown to user): Has empty visible text, but its reasoning part says "I've already sent my response greeting them and asking what they need help with"
Both messages have the same parentID (replying to the same user message).

The user can only see Message 2, which makes the agent appear confused — its visible response is empty, and the reasoning references content from a message the user never saw.

In more complex queries (e.g., "Write a sorting algorithm"), the actual code or explanation in Message 1 is completely dropped. The user only sees a reasoning block saying:

"The user asked a direct question and I answered it clearly. The task is complete."

This results in a total failure of the agent's primary function, as the user receives no content despite the model believing it has fulfilled the request.

Expected Behavior
The reasoning and visible text should be consistent and directly address the user's prompt.

Actual Behavior
Message 1’s response is discarded or hidden, and Message 2 is generated as a "phantom" retry that lacks substance but inherits the "thought" process from the first attempt.

Plugins

None

OpenCode version

v1.3.12

Steps to reproduce

OpenCode is deployed on a Linux system. Accessing OpenCode via web on Windows leads to the aforementioned issues, but there are no such problems when using macOS.
Additionally, there is an assistant message located above the user's message and it is invisible—an extremely peculiar issue.

  1. User sends "hello!" or any simple greeting
  2. Observe: Two assistant messages are generated with the same parentID
  3. First message (hidden from UI): Contains visible greeting text
  4. Second message (shown to UI): Empty visible text, but reasoning references the first message's content

Screenshot and/or share link

Image Image

messages.txt

Operating System

windows 11

Terminal

No response

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 2, 2026
  2. github-actions commented on Apr 2, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please review these issues to see if they describe the same root cause.

  3. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. sylac commented on May 12, 2026

    @sylac

    I can reproduce the “two responses for one prompt / Stop only cancels one” behavior on opencode v1.14.48.

    Symptom

    • send one message
    • two assistant responses appear
    • pressing Stop cancels one, but the other continues

    Strong log evidence

    In the same session, I see two completed POST /session/<session-id>/message responses with different span IDs and different durations:

    INFO  2026-05-11T14:47:48 ... http.method=POST http.url=/session/<session-id>/message http.status=200 logSpan.http.span.273=207731ms Sent HTTP response
    INFO  2026-05-11T14:47:48 ... http.method=POST http.url=/session/<session-id>/message http.status=200 logSpan.http.span.295=161643ms Sent HTTP response
    

    Why this looks wrong

    • same endpoint
    • same session
    • same completion timestamp
    • different spans
    • different long-running durations

    That is consistent with two independent prompt executions reaching completion for the same user action.

    Important caveat

    These lines alone do not prove whether this was:

    1. a duplicate client submit, or
    2. duplicate handling/server-side concurrency after a single submit

    But together with the UI symptom, they are strong evidence that two pipelines were active and Stop only cancelled one of them.

    Likely areas to inspect

    • duplicate route / handler registration
    • plugin hook double-registration
    • missing per-session single-flight guard around prompt execution
    • abort tied to one in-flight pipeline instead of all active pipelines for the session

    If useful, I can also provide:

    • surrounding log lines for both spans
    • sanitized session message tree
    • result of reproducing with plugins disabled
  5. alterdaemon commented on May 22, 2026

    @alterdaemon

    same problem, and this must be two separate calls because each duplicated answer differs slightly from each other. e. g. standard review agent.
    OpenCode Desktop (via web server)
    v1.15.6

  6. Snowy117 commented on Jun 1, 2026

    @Snowy117

    same problem, only found in web/desktop. tui won't reproduce
    v1.15.12

  7. naomi-lgbt commented on Jul 20, 2026

    @naomi-lgbt

    i am experiencing the same issue for the web ui i run for my personal affairs

    i was able to reproduce in v1.17.13, v1.17.20, and v1.18.2

  8. copilotenstar commented on Jul 21, 2026

    @copilotenstar

    Same here getting duplicate replies and sometimes even 3 replies to one msg.

  9. github-actions commented on Sep 20, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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