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

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
B
Blog
A
About on SuperTechFans
大猫的无限游戏
大猫的无限游戏
爱范儿
爱范儿
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
H
Help Net Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
IT之家
IT之家
D
Docker
Google DeepMind News
Google DeepMind News
罗磊的独立博客
T
The Blog of Author Tim Ferriss
aimingoo的专栏
aimingoo的专栏
博客园 - 叶小钗
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
D
DataBreaches.Net
博客园 - 司徒正美
Engineering at Meta
Engineering at Meta

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(discord): merge media captions into one message (#864...
neeravmakwan · 2026-05-25 · via Recent Commits to openclaw:main

@@ -795,6 +795,19 @@ describe("block reply coalescer", () => {

795795

return { flushes, coalescer };

796796

}

797797798+

type FlushedPayload = Parameters<Parameters<typeof createBlockReplyCoalescer>[0]["onFlush"]>[0];

799+

function createPayloadCoalescerHarness<T>(pick: (payload: FlushedPayload) => T) {

800+

const flushes: T[] = [];

801+

const coalescer = createBlockReplyCoalescer({

802+

config: { minChars: 1, maxChars: 200, idleMs: 0, joiner: " " },

803+

shouldAbort: () => false,

804+

onFlush: (payload) => {

805+

flushes.push(pick(payload));

806+

},

807+

});

808+

return { flushes, coalescer };

809+

}

810+798811

it("coalesces chunks within the idle window", async () => {

799812

vi.useFakeTimers();

800813

const { flushes, coalescer } = createBlockCoalescerHarness({

@@ -967,26 +980,107 @@ describe("block reply coalescer", () => {

967980

}

968981

});

969982970-

it("flushes buffered text before media payloads", () => {

971-

const flushes: Array<{ text?: string; mediaUrls?: string[] }> = [];

972-

const coalescer = createBlockReplyCoalescer({

973-

config: { minChars: 1, maxChars: 200, idleMs: 0, joiner: " " },

974-

shouldAbort: () => false,

975-

onFlush: (payload) => {

976-

flushes.push({

977-

text: payload.text,

978-

mediaUrls: payload.mediaUrls,

979-

});

983+

it("merges compatible buffered text into following media payloads", async () => {

984+

const { flushes, coalescer } = createPayloadCoalescerHarness<{

985+

text?: string;

986+

mediaUrls?: string[];

987+

replyToId?: string;

988+

}>((payload) => ({

989+

text: payload.text,

990+

mediaUrls: payload.mediaUrls,

991+

replyToId: payload.replyToId,

992+

}));

993+994+

coalescer.enqueue({ text: "Hello", replyToId: "thread-1" });

995+

coalescer.enqueue({ text: "world" });

996+

coalescer.enqueue({ mediaUrls: ["https://example.com/a.png"] });

997+

await coalescer.flush({ force: true });

998+999+

expect(flushes).toEqual([

1000+

{

1001+

text: "Hello world",

1002+

mediaUrls: ["https://example.com/a.png"],

1003+

replyToId: "thread-1",

9801004

},

981-

});

1005+

]);

1006+

coalescer.stop();

1007+

});

9821008983-

coalescer.enqueue({ text: "Hello" });

984-

coalescer.enqueue({ text: "world" });

1009+

it("keeps reasoning text separate from media payloads", async () => {

1010+

const { flushes, coalescer } = createPayloadCoalescerHarness<{

1011+

text?: string;

1012+

mediaUrls?: string[];

1013+

isReasoning?: boolean;

1014+

}>((payload) => ({

1015+

text: payload.text,

1016+

mediaUrls: payload.mediaUrls,

1017+

isReasoning: payload.isReasoning,

1018+

}));

1019+1020+

coalescer.enqueue({ text: "hidden", isReasoning: true });

9851021

coalescer.enqueue({ mediaUrls: ["https://example.com/a.png"] });

986-

void coalescer.flush({ force: true });

1022+

await coalescer.flush({ force: true });

1023+1024+

expect(flushes).toEqual([

1025+

{ text: "hidden", mediaUrls: undefined, isReasoning: true },

1026+

{

1027+

text: undefined,

1028+

mediaUrls: ["https://example.com/a.png"],

1029+

isReasoning: undefined,

1030+

},

1031+

]);

1032+

coalescer.stop();

1033+

});

1034+1035+

it("keeps buffered text separate when media changes reply target", async () => {

1036+

const { flushes, coalescer } = createPayloadCoalescerHarness<{

1037+

text?: string;

1038+

mediaUrls?: string[];

1039+

replyToId?: string;

1040+

}>((payload) => ({

1041+

text: payload.text,

1042+

mediaUrls: payload.mediaUrls,

1043+

replyToId: payload.replyToId,

1044+

}));

1045+1046+

coalescer.enqueue({ text: "Unthreaded caption" });

1047+

coalescer.enqueue({ mediaUrls: ["https://example.com/a.png"], replyToId: "thread-2" });

1048+

await coalescer.flush({ force: true });

9871049988-

expect(flushes[0].text).toBe("Hello world");

989-

expect(flushes[1].mediaUrls).toEqual(["https://example.com/a.png"]);

1050+

expect(flushes).toEqual([

1051+

{ text: "Unthreaded caption", mediaUrls: undefined, replyToId: undefined },

1052+

{

1053+

text: undefined,

1054+

mediaUrls: ["https://example.com/a.png"],

1055+

replyToId: "thread-2",

1056+

},

1057+

]);

1058+

coalescer.stop();

1059+

});

1060+1061+

it("keeps text separate from voice media payloads", async () => {

1062+

const { flushes, coalescer } = createPayloadCoalescerHarness<{

1063+

text?: string;

1064+

mediaUrls?: string[];

1065+

audioAsVoice?: boolean;

1066+

}>((payload) => ({

1067+

text: payload.text,

1068+

mediaUrls: payload.mediaUrls,

1069+

audioAsVoice: payload.audioAsVoice,

1070+

}));

1071+1072+

coalescer.enqueue({ text: "Listen to this" });

1073+

coalescer.enqueue({ mediaUrls: ["https://example.com/a.ogg"], audioAsVoice: true });

1074+

await coalescer.flush({ force: true });

1075+1076+

expect(flushes).toEqual([

1077+

{ text: "Listen to this", mediaUrls: undefined, audioAsVoice: undefined },

1078+

{

1079+

text: undefined,

1080+

mediaUrls: ["https://example.com/a.ogg"],

1081+

audioAsVoice: true,

1082+

},

1083+

]);

9901084

coalescer.stop();

9911085

});

9921086

});