Skip to content

[Bug]: ACP sessions in Control UI (webchat) show duplicate identical replies for each prompt #110368

Closed

Description

@iamtornado

Bug type

Bug — UI / session delivery (ACP + Control UI webchat)

Summary

When using ACP-backed sessions in the OpenClaw Control UI (webchat), each user prompt produces two identical assistant reply bubbles. The session transcript records two user+assistant turn pairs for a single prompt, while the gateway appears to dispatch the ACP request only once.

Version

  • OpenClaw: 2026.7.1 (2d2ddc4)
  • @openclaw/acpx: 2026.7.1

Reproduction

  1. Connect or run an agent session via ACP (example session key below).
  2. Open the session in Control UI / webchat.
  3. Send a single user message / prompt.
  4. Observe the assistant response area and session transcript.

Example session key: agent:cursor:acp:6507cb8e-e1a8-43d2-b339-bb3e266f59e5 (label: content-pipeline)

Expected behavior

One user message → one assistant reply bubble and one user+assistant pair in the transcript.

Actual behavior

One user message → two identical assistant reply bubbles and two user+assistant pairs in the transcript for the same logical turn.

Screenshot

ACP webchat duplicate identical replies

Mirrors / evidence

Transcript excerpt (pattern)

For each single prompt, the transcript shows two back-to-back user+assistant pairs with the same assistant content:

  1. First pair: user + assistant messages recorded without idempotencyKey (ACP persist path).
  2. Second pair: user + assistant messages recorded with webchat messageId / idempotency metadata (webchat delivery mirror).

Net effect: duplicate bubbles in the UI and duplicated history rows for one logical exchange.

Gateway signal

Gateway logs indicate a single acp_dispatch (or equivalent one-shot ACP dispatch) per prompt — i.e. the backend does not appear to run the agent twice; duplication manifests in persistence and/or webchat delivery layering.

Suspected cause

Likely double recording of the same turn:

  1. ACP session persist writes user + assistant messages to the transcript without webchat idempotency keys.
  2. Webchat delivery (Control UI) mirrors or re-appends the same turn with messageId / idempotency metadata.

Without deduplication between these paths, the UI renders two identical assistant bubbles for one dispatch.

Impact

  • Confusing UX in Control UI (appears the model answered twice).
  • Inflated transcript length and token/context noise if both copies are retained.
  • Harder to debug session state and message ordering for ACP workflows.
  • May affect downstream tooling that counts turns or assumes 1:1 user/assistant pairing.

Environment notes

  • Observed on OpenClaw 2026.7.1 with @openclaw/[email protected].
  • Repro tied to ACP session keys in Control UI webchat (not necessarily limited to a single agent label).

