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

推荐订阅源

B
Blog
Microsoft Security Blog
Microsoft Security Blog
Jina AI
Jina AI
博客园 - 叶小钗
J
Java Code Geeks
博客园 - 聂微东
博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
美团技术团队
WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
GbyAI
GbyAI
罗磊的独立博客
T
The Blog of Author Tim Ferriss
aimingoo的专栏
aimingoo的专栏
T
Tailwind CSS Blog
The Cloudflare Blog
Stack Overflow Blog
Stack Overflow Blog
N
Netflix TechBlog - Medium
小众软件
小众软件

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: tighten incomplete turn warning assertions · opencl...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -49,6 +49,18 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {

4949

mockedGlobalHookRunner.hasHooks.mockImplementation(() => false);

5050

});

515152+

function warnMessages(): string[] {

53+

return mockedLog.warn.mock.calls.map(([message]) => String(message));

54+

}

55+56+

function expectWarnMessageWith(text: string): void {

57+

expect(warnMessages().some((message) => message.includes(text))).toBe(true);

58+

}

59+60+

function expectNoWarnMessageWith(text: string): void {

61+

expect(warnMessages().some((message) => message.includes(text))).toBe(false);

62+

}

63+5264

it("emits the before_agent_run hook block message as the agent payload", async () => {

5365

mockedRunEmbeddedAttempt.mockResolvedValueOnce(

5466

makeAttemptResult({

@@ -207,9 +219,7 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {

207219

expect(mockedRunEmbeddedAttempt).toHaveBeenCalledTimes(1);

208220

expect(result.payloads).toEqual([{ text: "NO_REPLY" }]);

209221

expect(result.meta.livenessState).toBe("working");

210-

expect(mockedLog.warn).not.toHaveBeenCalledWith(

211-

expect.stringContaining("incomplete turn detected"),

212-

);

222+

expectNoWarnMessageWith("incomplete turn detected");

213223

});

214224215225

it("uses explicit agentId without a session key before surfacing the strict-agentic blocked state", async () => {

@@ -429,9 +439,7 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {

429439

expect(mockedRunEmbeddedAttempt).toHaveBeenCalledTimes(2);

430440

const secondCall = mockedRunEmbeddedAttempt.mock.calls[1]?.[0] as { prompt?: string };

431441

expect(secondCall.prompt).toContain(REASONING_ONLY_RETRY_INSTRUCTION);

432-

expect(mockedLog.warn).toHaveBeenCalledWith(

433-

expect.stringContaining("reasoning-only assistant turn detected"),

434-

);

442+

expectWarnMessageWith("reasoning-only assistant turn detected");

435443

});

436444437445

it("returns NO_REPLY without retrying reasoning-only assistant turns when silence is allowed", async () => {

@@ -467,9 +475,7 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {

467475

const onlyCall = mockedRunEmbeddedAttempt.mock.calls[0]?.[0] as { prompt?: string };

468476

expect(onlyCall.prompt).not.toContain(REASONING_ONLY_RETRY_INSTRUCTION);

469477

expect(onlyCall.prompt).not.toContain(EMPTY_RESPONSE_RETRY_INSTRUCTION);

470-

expect(mockedLog.warn).not.toHaveBeenCalledWith(

471-

expect.stringContaining("reasoning-only assistant turn detected"),

472-

);

478+

expectNoWarnMessageWith("reasoning-only assistant turn detected");

473479

expect(result.payloads).toEqual([{ text: "NO_REPLY" }]);

474480

expect(result.meta.terminalReplyKind).toBe("silent-empty");

475481

expect(result.meta.livenessState).toBe("working");

@@ -616,7 +622,7 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {

616622

expect(mockedRunEmbeddedAttempt).toHaveBeenCalledTimes(2);

617623

const secondCall = mockedRunEmbeddedAttempt.mock.calls[1]?.[0] as { prompt?: string };

618624

expect(secondCall.prompt).toContain(EMPTY_RESPONSE_RETRY_INSTRUCTION);

619-

expect(mockedLog.warn).toHaveBeenCalledWith(expect.stringContaining("empty response detected"));

625+

expectWarnMessageWith("empty response detected");

620626

});

621627622628

it("retries zero-token empty Claude stop turns with a visible-answer continuation instruction", async () => {

@@ -670,7 +676,7 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {

670676

expect(mockedRunEmbeddedAttempt).toHaveBeenCalledTimes(2);

671677

const secondCall = mockedRunEmbeddedAttempt.mock.calls[1]?.[0] as { prompt?: string };

672678

expect(secondCall.prompt).toContain(EMPTY_RESPONSE_RETRY_INSTRUCTION);

673-

expect(mockedLog.warn).toHaveBeenCalledWith(expect.stringContaining("empty response detected"));

679+

expectWarnMessageWith("empty response detected");

674680

});

675681676682

it("retries empty openai-compatible stop turns even when the backend reports output tokens", async () => {

@@ -739,7 +745,7 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {

739745

expect(mockedRunEmbeddedAttempt).toHaveBeenCalledTimes(2);

740746

const secondCall = mockedRunEmbeddedAttempt.mock.calls[1]?.[0] as { prompt?: string };

741747

expect(secondCall.prompt).toContain(EMPTY_RESPONSE_RETRY_INSTRUCTION);

742-

expect(mockedLog.warn).toHaveBeenCalledWith(expect.stringContaining("empty response detected"));

748+

expectWarnMessageWith("empty response detected");

743749

});

744750745751

it("surfaces an error after exhausting empty-response retries", async () => {

@@ -767,9 +773,7 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {

767773

expect(mockedRunEmbeddedAttempt).toHaveBeenCalledTimes(2);

768774

expect(result.payloads?.[0]?.isError).toBe(true);

769775

expect(result.payloads?.[0]?.text).toContain("Please try again");

770-

expect(mockedLog.warn).toHaveBeenCalledWith(

771-

expect.stringContaining("empty response retries exhausted"),

772-

);

776+

expectWarnMessageWith("empty response retries exhausted");

773777

});

774778775779

it("surfaces an error after exhausting reasoning-only retries without a visible answer", async () => {

@@ -807,9 +811,7 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {

807811

expect(mockedRunEmbeddedAttempt).toHaveBeenCalledTimes(3);

808812

expect(result.payloads?.[0]?.isError).toBe(true);

809813

expect(result.payloads?.[0]?.text).toContain("Please try again");

810-

expect(mockedLog.warn).toHaveBeenCalledWith(

811-

expect.stringContaining("reasoning-only retries exhausted"),

812-

);

814+

expectWarnMessageWith("reasoning-only retries exhausted");

813815

});

814816815817

it("detects structured bullet-only plans with intent cues as planning-only GPT turns", () => {

@@ -1068,7 +1070,7 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {

10681070

}),

10691071

});

107010721071-

expect(incompleteTurnText).toEqual(expect.stringContaining("couldn't generate a response"));

1073+

expect(incompleteTurnText).toContain("couldn't generate a response");

10721074

});

1073107510741076

it("surfaces tool-use terminal with pre-tool text and side effects as replay-unsafe (#76477)", () => {

@@ -1146,9 +1148,7 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {

11461148

expect(mockedRunEmbeddedAttempt).toHaveBeenCalledTimes(1);

11471149

expect(result.payloads?.[0]?.isError).toBe(true);

11481150

expect(result.payloads?.[0]?.text).toContain("couldn't generate a response");

1149-

expect(mockedLog.warn).toHaveBeenCalledWith(

1150-

expect.stringContaining("incomplete turn detected"),

1151-

);

1151+

expectWarnMessageWith("incomplete turn detected");

11521152

});

1153115311541154

it("treats missing replay metadata as replay-invalid", () => {