openclaw/extensions
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
..
acpx feat(acp): add kimi harness support surfaces 2026-03-03 01:05:24 +00:00
bluebubbles test: fix strict runtime mock types in channel tests 2026-03-03 03:06:22 +00:00
copilot-proxy build: bump versions to 2026.3.2 2026-03-02 04:55:53 +00:00
device-pair feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
diagnostics-otel build: bump versions to 2026.3.2 2026-03-02 04:55:53 +00:00
diffs test(perf): trim fixed waits in relay and startup tests 2026-03-02 17:30:33 +00:00
discord build: bump versions to 2026.3.2 2026-03-02 04:55:53 +00:00
feishu feat(feishu): add broadcast support for multi-agent groups (#29575) 2026-03-02 21:38:46 -06:00
google-gemini-cli-auth chore: remove unreachable "LINUX" from resolvePlatform return type 2026-03-03 02:36:01 +00:00
googlechat feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
imessage fix(ci): align strict nullable typing across channels and ui 2026-03-02 09:56:14 +00:00
irc feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
line test(perf): trim fixed waits in relay and startup tests 2026-03-02 17:30:33 +00:00
llm-task build: bump versions to 2026.3.2 2026-03-02 04:55:53 +00:00
lobster refactor(gateway): hard-break plugin wildcard http handlers 2026-03-02 16:24:06 +00:00
matrix feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
mattermost feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
memory-core ci: fix lint and audit regressions on main 2026-03-02 23:08:23 +00:00
memory-lancedb fix: add regression for memory-lancedb dimensions pass-through (#32036) (thanks @scotthuang) 2026-03-02 19:02:11 +00:00
minimax-portal-auth feat(models): support minimax highspeed across onboarding 2026-03-03 00:40:15 +00:00
msteams feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
nextcloud-talk feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
nostr refactor(gateway): hard-break plugin wildcard http handlers 2026-03-02 16:24:06 +00:00
open-prose build: bump versions to 2026.3.2 2026-03-02 04:55:53 +00:00
phone-control refactor(gateway): harden plugin http route contracts 2026-03-02 16:48:00 +00:00
qwen-portal-auth refactor(extensions): dedupe channel config, onboarding, and monitors 2026-03-02 08:54:20 +00:00
shared fix(acpx): share windows wrapper resolver and add strict hardening mode 2026-03-01 23:57:06 +00:00
signal fix(ci): align strict nullable typing across channels and ui 2026-03-02 09:56:14 +00:00
slack fix(ci): align strict nullable typing across channels and ui 2026-03-02 09:56:14 +00:00
synology-chat fix(synology-chat): prevent restart loop in startAccount (#23074) 2026-03-02 20:06:16 +00:00
talk-voice feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
telegram fix: add regression tests for telegram token guard (#31973) (thanks @ningding97) 2026-03-02 18:33:49 +00:00
test-utils fix: resolve pi-tools typing regressions 2026-03-03 02:27:59 +00:00
thread-ownership test(extensions): cast fetch mocks to satisfy tsgo 2026-02-16 21:25:35 -05:00
tlon fix(security): pin tlon api source and secure hold music url 2026-03-03 01:45:24 +00:00
twitch build: bump versions to 2026.3.2 2026-03-02 04:55:53 +00:00
voice-call refactor(voice-call): unify runtime cleanup lifecycle 2026-03-03 02:51:17 +00:00
whatsapp refactor(extensions): dedupe channel config, onboarding, and monitors 2026-03-02 08:54:20 +00:00
zalo feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
zalouser fix: align gateway and zalouser typing imports 2026-03-02 22:29:18 +00:00