openclaw - ✅(Solved) Fix [Bug]: ACP thread-bound sessions deliver duplicate messages to Discord thread [1 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#55568Fetched 2026-04-08 01:37:53
View on GitHub
Comments
2
Participants
3
Timeline
5
Reactions
0
Timeline (top)
commented ×2cross-referenced ×1referenced ×1subscribed ×1

ACP thread-bound sessions (Claude Code via sessions_spawn with runtime: "acp", thread: true, mode: "session") deliver every message twice to the Discord thread. The duplicates have different message IDs but identical content, sent ~4 seconds apart from the same webhook.

Root Cause

ACP thread-bound sessions (Claude Code via sessions_spawn with runtime: "acp", thread: true, mode: "session") deliver every message twice to the Discord thread. The duplicates have different message IDs but identical content, sent ~4 seconds apart from the same webhook.

PR fix notes

PR #55819: fix: count Discord ACP block deliveries as visible text

Description (problem / solution / changelog)

Fixes #55568

ACP-bound Discord channels deliver every response twice identical content, a few seconds apart.

The bug is in shouldTreatDeliveredTextAsVisible in dispatch-acp-delivery.ts. Block deliveries are only counted as "visible" for Telegram. Discord blocks get delivered fine, but the delivery coordinator doesn't know that, so finalizeAcpTurnOutput sees hasDeliveredVisibleText() === false and sends the whole thing again as a final reply.

One-line fix: also return true when the channel is discord.

Tested with a Discord ACP binding (Claude Code, persistent mode) duplicates gone, single delivery confirmed.

Changed files

  • src/auto-reply/reply/dispatch-acp-delivery.ts (modified, +2/-1)
RAW_BUFFERClick to expand / collapse

Description

ACP thread-bound sessions (Claude Code via sessions_spawn with runtime: "acp", thread: true, mode: "session") deliver every message twice to the Discord thread. The duplicates have different message IDs but identical content, sent ~4 seconds apart from the same webhook.

Environment

  • OpenClaw: 2026.3.24
  • @openclaw/acpx: 2026.3.22
  • acpx: 0.3.1
  • Channel: Discord
  • ACP agent: Claude Code (agentId: "claude")

Reproduction Steps

  1. Spawn an ACP thread-bound session via sessions_spawn({ runtime: "acp", agentId: "claude", thread: true, mode: "session" })
  2. Interact with Claude Code in the spawned Discord thread
  3. Observe that Claude Code responses are posted twice

Evidence

Thread ID: 1486937122328936530 (Discord)

Example of duplicated messages (same content, different IDs, ~4s apart):

First batch (positions 142-151, timestamps 04:48:58 - 04:49:01 UTC):

  • 1486950134162919515 - Content A
  • 1486950135924785315 - Content B
  • 1486950137359237150 - Content C
  • ... (8 more messages)

Second batch (positions 152-161, timestamps 04:49:02 - 04:49:05 UTC):

  • 1486950150592266240 - Content A (duplicate)
  • 1486950152236437524 - Content B (duplicate)
  • 1486950153653846106 - Content C (duplicate)
  • ... (8 more messages, all duplicates)

Both batches were sent by the same ACP webhook (webhook ID 1483677704904773632).

Discord Config (relevant)

  • streaming: off
  • blockStreaming: false
  • chunkMode: newline
  • textChunkLimit: 1900

ACP Config

  • enabled: true
  • backend: acpx
  • defaultAgent: claude
  • stream.coalesceIdleMs: 300
  • stream.maxChunkChars: 1200

Additional Context

  • The first ACP session spawned in the same parent thread failed silently (no robot thread was created), while a second spawn worked but exhibited this duplication.
  • A main agent (Friday) message was also observed interleaved in the ACP thread (position 139), suggesting possible routing cross-contamination.
  • This was not observed in earlier OpenClaw versions.

extent analysis

Fix Plan

To resolve the issue of duplicated messages in the Discord thread, we need to modify the ACP configuration to prevent coalescing of messages.

  • Update the stream.coalesceIdleMs setting to 0 to disable message coalescing:
// Update ACP config
const acpConfig = {
  // ... other settings ...
  stream: {
    coalesceIdleMs: 0, // Disable message coalescing
    maxChunkChars: 1200
  }
};
  • Additionally, consider increasing the textChunkLimit in the Discord config to match the maxChunkChars setting in the ACP config:
// Update Discord config
const discordConfig = {
  // ... other settings ...
  textChunkLimit: 1200
};

Verification

To verify that the fix worked, spawn a new ACP thread-bound session and interact with Claude Code in the spawned Discord thread. Check that the responses from Claude Code are no longer duplicated.

Extra Tips

  • Monitor the Discord thread for any further issues with message duplication or routing cross-contamination.
  • Consider implementing additional logging or debugging measures to help identify the root cause of the issue and prevent similar problems in the future.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING