惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

有赞技术团队
有赞技术团队
小众软件
小众软件
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园_首页
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
Jina AI
Jina AI
博客园 - 【当耐特】
V
Visual Studio Blog
美团技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
量子位
IT之家
IT之家
G
Google Developers Blog
V
V2EX
The GitHub Blog
The GitHub Blog
月光博客
月光博客
GbyAI
GbyAI

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(whatsapp): detect group @mentions when self is in all...
juan-flores0 · 2026-04-29 · via Recent Commits to openclaw:main

@@ -6,6 +6,7 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest";

66

import { buildMentionConfig } from "./mentions.js";

77

import { applyGroupGating, type GroupHistoryEntry } from "./monitor/group-gating.js";

88

import { buildInboundLine, formatReplyContext } from "./monitor/message-line.js";

9+

import type { WebInboundMsg } from "./types.js";

9101011

let sessionDir: string | undefined;

1112

let sessionStorePath: string;

@@ -37,10 +38,11 @@ const makeConfig = (overrides: Record<string, unknown>) =>

37383839

async function runGroupGating(params: {

3940

cfg: import("openclaw/plugin-sdk/config-types").OpenClawConfig;

40-

msg: Record<string, unknown>;

41+

msg: WebInboundMsg;

4142

conversationId?: string;

4243

agentId?: string;

4344

selfChatMode?: boolean;

45+

authDir?: string;

4446

}) {

4547

const groupHistories = new Map<string, GroupHistoryEntry[]>();

4648

const conversationId = params.conversationId ?? "123@g.us";

@@ -49,12 +51,13 @@ async function runGroupGating(params: {

4951

const baseMentionConfig = buildMentionConfig(params.cfg, undefined);

5052

const result = await applyGroupGating({

5153

cfg: params.cfg,

52-

msg: params.msg as any,

54+

msg: params.msg,

5355

conversationId,

5456

groupHistoryKey: `whatsapp:default:group:${conversationId}`,

5557

agentId,

5658

sessionKey,

5759

baseMentionConfig,

60+

authDir: params.authDir,

5861

selfChatMode: params.selfChatMode,

5962

groupHistories,

6063

groupHistoryLimit: 10,

@@ -65,21 +68,22 @@ async function runGroupGating(params: {

6568

return { result, groupHistories };

6669

}

677068-

function createGroupMessage(overrides: Record<string, unknown> = {}) {

71+

function createGroupMessage(overrides: Partial<WebInboundMsg> = {}): WebInboundMsg {

6972

return {

7073

id: "g1",

7174

from: "123@g.us",

7275

conversationId: "123@g.us",

7376

chatId: "123@g.us",

7477

chatType: "group",

7578

to: "+2",

79+

accountId: "default",

7680

body: "hello group",

7781

senderE164: "+111",

7882

senderName: "Alice",

7983

selfE164: "+999",

8084

sendComposing: async () => {},

81-

reply: async () => {},

82-

sendMedia: async () => {},

85+

reply: async (_text, _options) => {},

86+

sendMedia: async (_payload, _options) => {},

8387

...overrides,

8488

};

8589

}

@@ -194,6 +198,45 @@ describe("applyGroupGating", () => {

194198

expect(result.shouldProcess).toBe(true);

195199

});

196200201+

it("processes explicit group @mentions when self is in allowFrom (#49317)", async () => {

202+

if (!sessionDir) {

203+

throw new Error("sessionDir not initialized");

204+

}

205+

await fs.writeFile(

206+

path.join(sessionDir, "lid-mapping-216372600647751_reverse.json"),

207+

JSON.stringify("+15551234567"),

208+

);

209+

const cfg = makeConfig({

210+

channels: {

211+

whatsapp: {

212+

allowFrom: ["+15551234567"],

213+

groupPolicy: "open",

214+

groups: { "*": { requireMention: true } },

215+

},

216+

},

217+

});

218+

const msg = createGroupMessage({

219+

id: "g-self-lid-mention",

220+

accountId: "default",

221+

body: "@216372600647751 can you see this?",

222+

mentionedJids: ["216372600647751@lid"],

223+

senderE164: "+15550001111",

224+

senderName: "Alice",

225+

selfE164: "+15551234567",

226+

selfJid: "15551234567@s.whatsapp.net",

227+

});

228+229+

const { result, groupHistories } = await runGroupGating({

230+

cfg,

231+

authDir: sessionDir,

232+

msg,

233+

});

234+235+

expect(result.shouldProcess).toBe(true);

236+

expect(msg.wasMentioned).toBe(true);

237+

expect(groupHistories.get("whatsapp:default:group:123@g.us")).toBeUndefined();

238+

});

239+197240

it("honors per-account selfChatMode overrides before suppressing implicit mentions", async () => {

198241

const cfg = makeConfig({

199242

channels: {