From fa47f74c0f3d58e193b37c0b685cc9bbb61f9964 Mon Sep 17 00:00:00 2001 From: Mark L <73659136+liuxiaopai-ai@users.noreply.github.com> Date: Tue, 3 Mar 2026 06:50:55 +0800 Subject: [PATCH] Feishu: normalize group announce targets to chat ids (openclaw#31546) thanks @liuxiaopai-ai Verified: - pnpm build - pnpm check (fails on unrelated existing main-branch lint violations in ui/src/ui/views/agents-utils.ts and src/pairing/pairing-store.ts) - pnpm test:macmini Co-authored-by: liuxiaopai-ai <73659136+liuxiaopai-ai@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> --- CHANGELOG.md | 1 + extensions/feishu/src/targets.test.ts | 13 +++++++++++-- extensions/feishu/src/targets.ts | 5 ++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e16eb02ad2a..741fc20f296 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -182,6 +182,7 @@ Docs: https://docs.openclaw.ai - Security/Feishu webhook ingress: bound unauthenticated webhook rate-limit state with stale-window pruning and a hard key cap to prevent unbounded pre-auth memory growth from rotating source keys. (#26050) Thanks @bmendonca3. - Security/Compaction audit: remove the post-compaction audit injection message. (#28507) Thanks @fuller-stack-dev and @vincentkoc. - Web tools/RFC2544 fake-IP compatibility: allow RFC2544 benchmark range (`198.18.0.0/15`) for trusted web-tool fetch endpoints so proxy fake-IP networking modes do not trigger false SSRF blocks. Landed from contributor PR #31176 by @sunkinux. Thanks @sunkinux. +- Feishu/Sessions announce group targets: normalize `group:` and `channel:` Feishu targets to `chat_id` routing so `sessions_send` announce delivery no longer sends group chat IDs via `user_id` API params. Fixes #31426. - Windows/Plugin install: avoid `spawn EINVAL` on Windows npm/npx invocations by resolving to `node` + npm CLI scripts instead of spawning `.cmd` directly. Landed from contributor PR #31147 by @codertony. Thanks @codertony. - Web UI/Cron: include configured agent model defaults/fallbacks in cron model suggestions so scheduled-job model autocomplete reflects configured models. (#29709) Thanks @Sid-Qin. - Cron/Delivery: disable the agent messaging tool when `delivery.mode` is `"none"` so cron output is not sent to Telegram or other channels. (#21808) Thanks @lailoo. diff --git a/extensions/feishu/src/targets.test.ts b/extensions/feishu/src/targets.test.ts index 657738f59fc..7295bf3fa0f 100644 --- a/extensions/feishu/src/targets.test.ts +++ b/extensions/feishu/src/targets.test.ts @@ -18,6 +18,10 @@ describe("resolveReceiveIdType", () => { expect(resolveReceiveIdType("group:oc_123")).toBe("chat_id"); }); + it("treats explicit channel targets as chat_id", () => { + expect(resolveReceiveIdType("channel:oc_123")).toBe("chat_id"); + }); + it("treats dm-prefixed open IDs as open_id", () => { expect(resolveReceiveIdType("dm:ou_123")).toBe("open_id"); }); @@ -33,8 +37,11 @@ describe("normalizeFeishuTarget", () => { expect(normalizeFeishuTarget("feishu:chat:oc_123")).toBe("oc_123"); }); - it("strips provider and group prefixes", () => { + it("normalizes group/channel prefixes to chat ids", () => { + expect(normalizeFeishuTarget("group:oc_123")).toBe("oc_123"); expect(normalizeFeishuTarget("feishu:group:oc_123")).toBe("oc_123"); + expect(normalizeFeishuTarget("channel:oc_456")).toBe("oc_456"); + expect(normalizeFeishuTarget("lark:channel:oc_456")).toBe("oc_456"); }); it("accepts provider-prefixed raw ids", () => { @@ -55,7 +62,9 @@ describe("looksLikeFeishuId", () => { expect(looksLikeFeishuId("lark:chat:oc_123")).toBe(true); }); - it("accepts provider-prefixed group targets", () => { + it("accepts group/channel targets", () => { expect(looksLikeFeishuId("feishu:group:oc_123")).toBe(true); + expect(looksLikeFeishuId("group:oc_123")).toBe(true); + expect(looksLikeFeishuId("channel:oc_456")).toBe(true); }); }); diff --git a/extensions/feishu/src/targets.ts b/extensions/feishu/src/targets.ts index 524eda4a4ee..cf16a5cb871 100644 --- a/extensions/feishu/src/targets.ts +++ b/extensions/feishu/src/targets.ts @@ -36,6 +36,9 @@ export function normalizeFeishuTarget(raw: string): string | null { if (lowered.startsWith("group:")) { return withoutProvider.slice("group:".length).trim() || null; } + if (lowered.startsWith("channel:")) { + return withoutProvider.slice("channel:".length).trim() || null; + } if (lowered.startsWith("user:")) { return withoutProvider.slice("user:".length).trim() || null; } @@ -87,7 +90,7 @@ export function looksLikeFeishuId(raw: string): boolean { if (!trimmed) { return false; } - if (/^(chat|group|user|dm|open_id):/i.test(trimmed)) { + if (/^(chat|group|channel|user|dm|open_id):/i.test(trimmed)) { return true; } if (trimmed.startsWith(CHAT_ID_PREFIX)) {