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

推荐订阅源

aimingoo的专栏
aimingoo的专栏
I
InfoQ
B
Blog RSS Feed
D
Docker
GbyAI
GbyAI
N
Netflix TechBlog - Medium
Y
Y Combinator Blog
F
Fortinet All Blogs
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
人人都是产品经理
人人都是产品经理
Martin Fowler
Martin Fowler
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
M
MIT News - Artificial intelligence
C
Check Point Blog
Vercel News
Vercel News
云风的 BLOG
云风的 BLOG
博客园 - Franky
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
Last Week in AI
Last Week in AI
L
LangChain Blog

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
test: dedupe zalo group gating mock calls · openclaw/open...
steipete · 2026-05-12 · via Recent Commits to openclaw:main

@@ -54,6 +54,32 @@ function createConfig(): OpenClawConfig {

54545555

const createRuntimeEnv = () => createZalouserRuntimeEnv();

565657+

type DispatchReplyCallArg = {

58+

ctx?: {

59+

Body?: string;

60+

BodyForCommands?: string;

61+

CommandAuthorized?: boolean;

62+

CommandBody?: string;

63+

InboundHistory?: unknown;

64+

OriginatingTo?: string;

65+

SessionKey?: string;

66+

To?: string;

67+

WasMentioned?: boolean;

68+

};

69+

};

70+71+

function mockCallArg(mock: unknown, label: string, index = 0) {

72+

const call = (mock as { mock?: { calls?: unknown[][] } }).mock?.calls?.at(index);

73+

if (!call) {

74+

throw new Error(`Expected ${label} call ${index + 1}`);

75+

}

76+

return call[0];

77+

}

78+79+

function dispatchReplyCall(mock: unknown, index = 0): DispatchReplyCallArg {

80+

return mockCallArg(mock, "dispatch reply", index) as DispatchReplyCallArg;

81+

}

82+5783

function installRuntime(params: {

5884

commandAuthorized?: boolean;

5985

replyPayload?: { text?: string; mediaUrl?: string; mediaUrls?: string[] };

@@ -414,7 +440,7 @@ describe("zalouser monitor group mention gating", () => {

414440

});

415441

expect(dispatchReplyWithBufferedBlockDispatcher).toHaveBeenCalledTimes(1);

416442

expect(resolveCommandAuthorizedFromAuthorizers).not.toHaveBeenCalled();

417-

const callArg = dispatchReplyWithBufferedBlockDispatcher.mock.calls[0]?.[0];

443+

const callArg = dispatchReplyCall(dispatchReplyWithBufferedBlockDispatcher);

418444

expect(callArg?.ctx?.CommandAuthorized).toBe(params.expectedCommandAuthorized);

419445

}

420446

@@ -492,7 +518,7 @@ describe("zalouser monitor group mention gating", () => {

492518

message: createGroupMessage(params.message),

493519

});

494520

expect(dispatchReplyWithBufferedBlockDispatcher).toHaveBeenCalledTimes(1);

495-

return dispatchReplyWithBufferedBlockDispatcher.mock.calls[0]?.[0];

521+

return dispatchReplyCall(dispatchReplyWithBufferedBlockDispatcher);

496522

}

497523498524

it("skips unmentioned group messages when requireMention=true", async () => {

@@ -748,7 +774,7 @@ describe("zalouser monitor group mention gating", () => {

748774

dangerouslyAllowNameMatching: true,

749775

expectedDispatches: 1,

750776

});

751-

const callArg = dispatchReplyWithBufferedBlockDispatcher.mock.calls[0]?.[0];

777+

const callArg = dispatchReplyCall(dispatchReplyWithBufferedBlockDispatcher);

752778

expect(callArg?.ctx?.To).toBe("zalouser:group:g-attacker-001");

753779

});

754780

@@ -806,12 +832,17 @@ describe("zalouser monitor group mention gating", () => {

806832

const { dispatchReplyWithBufferedBlockDispatcher, resolveAgentRoute, buildAgentSessionKey } =

807833

await processOpenDmMessage();

808834809-

const routeInput = resolveAgentRoute.mock.calls[0]?.[0];

835+

const routeInput = mockCallArg(resolveAgentRoute, "resolve agent route") as {

836+

peer?: unknown;

837+

};

810838

expect(routeInput?.peer).toEqual({ kind: "direct", id: "321" });

811-

const sessionKeyInput = buildAgentSessionKey.mock.calls[0]?.[0];

839+

const sessionKeyInput = mockCallArg(buildAgentSessionKey, "build agent session key") as {

840+

dmScope?: string;

841+

peer?: unknown;

842+

};

812843

expect(sessionKeyInput?.peer).toEqual({ kind: "direct", id: "321" });

813844

expect(sessionKeyInput?.dmScope).toBe("per-channel-peer");

814-

const callArg = dispatchReplyWithBufferedBlockDispatcher.mock.calls[0]?.[0];

845+

const callArg = dispatchReplyCall(dispatchReplyWithBufferedBlockDispatcher);

815846

expect(callArg?.ctx?.SessionKey).toBe("agent:main:zalouser:direct:321");

816847

});

817848

@@ -821,7 +852,7 @@ describe("zalouser monitor group mention gating", () => {

821852

input?.sessionKey === "agent:main:zalouser:group:321" ? 123 : undefined,

822853

});

823854824-

const callArg = dispatchReplyWithBufferedBlockDispatcher.mock.calls[0]?.[0];

855+

const callArg = dispatchReplyCall(dispatchReplyWithBufferedBlockDispatcher);

825856

expect(callArg?.ctx?.SessionKey).toBe("agent:main:zalouser:group:321");

826857

});

827858

@@ -907,15 +938,15 @@ describe("zalouser monitor group mention gating", () => {

907938

historyState,

908939

});

909940

expect(dispatchReplyWithBufferedBlockDispatcher).toHaveBeenCalledTimes(1);

910-

const firstDispatch = dispatchReplyWithBufferedBlockDispatcher.mock.calls[0]?.[0];

941+

const firstDispatch = dispatchReplyCall(dispatchReplyWithBufferedBlockDispatcher);

911942

expect(firstDispatch?.ctx?.InboundHistory).toEqual([

912943

{

913944

sender: "Alice",

914945

body: "first unmentioned line",

915946

timestamp: 1700000000000,

916947

},

917948

]);

918-

expect(String(firstDispatch?.ctx?.Body ?? "")).toContain("first unmentioned line");

949+

expect(firstDispatch?.ctx?.Body ?? "").toContain("first unmentioned line");

919950920951

await __testing.processMessage({

921952

message: createGroupMessage({

@@ -929,7 +960,7 @@ describe("zalouser monitor group mention gating", () => {

929960

historyState,

930961

});

931962

expect(dispatchReplyWithBufferedBlockDispatcher).toHaveBeenCalledTimes(2);

932-

const secondDispatch = dispatchReplyWithBufferedBlockDispatcher.mock.calls[1]?.[0];

963+

const secondDispatch = dispatchReplyCall(dispatchReplyWithBufferedBlockDispatcher, 1);

933964

expect(secondDispatch?.ctx?.InboundHistory).toStrictEqual([]);

934965

});

935966

});