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

推荐订阅源

N
Netflix TechBlog - Medium
大猫的无限游戏
大猫的无限游戏
B
Blog
J
Java Code Geeks
T
Tailwind CSS Blog
腾讯CDC
A
About on SuperTechFans
GbyAI
GbyAI
H
Help Net Security
IT之家
IT之家
L
LangChain Blog
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
博客园 - 叶小钗
小众软件
小众软件
I
InfoQ
爱范儿
爱范儿
有赞技术团队
有赞技术团队
博客园 - 司徒正美
博客园 - 【当耐特】
Jina AI
Jina AI
D
Docker

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 reply tag mock reads · openclaw/openclaw@90e...
steipete · 2026-05-13 · via Recent Commits to openclaw:main

@@ -8,6 +8,24 @@ import {

88

import { subscribeEmbeddedPiSession } from "./pi-embedded-subscribe.js";

991010

describe("subscribeEmbeddedPiSession reply tags", () => {

11+

type ReplyPayload = { text?: string; replyToCurrent?: boolean; replyToTag?: boolean };

12+13+

function replyPayloadAt(mock: ReturnType<typeof vi.fn>, index: number): ReplyPayload {

14+

const call = mock.mock.calls[index];

15+

if (!call) {

16+

throw new Error(`expected reply payload at index ${index}`);

17+

}

18+

return call[0] as ReplyPayload;

19+

}

20+21+

function replyTexts(mock: ReturnType<typeof vi.fn>): string[] {

22+

return mock.mock.calls.map(([payload]) => (payload as ReplyPayload).text ?? "");

23+

}

24+25+

function lastReplyPayload(mock: ReturnType<typeof vi.fn>): ReplyPayload {

26+

return replyPayloadAt(mock, mock.mock.calls.length - 1);

27+

}

28+1129

function createBlockReplyHarness() {

1230

const { session, emit } = createStubSessionHarness();

1331

const onBlockReply = vi.fn();

@@ -41,10 +59,10 @@ describe("subscribeEmbeddedPiSession reply tags", () => {

4159

emit({ type: "message_end", message: assistantMessage });

42604361

expect(onBlockReply).toHaveBeenCalledTimes(1);

44-

const payload = onBlockReply.mock.calls.at(0)?.[0];

45-

expect(payload?.text).toBe("Hello");

46-

expect(payload?.replyToCurrent).toBe(true);

47-

expect(payload?.replyToTag).toBe(true);

62+

const payload = replyPayloadAt(onBlockReply, 0);

63+

expect(payload.text).toBe("Hello");

64+

expect(payload.replyToCurrent).toBe(true);

65+

expect(payload.replyToTag).toBe(true);

4866

});

49675068

it("flushes trailing directive tails on stream end", () => {

@@ -61,8 +79,7 @@ describe("subscribeEmbeddedPiSession reply tags", () => {

6179

emit({ type: "message_end", message: assistantMessage });

62806381

expect(onBlockReply).toHaveBeenCalledTimes(2);

64-

expect(onBlockReply.mock.calls.at(0)?.[0]?.text).toBe("Hello");

65-

expect(onBlockReply.mock.calls.at(1)?.[0]?.text).toBe("[[");

82+

expect(replyTexts(onBlockReply)).toEqual(["Hello", "[["]);

6683

});

67846885

it("streams partial replies past reply_to tags split across chunks", () => {

@@ -82,8 +99,7 @@ describe("subscribeEmbeddedPiSession reply tags", () => {

8299

emitAssistantTextDelta({ emit, delta: " world" });

83100

emitAssistantTextEnd({ emit });

8410185-

const lastPayload = onPartialReply.mock.calls.at(-1)?.[0];

86-

expect(lastPayload?.text).toBe("Hello world");

102+

expect(lastReplyPayload(onPartialReply).text).toBe("Hello world");

87103

for (const call of onPartialReply.mock.calls) {

88104

expect(call[0]?.text?.includes("[[reply_to")).toBe(false);

89105

}