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

推荐订阅源

有赞技术团队
有赞技术团队
Martin Fowler
Martin Fowler
N
Netflix TechBlog - Medium
WordPress大学
WordPress大学
罗磊的独立博客
H
Help Net Security
MongoDB | Blog
MongoDB | Blog
A
About on SuperTechFans
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
Docker
云风的 BLOG
云风的 BLOG
Microsoft Security Blog
Microsoft Security Blog
Blog — PlanetScale
Blog — PlanetScale
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
I
InfoQ
J
Java Code Geeks
博客园 - 聂微东
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
美团技术团队
小众软件
小众软件
Stack Overflow Blog
Stack Overflow Blog
C
Check Point 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
fix(feishu): suppress late streaming card finals (#72294)...
MonkeyLeeT · 2026-04-29 · via Recent Commits to openclaw:main

@@ -399,6 +399,46 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {

399399

expect(sendStructuredCardFeishuMock).not.toHaveBeenCalled();

400400

});

401401402+

it("skips distinct late final text after streaming card close", async () => {

403+

resolveFeishuAccountMock.mockReturnValue({

404+

accountId: "main",

405+

appId: "app_id",

406+

appSecret: "app_secret",

407+

domain: "feishu",

408+

config: {

409+

renderMode: "card",

410+

streaming: true,

411+

},

412+

});

413+414+

const { options } = createDispatcherHarness({

415+

runtime: createRuntimeLogger(),

416+

});

417+418+

await options.deliver({ text: "First complete answer" }, { kind: "final" });

419+

await options.onIdle?.();

420+

await options.deliver(

421+

{ text: "Late tool-result final", mediaUrl: "https://example.com/a.png" },

422+

{ kind: "final" },

423+

);

424+

await options.onIdle?.();

425+426+

expect(streamingInstances).toHaveLength(1);

427+

expect(streamingInstances[0].close).toHaveBeenCalledTimes(1);

428+

expect(streamingInstances[0].close).toHaveBeenCalledWith("First complete answer", {

429+

note: "Agent: agent",

430+

});

431+

expect(sendMessageFeishuMock).not.toHaveBeenCalled();

432+

expect(sendMarkdownCardFeishuMock).not.toHaveBeenCalled();

433+

expect(sendStructuredCardFeishuMock).not.toHaveBeenCalled();

434+

expect(sendMediaFeishuMock).toHaveBeenCalledTimes(1);

435+

expect(sendMediaFeishuMock).toHaveBeenCalledWith(

436+

expect.objectContaining({

437+

mediaUrl: "https://example.com/a.png",

438+

}),

439+

);

440+

});

441+402442

it("suppresses duplicate final text while still sending media", async () => {

403443

const options = setupNonStreamingAutoDispatcher();

404444

await options.deliver({ text: "plain final" }, { kind: "final" });

@@ -918,6 +958,86 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {

918958

});

919959

});

920960961+

it("does not suppress a later final after error closeout", async () => {

962+

resolveFeishuAccountMock.mockReturnValue({

963+

accountId: "main",

964+

appId: "app_id",

965+

appSecret: "app_secret",

966+

domain: "feishu",

967+

config: {

968+

renderMode: "card",

969+

streaming: true,

970+

},

971+

});

972+

sendMediaFeishuMock.mockRejectedValueOnce(new Error("media failed"));

973+974+

const { options } = createDispatcherHarness({

975+

runtime: createRuntimeLogger(),

976+

});

977+978+

await expect(

979+

options.deliver(

980+

{ text: "First answer", mediaUrl: "https://example.com/a.png" },

981+

{ kind: "final" },

982+

),

983+

).rejects.toThrow("media failed");

984+

await Promise.all([

985+

options.onError?.(new Error("media failed"), { kind: "final" }),

986+

options.onIdle?.(),

987+

]);

988+

await options.deliver({ text: "Second answer" }, { kind: "final" });

989+

await options.onIdle?.();

990+991+

expect(streamingInstances).toHaveLength(2);

992+

expect(streamingInstances[0].close).toHaveBeenCalledWith("First answer", {

993+

note: "Agent: agent",

994+

});

995+

expect(streamingInstances[1].close).toHaveBeenCalledWith("Second answer", {

996+

note: "Agent: agent",

997+

});

998+

expect(sendMessageFeishuMock).not.toHaveBeenCalled();

999+

expect(sendStructuredCardFeishuMock).not.toHaveBeenCalled();

1000+

});

1001+1002+

it("does not suppress a recovery final after late media failure", async () => {

1003+

resolveFeishuAccountMock.mockReturnValue({

1004+

accountId: "main",

1005+

appId: "app_id",

1006+

appSecret: "app_secret",

1007+

domain: "feishu",

1008+

config: {

1009+

renderMode: "card",

1010+

streaming: true,

1011+

},

1012+

});

1013+1014+

const { options } = createDispatcherHarness({

1015+

runtime: createRuntimeLogger(),

1016+

});

1017+1018+

await options.deliver({ text: "First answer" }, { kind: "final" });

1019+

await options.onIdle?.();

1020+

sendMediaFeishuMock.mockRejectedValueOnce(new Error("media failed"));

1021+

await expect(

1022+

options.deliver(

1023+

{ text: "Late attachment", mediaUrl: "https://example.com/a.png" },

1024+

{ kind: "final" },

1025+

),

1026+

).rejects.toThrow("media failed");

1027+

await options.onError?.(new Error("media failed"), { kind: "final" });

1028+

await options.deliver({ text: "Recovered answer" }, { kind: "final" });

1029+

await options.onIdle?.();

1030+1031+

expect(streamingInstances).toHaveLength(2);

1032+

expect(streamingInstances[0].close).toHaveBeenCalledWith("First answer", {

1033+

note: "Agent: agent",

1034+

});

1035+

expect(streamingInstances[1].close).toHaveBeenCalledWith("Recovered answer", {

1036+

note: "Agent: agent",

1037+

});

1038+

expect(sendStructuredCardFeishuMock).not.toHaveBeenCalled();

1039+

});

1040+9211041

it("cleans streaming state even when close throws", async () => {

9221042

const origPush = streamingInstances.push.bind(streamingInstances);

9231043

streamingInstances.push = (...args: StreamingSessionStub[]) => {