Skip to content

[Bug] Gateway duplicates inbound messages — same message injected multiple times into session #58443

Description

@ryou0903

Description

The Gateway is injecting the same inbound message into a session multiple times, causing the agent to respond to each duplicate independently. This results in a flood of duplicate replies being delivered to the channel.

Reproduction

This has been observed on two separate channels within hours:

Case 1: Telegram (2026-03-31 ~17:36 JST)

  • A single Telegram message (message_id 6627) was injected dozens of times into the main session
  • SIGUSR restart did not resolve it; required /new session reset (3 times)

Case 2: Slack (2026-03-31 ~23:05–00:16 JST)

  • A single Slack message from a user in channel CXXXXXXXXXX was injected 4 times into the session
  • Each injection triggered a full agent response, resulting in 40+ delivered reply log entries over ~1 hour
  • Gateway restart and session reset did not prevent recurrence

Evidence from gateway.log

Slack duplicate deliveries (burst pattern, ~250ms apart):

23:26:35.196 [slack] delivered reply to channel:CXXXXXXXXXX
23:26:35.563 [slack] delivered reply to channel:CXXXXXXXXXX
23:26:35.814 [slack] delivered reply to channel:CXXXXXXXXXX
23:26:36.068 [slack] delivered reply to channel:CXXXXXXXXXX
23:26:36.717 [slack] delivered reply to channel:CXXXXXXXXXX

Session transcript shows same message injected 4 times:

{"ts":"2026-03-31T15:13:24.312Z","content":"System: [2026-04-01 00:04:48 GMT+9] Slack message in #channel from user: ..."}
{"ts":"2026-03-31T15:14:13.018Z","content":"System: [2026-04-01 00:04:48 GMT+9] Slack message in #channel from user: ..."}
{"ts":"2026-03-31T15:15:02.082Z","content":"System: [2026-04-01 00:04:48 GMT+9] Slack message in #channel from user: ..."}
{"ts":"2026-03-31T15:16:28.457Z","content":"System: [2026-04-01 00:04:48 GMT+9] Slack message in #channel from user: ..."}

Additional symptoms during the period:

  • WebSocket connections disconnecting/reconnecting every 30-60 seconds
  • Repeated live session model switch detected logs for multiple models cycling every 20-30s
  • [xai-auth] bootstrap config fallback: no config-backed key found logged every 20-30s (xAI not configured)
  • Discord health-monitor restart due to stale-socket

Environment

  • OpenClaw version: 2026.3.28 (f9b1079)
  • OS: macOS (Darwin arm64)
  • Channels affected: Telegram (polling), Slack (socket mode)
  • Agent: embedded

Expected Behavior

Each inbound message should be injected into the session exactly once, with deduplication preventing re-injection of already-processed messages.

Workaround

Currently the only mitigation is resetting the session via /new, but the issue can recur.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions