openclaw/src
Runkun Miao 7c6f8bfe73
feat(feishu): add broadcast support for multi-agent groups (#29575)
* feat(feishu): add broadcast support for multi-agent group observation

When multiple agents share a Feishu group chat, only the @mentioned
agent receives the message. This prevents observer agents from building
session memory of group activity they weren't directly addressed in.

Adds broadcast support (reusing the same cfg.broadcast schema as
WhatsApp) so all configured agents receive every group message in their
session transcripts. Only the @mentioned agent responds on Feishu;
observer agents process silently via no-op dispatchers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(feishu): guard sequential broadcast dispatch against single-agent failure

Wrap each dispatchForAgent() call in the sequential loop with try/catch
so one agent's dispatch failure doesn't abort delivery to remaining agents.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(feishu): avoid duplicate messages in broadcast observer mode and normalize agent IDs

- Skip recordPendingHistoryEntryIfEnabled for broadcast groups when not
  mentioned, since the message is dispatched directly to all agents.
  Previously the message appeared twice in the agent prompt.
- Normalize agent IDs with toLowerCase() before membership checks so
  config casing mismatches don't silently skip valid agents.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(feishu): set WasMentioned per-agent and normalize broadcast IDs

- buildCtxPayloadForAgent now takes a wasMentioned parameter so active
  agents get WasMentioned=true and observers get false (P1 fix)
- Normalize broadcastAgents to lowercase at resolution time and
  lowercase activeAgentId so all comparisons and session key generation
  use canonical IDs regardless of config casing (P2 fix)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(feishu): canonicalize broadcast agent IDs with normalizeAgentId

* fix(feishu): match ReplyDispatcher sync return types for noop dispatcher

The upstream ReplyDispatcher changed sendToolResult/sendBlockReply/
sendFinalReply to synchronous (returning boolean). Update the broadcast
observer noop dispatcher to match.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(feishu): deduplicate broadcast agent IDs after normalization

Config entries like "Main" and "main" collapse to the same canonical ID
after normalizeAgentId but were dispatched multiple times. Use Set to
deduplicate after normalization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(feishu): honor requireMention=false when selecting broadcast responder

When requireMention is false, the routed agent should be active (reply
on Feishu) even without an explicit @mention. Previously activeAgentId
was null whenever ctx.mentionedBot was false, so all agents got the
noop dispatcher and no reply was sent — silently breaking groups that
disabled mention gating.

Hoist requireMention out of the if(isGroup) block so it's accessible
in the dispatch code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(feishu): cross-account broadcast dedup to prevent duplicate dispatches

In multi-account Feishu setups, the same message event is delivered to
every bot account in a group. Without cross-account dedup, each account
independently dispatches broadcast agents, causing 2×N dispatches instead
of N (where N = number of broadcast agents).

Two changes:
1. requireMention=true + bot not mentioned: return early instead of
   falling through to broadcast. The mentioned bot's handler will
   dispatch for all agents. Non-mentioned handlers record to history.
2. Add cross-account broadcast dedup using a shared 'broadcast' namespace
   (tryRecordMessagePersistent). The first handler to reach the broadcast
   block claims the message; subsequent accounts skip. This handles the
   requireMention=false multi-account case.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(feishu): strip CommandAuthorized from broadcast observer contexts

Broadcast observer agents inherited CommandAuthorized from the sender,
causing slash commands (e.g. /reset) to silently execute on every observer
session. Now only the active agent retains CommandAuthorized; observers
have it stripped before dispatch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(feishu): use actual mention state for broadcast WasMentioned

The active broadcast agent's WasMentioned was set to true whenever
requireMention=false, even when the bot was not actually @mentioned.
Now uses ctx.mentionedBot && agentId === activeAgentId, consistent
with the single-agent path which passes ctx.mentionedBot directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(feishu): skip history buffer for broadcast accounts and log parallel failures

1. In requireMention groups with broadcast, non-mentioned accounts no
   longer buffer pending history — the mentioned handler's broadcast
   dispatch already writes turns into all agent sessions. Buffering
   caused duplicate replay via buildPendingHistoryContextFromMap.

2. Parallel broadcast dispatch now inspects Promise.allSettled results
   and logs rejected entries, matching the sequential path's per-agent
   error logging.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Changelog: note Feishu multi-agent broadcast dispatch

* Changelog: restore author credit for Feishu broadcast entry

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
2026-03-02 21:38:46 -06:00
..
acp feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
agents fix(venice): retry model discovery on transient fetch failures 2026-03-03 03:21:00 +00:00
auto-reply refactor(acp): dedupe runtime option command plumbing 2026-03-03 02:53:13 +00:00
browser refactor(browser): dedupe playwright interaction helpers 2026-03-03 02:53:13 +00:00
canvas-host refactor(tests): dedupe canvas host server setup 2026-03-03 02:53:13 +00:00
channels feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
cli feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
commands feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
compat
config feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
cron refactor(tests): dedupe cron store migration setup 2026-03-03 01:54:27 +00:00
daemon refactor: split slack/discord/session maintenance helpers 2026-03-02 23:07:20 +00:00
discord feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
docs
gateway fix(gateway): retry exec-read live tool probe 2026-03-03 03:36:55 +00:00
hooks refactor(hooks): dedupe install parameter wiring 2026-03-03 01:06:00 +00:00
i18n fix(ci): resolve i18n typing and generated-policy drift 2026-03-02 04:29:18 +00:00
imessage refactor: unify inbound debounce policy and split gateway/models helpers 2026-03-03 00:54:33 +00:00
infra fix(ci): tighten type signatures in gateway params validation 2026-03-03 03:04:13 +00:00
line refactor: harden plugin install flow and main DM route pinning 2026-03-02 21:22:38 +00:00
link-understanding
logging CLI: dedupe config validate errors and expose allowed values 2026-03-02 20:05:12 -05:00
markdown refactor: dedupe gateway config and infra flows 2026-03-03 00:15:14 +00:00
media refactor(media): add shared ffmpeg helpers 2026-03-03 01:14:14 +00:00
media-understanding refactor(tests): dedupe media transcript echo config setup 2026-03-03 01:54:28 +00:00
memory test: fix strict runtime mock types in channel tests 2026-03-03 03:06:22 +00:00
node-host feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
pairing feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
plugin-sdk feat(feishu): add broadcast support for multi-agent groups (#29575) 2026-03-02 21:38:46 -06:00
plugins refactor: split plugin runtime type contracts 2026-03-03 02:37:23 +00:00
process refactor: dedupe cli config cron and install flows 2026-03-02 19:57:33 +00:00
providers refactor: dedupe agent and browser cli helpers 2026-03-03 00:15:00 +00:00
routing perf(runtime): reduce hot-path config and routing overhead 2026-03-03 00:20:46 +00:00
scripts test(ci): add changed-scope shell-injection regression 2026-03-03 03:34:51 +00:00
secrets feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
security feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
sessions fix: add runtime.events regression tests (#16044) (thanks @scifantastic) 2026-03-03 01:37:56 +00:00
shared refactor(nodes): dedupe camera payload and node resolve helpers 2026-03-02 23:32:41 +00:00
signal refactor: unify inbound debounce policy and split gateway/models helpers 2026-03-03 00:54:33 +00:00
slack feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
telegram fix(telegram): move unchanged command-sync log to verbose 2026-03-03 03:05:39 +00:00
terminal CLI: dedupe config validate errors and expose allowed values 2026-03-02 20:05:12 -05:00
test-helpers
test-utils refactor(test): extract cron issue-regression harness and frozen-time helper 2026-03-03 01:44:21 +00:00
tts feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
tui docs: tighten subscription guidance and update MiniMax M2.5 refs 2026-03-03 00:02:37 +00:00
types
utils docs: tighten subscription guidance and update MiniMax M2.5 refs 2026-03-03 00:02:37 +00:00
web refactor(channels): dedupe monitor message test flows 2026-03-03 01:06:00 +00:00
whatsapp refactor: dedupe channel outbound and monitor tests 2026-03-03 00:15:15 +00:00
wizard feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
channel-web.ts
docker-image-digests.test.ts
docker-setup.e2e.test.ts feat(docker): add opt-in sandbox support for Docker deployments (#29974) 2026-03-01 23:06:10 -08:00
dockerfile.test.ts fix(docker): correct awk quoting in Docker GPG fingerprint check (#32153) 2026-03-03 02:32:46 +00:00
entry.ts
extensionAPI.ts
globals.ts
index.ts
logger.test.ts
logger.ts refactor: dedupe agent and reply runtimes 2026-03-02 19:57:33 +00:00
logging.ts
polls.test.ts
polls.ts
runtime.ts
utils.test.ts
utils.ts
version.test.ts refactor: centralize delivery/path/media/version lifecycle 2026-03-02 04:04:36 +00:00
version.ts refactor: centralize delivery/path/media/version lifecycle 2026-03-02 04:04:36 +00:00