openclaw - 💡(How to fix) Fix Cron delivery accountId 配置被群路由绑定覆盖 [1 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#63205Fetched 2026-04-09 07:57:01
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Code Example

"bindings": [
     { "agentId": "main", "match": { "channel": "feishu" } },
     { "agentId": "himeko", "match": { "channel": "feishu", "accountId": "himeko" } }
   ]

---

"delivery": {
     "mode": "announce",
     "channel": "feishu",
     "to": "oc_xxx",
     "accountId": "default"
   }

---

message({ accountId: "default", target: "oc_xxx", message: "测试" })

---

let accountId = (typeof jobPayload.accountId === "string" && jobPayload.accountId.trim() ? jobPayload.accountId.trim() : void 0) ?? resolved.accountId;
if (!accountId && channel) {
    const boundAccounts = buildChannelAccountBindings(cfg).get(channel)?.get(normalizeAgentId(agentId));
    if (boundAccounts && boundAccounts.length > 0) accountId = boundAccounts[0];
}
if (jobPayload.accountId) accountId = jobPayload.accountId;
RAW_BUFFERClick to expand / collapse

Bug 描述

Cron 任务的 delivery.accountId 配置在发送到飞书群时没有生效,而是使用了群路由绑定的账号。

复现步骤

  1. 配置多个飞书账号(如 defaulthimeko
  2. 在飞书群中添加多个机器人(default 和 himeko 机器人都在群里)
  3. 配置路由绑定:
    "bindings": [
      { "agentId": "main", "match": { "channel": "feishu" } },
      { "agentId": "himeko", "match": { "channel": "feishu", "accountId": "himeko" } }
    ]
  4. 创建 cron 任务,指定 accountId: "default" 发送到群:
    "delivery": {
      "mode": "announce",
      "channel": "feishu",
      "to": "oc_xxx",
      "accountId": "default"
    }
  5. 执行 cron 任务

预期行为

消息应该使用 default 账号(昔涟机器人)发送到群。

实际行为

消息使用了 himeko 账号发送到群,忽略了 delivery.accountId 配置。

验证

使用 message 工具直接发送可以正常工作:

message({ accountId: "default", target: "oc_xxx", message: "测试" })

消息成功由 default 账号发送。

分析

问题出在 resolveDeliveryTarget 函数(server.impl-WjqjRArz.js 第 4946 行附近):

let accountId = (typeof jobPayload.accountId === "string" && jobPayload.accountId.trim() ? jobPayload.accountId.trim() : void 0) ?? resolved.accountId;
if (!accountId && channel) {
    const boundAccounts = buildChannelAccountBindings(cfg).get(channel)?.get(normalizeAgentId(agentId));
    if (boundAccounts && boundAccounts.length > 0) accountId = boundAccounts[0];
}
if (jobPayload.accountId) accountId = jobPayload.accountId;

虽然最后一行会重新赋值,但在群聊场景下,可能有其他逻辑覆盖了 accountId。

环境

  • OpenClaw 版本:2026.4.8 (9ece252)
  • 操作系统:macOS
  • 飞书插件:openclaw-lark

临时解决方案

将 delivery 目标改为私聊(to: "user:ou_xxx")可以正常使用指定的 accountId。

extent analysis

TL;DR

Modify the resolveDeliveryTarget function to correctly handle accountId configuration for group messages.

Guidance

  • Review the resolveDeliveryTarget function in server.impl-WjqjRArz.js around line 4946 to ensure it correctly prioritizes the accountId from the jobPayload for group messages.
  • Verify that the buildChannelAccountBindings function is not overriding the accountId in the group chat scenario.
  • Test the resolveDeliveryTarget function with different jobPayload configurations to identify the root cause of the issue.
  • Consider adding a conditional statement to handle group messages separately and ensure the accountId from the jobPayload is used.

Example

if (channel === 'feishu' && jobPayload.to.startsWith('oc_')) {
  // Handle group messages separately
  accountId = jobPayload.accountId;
} else {
  // Existing logic
}

Notes

The issue seems to be related to the resolveDeliveryTarget function not correctly handling the accountId configuration for group messages. The provided code snippet and analysis suggest that the accountId is being overridden in the group chat scenario.

Recommendation

Apply a workaround by modifying the resolveDeliveryTarget function to correctly handle accountId configuration for group messages, as the root cause of the issue is likely related to this function.

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