Skip to content

Commit fa47f74

Browse files
Mark LTakhoffman
andauthored
Feishu: normalize group announce targets to chat ids (#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 <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
1 parent ac11f0a commit fa47f74

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ Docs: https://docs.openclaw.ai
182182
- 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.
183183
- Security/Compaction audit: remove the post-compaction audit injection message. (#28507) Thanks @fuller-stack-dev and @vincentkoc.
184184
- 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.
185+
- 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.
185186
- 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.
186187
- 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.
187188
- 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.

extensions/feishu/src/targets.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ describe("resolveReceiveIdType", () => {
1818
expect(resolveReceiveIdType("group:oc_123")).toBe("chat_id");
1919
});
2020

21+
it("treats explicit channel targets as chat_id", () => {
22+
expect(resolveReceiveIdType("channel:oc_123")).toBe("chat_id");
23+
});
24+
2125
it("treats dm-prefixed open IDs as open_id", () => {
2226
expect(resolveReceiveIdType("dm:ou_123")).toBe("open_id");
2327
});
@@ -33,8 +37,11 @@ describe("normalizeFeishuTarget", () => {
3337
expect(normalizeFeishuTarget("feishu:chat:oc_123")).toBe("oc_123");
3438
});
3539

36-
it("strips provider and group prefixes", () => {
40+
it("normalizes group/channel prefixes to chat ids", () => {
41+
expect(normalizeFeishuTarget("group:oc_123")).toBe("oc_123");
3742
expect(normalizeFeishuTarget("feishu:group:oc_123")).toBe("oc_123");
43+
expect(normalizeFeishuTarget("channel:oc_456")).toBe("oc_456");
44+
expect(normalizeFeishuTarget("lark:channel:oc_456")).toBe("oc_456");
3845
});
3946

4047
it("accepts provider-prefixed raw ids", () => {
@@ -55,7 +62,9 @@ describe("looksLikeFeishuId", () => {
5562
expect(looksLikeFeishuId("lark:chat:oc_123")).toBe(true);
5663
});
5764

58-
it("accepts provider-prefixed group targets", () => {
65+
it("accepts group/channel targets", () => {
5966
expect(looksLikeFeishuId("feishu:group:oc_123")).toBe(true);
67+
expect(looksLikeFeishuId("group:oc_123")).toBe(true);
68+
expect(looksLikeFeishuId("channel:oc_456")).toBe(true);
6069
});
6170
});

extensions/feishu/src/targets.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ export function normalizeFeishuTarget(raw: string): string | null {
3636
if (lowered.startsWith("group:")) {
3737
return withoutProvider.slice("group:".length).trim() || null;
3838
}
39+
if (lowered.startsWith("channel:")) {
40+
return withoutProvider.slice("channel:".length).trim() || null;
41+
}
3942
if (lowered.startsWith("user:")) {
4043
return withoutProvider.slice("user:".length).trim() || null;
4144
}
@@ -87,7 +90,7 @@ export function looksLikeFeishuId(raw: string): boolean {
8790
if (!trimmed) {
8891
return false;
8992
}
90-
if (/^(chat|group|user|dm|open_id):/i.test(trimmed)) {
93+
if (/^(chat|group|channel|user|dm|open_id):/i.test(trimmed)) {
9194
return true;
9295
}
9396
if (trimmed.startsWith(CHAT_ID_PREFIX)) {

0 commit comments

Comments
 (0)