Activity

  1. added
    P2
    impact:session-state
    impact:ux-friction
    issue-rating: 🦪 silver shellfish
    clawsweeper:needs-info
    clawsweeper:no-new-fix-pr
    clawsweeper:needs-maintainer-review
    on Jul 18, 2026
  2. clawsweeper commented on Jul 18, 2026

    @clawsweeper
    Contributor

    Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

    The original ACP double-persistence defect is fixed and released; later non-ACP rendering reports describe separate behavior.

    So I’m closing this as already implemented rather than keeping a duplicate issue open.

    Review details

    Best possible solution:

    Retain the released ACP producer fix and handle historical cleanup or distinct live-rendering failures in their own focused reports.

    Do we have a high-confidence way to reproduce the issue?

    Current source prevents the reported second ACP transcript append, with matching inspected Gateway regressions and recorded merged-fix live evidence; no tests or live session were run during this read-only review.

    Is this the best way to solve the issue?

    The merged repair fixes persistence and completion ownership at the producer boundary, preserving distinct repeated turns without relying on global equal-text deduplication.

    Security review:

    Security review: This report concerns duplicate conversation persistence and display.

    AGENTS.md: found and applied where relevant.

    What I checked:

    Codex review notes: model internal, reasoning medium; reviewed against ce4b8d65adc7; fix evidence: release v2026.8.1, commit 1c40abdb63b8.

  3. iamtornado commented on Jul 18, 2026

    @iamtornado
    Author

    Following up on clawsweeper:needs-info with reproduction evidence from production host openclaw-37230 (10.65.37.230), collected without exposing secrets.

    Expected vs Actual

    Expected One Control UI webchat prompt → one acp_dispatch, one user+assistant pair in transcript, one assistant bubble in the UI.
    Actual One prompt → one gateway acp_dispatch (confirmed in logs), but transcript and UI show two user+assistant pairs with identical assistant text per prompt.

    Environment

    Field Value
    OpenClaw 2026.7.1 (2d2ddc4)
    @openclaw/acpx 2026.7.1 (bundled under ~/.openclaw/npm/node_modules/@openclaw/acpx)
    OS / host Linux, openclaw-37230
    Channel Control UI webchat
    ACP session key agent:cursor:acp:6507cb8e-e1a8-43d2-b339-bb3e266f59e5
    Transcript session id 32c14196-1d84-42a9-8c61-3ed55c131edc
    Related prior report #85741 (same acp-runtime vs gateway-injected pattern; closed but behavior persists on 2026.7.1)

    Config (ACP / acpx only, non-secret)

    {
      "acp": {
        "enabled": true,
        "backend": "acpx",
        "defaultAgent": "cursor",
        "allowedAgents": ["cursor"],
        "maxConcurrentSessions": 4,
        "dispatch": { "enabled": true }
      }
    }

    Gateway log excerpt (redacted)

    journalctl --user -u openclaw-gateway.service for sessionKey=agent:cursor:acp:6507cb8e-e1a8-43d2-b339-bb3e266f59e5 on 2026-07-18 11:14–11:16 (+08:00):

    11:14:27 message received: channel=webchat messageId=33502f37-… sessionKey=agent:cursor:acp:6507cb8e-… source=dispatchInboundMessage
    11:14:27 message queued: sessionId=32c14196-… queueDepth=1 sessionState=idle
    11:14:33 message processed: messageId=33502f37-… outcome=completed duration=6004ms reason=acp_dispatch
    11:14:33 session state: prev=processing new=idle reason=message_completed queueDepth=0
    
    11:16:07 message received: channel=webchat messageId=cac99b70-… sessionKey=agent:cursor:acp:6507cb8e-… source=dispatchInboundMessage
    11:16:07 message queued: sessionId=32c14196-… queueDepth=1 sessionState=idle
    11:16:17 message processed: messageId=cac99b70-… outcome=completed duration=9848ms reason=acp_dispatch
    11:16:17 session state: prev=processing new=idle reason=message_completed queueDepth=0
    

    Observation: exactly one inbound webchat message and one reason=acp_dispatch completion per user prompt — no double-dispatch at the gateway queue layer.

    Transcript signature excerpt

    File: agents/cursor/sessions/32c14196-1d84-42a9-8c61-3ed55c131edc.jsonl (payloads truncated).

    Turn 1 (webchat messageId 33502f37-0be3-4e7f-9461-cb368c3cbc2e):

    # role model idempotencyKey user text (preview)
    1 user — (none) 请自我介绍
    2 assistant acp-runtime (none) 你好,我是 Composer…
    3 user — 33502f37-…:user 请自我介绍
    4 assistant gateway-injected 33502f37-… 你好,我是 Composer… (same text)

    Turn 2 (webchat messageId cac99b70-d9eb-47c5-b637-50ae68b31de7):

    # role model idempotencyKey user text (preview)
    1 user — (none) 你在哪个目录下
    2 assistant acp-runtime (none) 当前工作目录是… content-pipeline
    3 user — cac99b70-…:user 你在哪个目录下
    4 assistant gateway-injected cac99b70-… 当前工作目录是… (same text)

    Note on layering

    For each logical prompt:

    1. ACP persist path appends user + assistant (model: acp-runtime) without idempotencyKey.
    2. Webchat mirror path appends a second user + assistant pair with webchat messageId-derived idempotency keys (…:user / bare messageId) and model: gateway-injected.

    Gateway telemetry shows a single acp_dispatch per prompt; duplicates appear to be transcript persistence + Control UI delivery mirroring, not two agent runs.

    Happy to provide additional redacted logs or a longer transcript slice if maintainers need a specific code path traced on current main.

  4. added
    issue-rating: 🦞 diamond lobster
    clawsweeper:source-repro
    and removed
    clawsweeper:needs-info
    clawsweeper:no-new-fix-pr
    clawsweeper:needs-maintainer-review
    issue-rating: 🦪 silver shellfish
    on Jul 31, 2026
  5. 22 remaining items

  6. added
    clawsweeper:intake:bug
    issue-rating: 🦪 silver shellfish
    clawsweeper:not-repro-on-main
    and removed
    clawsweeper:intake:bug
    clawsweeper:no-new-fix-pr
    clawsweeper:needs-maintainer-review
    clawsweeper:needs-product-decision
    clawsweeper:source-repro
    issue-rating: 🦞 diamond lobster
    on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2clawsweeper:not-repro-on-mainimpact:session-stateimpact:ux-frictionissue-rating: 🦪 silver shellfish

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions