#57: {role: "user", content: "你收到了几次消息", timestamp: 1776369113901,…}content: "你收到了几次消息"idempote

1 messages · Page 1 of 1 (latest)

gusty gust
#

为什么会出现聊天消息重复发送

mellow starBOT
gentle runeBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

worldly fableBOT
#

常见原因就这几个:

  1. 同一条入站事件被重复投递/重连重试
    OpenClaw 正常会做短时去重,但如果上游或运行状态异常,还是可能重复触发。
    文档: https://docs.openclaw.ai/concepts/messages

  2. Discord 处理超时,导致重复回复
    这是比较常见的一个,日志里通常会看到:

  3. 实际上跑了多个 gateway / 重复监听器
    这样同一条消息会被两个实例同时处理。日志里常见:

#
  1. 如果你在自己写 agent / tool / plugin
    代码里已经用 message send 发了一次,又返回了一次普通回复,也会双发。

先别猜,先看这几个输出。麻烦贴一下:

openclaw --version
openclaw status --all
openclaw channels status --probe
openclaw logs --follow

然后复现一次重复发送,把那一小段日志贴出来。
如果你看到超时日志,我再帮你具体看是不是要调:

  • channels.discord.eventQueue.listenerTimeout
  • channels.discord.inboundWorker.runTimeoutMs
#

如果你愿意,也可以把相关配置片段一起贴出来,我帮你直接定位。

gusty gust
#

gateway connect failed: GatewayClientRequestError: pairing required
20:15:12+00:00 warn gateway {"subsystem":"gateway"} security audit: device access upgrade requested reason=scope-upgrade device=cbc3297b84ff9c5bb6d16bc860c851e43f7c70302cbb49003d7d5068694ea439 ip=unknown-ip auth=token roleFrom=operator roleTo=operator scopesFrom=operator.read scopesTo=operator.admin,operator.approvals,operator.pairing,operator.read,operator.talk.secrets,operator.write client=cli conn=ecc88e44-00a0-4dbc-aa49-203e7e78fbcb
20:15:12+00:00 error gateway connect failed: GatewayClientRequestError: pairing required
20:15:12+00:00 error gateway connect failed: GatewayClientRequestError: pairing required
gateway connect failed: GatewayClientRequestError: pairing required

worldly fableBOT
#

这段日志本身不是“聊天消息被重复发送”,而是 设备权限升级没批准,CLI 在重复重连

关键信息是这句:

reason=scope-upgrade
scopesFrom=operator.read
scopesTo=operator.admin,operator.approvals,operator.pairing,operator.read,operator.talk.secrets,operator.write

意思是:

  • 这个设备当前只有 operator.read
  • 你现在执行的操作需要更高权限
  • gateway 因此发起了一个 scope upgrade 配对请求
  • 在你批准之前,每次重试都会报
    GatewayClientRequestError: pairing required
#

所以你看到的是重复的连接失败日志,不是同一条聊天真的被发了很多次。

先这样处理:

openclaw devices list
openclaw devices approve <requestId>

如果是本机 loopback 场景,这两个命令通常就够。
文档:

如果你批准后,聊天里仍然真的会双发,那就再看另外两类常见原因:

  1. Discord handler 超时后重试
gusty gust
#


gateway connect failed: GatewayClientRequestError: pairing required

Direct scope access failed; using local fallback.
Pending (1)
┌─────────────┬────────┬────────┬────────┬────────────┬────────┬────────┐
│ Request │ Device │ Role │ Scopes │ IP │ Age │ Flags │
├─────────────┼────────┼────────┼────────┼────────────┼────────┼────────┤
│ d75f9e0e- │ cbc329 │ operat │ operat │ │ 3m ago │ repair │
│ 6e55-43e5- │ 7b84ff │ or │ or. │ │ │ │
│ 8869- │ 9c5bb6 │ │ admin, │ │ │ │
│ 747c3d3ac0c │ d16bc8 │ │ operat │ │ │ │
│ 5 │ 60c851 │ │ or. │ │ │ │
│ │ e43f7c │ │ read, │ │ │ │
│ │ 70302c │ │ operat │ │ │ │
│ │ bb4900 │ │ or. │ │ │ │
│ │ 3d7d50 │ │ write, │ │ │ │
│ │ 68694e │ │ operat │ │ │ │
│ │ a439 │ │ or. │ │ │ │
│ │ │ │ approv │ │ │ │
│ │ │ │ als, │ │ │ │
│ │ │ │ operat │ │ │ │
│ │ │ │ or. │ │ │ │
│ │ │ │ pairin │ │ │ │
│ │ │ │ g, │ │ │ │
│ │ │ │ operat │ │ │ │
│ │ │ │ or. │ │ │ │
│ │ │ │ talk. │ │ │ │
│ │ │ │ secret │ │ │ │
│ │ │ │ s │ │ │ │
└─
Paired (4)

worldly fableBOT
#

对,就是这条 pending request。

这是同一个设备的权限修复/升级请求,不是新的聊天消息重复发送。
Flags: repair 也说明它是在修复现有设备授权。

直接批准它就行:

openclaw devices approve d75f9e0e-6e55-43e5-8869-747c3d3ac0c5

然后再重试你刚才的操作。

补充一点:

  • 你现在看到 Direct scope access failed; using local fallback.,说明 CLI 已经在走本地回退
  • 所以这条 approve 命令最好就在 gateway 所在机器 上执行