openclaw - ✅(Solved) Fix [Bug] Cron Job 使用错误的飞书账号发送消息 - 缺少 accountId 自动推断 [2 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#49507Fetched 2026-04-08 00:54:32
View on GitHub
Comments
2
Participants
3
Timeline
7
Reactions
0
Timeline (top)
commented ×2cross-referenced ×2mentioned ×1referenced ×1

Fix Action

Fixed

PR fix notes

PR #49623: fix(cron): auto-infer accountId from agentId when not set

Description (problem / solution / changelog)

Summary

  • When a cron job has agentId set but no accountId, the system previously used the wrong (default) account to send messages via Feishu/Lark and other channels.
  • Added a fallback in resolveDeliveryTarget that infers accountId from agentId when no explicit accountId, session-derived accountId, or binding-derived accountId is available.
  • The explicit jobPayload.accountId override still takes highest precedence, so existing behavior for jobs with an explicit account is unchanged.

Fixes #49507

Test plan

  • Verify that a cron job with agentId set but no accountId now sends messages using the agent's identity rather than the default account.
  • Verify that cron jobs with an explicit accountId still use that explicit value.
  • Verify that session-derived and binding-derived accountIds still take precedence over the agentId fallback.

🤖 Generated with Claude Code

Changed files

  • src/cron/isolated-agent/delivery-target.ts (modified, +7/-0)

PR #49633: fix(cron): auto-infer accountId from agentId when not set

Description (problem / solution / changelog)

Summary

  • When a cron job specifies agentId but not accountId, now uses the agentId value as the accountId
  • Prevents sending messages from the wrong account identity (e.g., wrong Feishu account)

Test plan

  • Create cron job with agentId but no accountId, verify correct account is used
  • Verify explicit accountId still takes precedence

Fixes #49507

🤖 Generated with Claude Code

Changed files

  • src/cron/isolated-agent/delivery-target.ts (modified, +7/-0)

Code Example

// 如果 agentId = "yaya-claw" 且 accountId 未设置
// 自动设置 accountId = "yaya-claw"
RAW_BUFFERClick to expand / collapse

问题描述

当创建 Cron Job 时,如果只设置了 agentId 但没有设置 accountId,系统会使用错误的飞书账号发送消息,导致身份混乱。

复现场景

  1. 创建 Yaya 每日提醒 Cron Job,设置 agentId: "yaya-claw" 但未设置 accountId
  2. 定时任务触发时,系统使用默认账号(可能是其他用户的账号)发送消息
  3. 结果:Yaya 收到了用其他用户身份发送的消息

影响

  • Cron Job 使用错误的飞书账号发送消息
  • Cron Job 执行时使用错误的 agent 身份,导致读取数据权限错乱

解决方案建议

方案:自动推断 accountId

当 Cron Job 有 agentId 但没有 accountId 时,自动使用相同的值作为 accountId

// 如果 agentId = "yaya-claw" 且 accountId 未设置
// 自动设置 accountId = "yaya-claw"

修复的配置示例

Cron Job修复前修复后
Yaya 每日提醒agentId: (默认main)agentId: "yaya-claw", accountId: "yaya-claw"
Coco 早上任务清单accountId: 缺失accountId: "coco-claw"
社会创新+AI日报channel: "last"channel: "feishu", accountId: "default"

相关环境

  • Platform: macOS
  • OpenClaw 版本: 2026.3.13
  • 飞书集成: 是

发现者: @kennychoi 日期: 2026-03-18

extent analysis

Fix Plan

To fix the issue, we need to automatically infer the accountId when it's not set. We can achieve this by using the same value as agentId for accountId when accountId is not provided.

Code Changes

// Check if accountId is not set
if (!accountId) {
  // Use agentId as accountId
  accountId = agentId;
}

Configuration Changes

Update the Cron Job configurations to include the inferred accountId value. For example:

const cronJobs = [
  {
    name: 'Yaya 每日提醒',
    agentId: 'yaya-claw',
    accountId: 'yaya-claw' // inferred from agentId
  },
  {
    name: 'Coco 早上任务清单',
    agentId: 'coco-claw',
    accountId: 'coco-claw' // inferred from agentId
  }
];

Verification

To verify that the fix worked, create a new Cron Job with only agentId set and check if the correct accountId is used when sending messages.

Extra Tips

  • Make sure to update the documentation to reflect the new behavior of inferring accountId from agentId.
  • Consider adding a validation check to ensure that agentId and accountId are not empty or null when creating a new Cron Job.

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