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

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
U
Unit 42
GbyAI
GbyAI
M
MIT News - Artificial intelligence
美团技术团队
罗磊的独立博客
雷峰网
雷峰网
量子位
博客园 - 【当耐特】
Last Week in AI
Last Week in AI
D
Docker
小众软件
小众软件
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
WordPress大学
WordPress大学
V
V2EX
博客园_首页
腾讯CDC
The Cloudflare Blog
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

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 tool result context guard assertions · open...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -220,8 +220,12 @@ describe("installToolResultContextGuard", () => {

220220221221

expectPiStyleTruncation(newResultText);

222222

expect(result.details).toBeUndefined();

223-

expect((contextForNextCall[0] as { details?: unknown }).details).toMatchObject({

224-

truncation: { truncated: true },

223+

const originalDetails = (contextForNextCall[0] as { details?: { truncation?: unknown } })

224+

.details;

225+

expect(originalDetails?.truncation).toEqual({

226+

truncated: true,

227+

outputLines: 100,

228+

content: "d".repeat(8_000),

225229

});

226230

});

227231

@@ -290,22 +294,23 @@ describe("installToolResultContextGuard", () => {

290294

makeToolResult("call_big", "x".repeat(80_000)),

291295

];

292296293-

await expect(

294-

applyMidTurnPrecheckGuardToContext(agent, contextForNextCall, {

297+

try {

298+

await applyMidTurnPrecheckGuardToContext(agent, contextForNextCall, {

295299

contextWindowTokens: 200_000,

296300

contextTokenBudget: 20_000,

297301

reserveTokens: 12_000,

298302

toolResultMaxChars: 16_000,

299303

prePromptMessageCount: 1,

300-

}),

301-

).rejects.toMatchObject({

302-

name: "MidTurnPrecheckSignal",

303-

request: expect.objectContaining({

304-

route: "compact_then_truncate",

305-

overflowTokens: expect.any(Number),

306-

toolResultReducibleChars: expect.any(Number),

307-

}),

308-

});

304+

});

305+

throw new Error("expected mid-turn precheck signal");

306+

} catch (err) {

307+

expect(err).toBeInstanceOf(MidTurnPrecheckSignal);

308+

const signal = err as MidTurnPrecheckSignal;

309+

expect(signal.name).toBe("MidTurnPrecheckSignal");

310+

expect(signal.request.route).toBe("compact_then_truncate");

311+

expect(typeof signal.request.overflowTokens).toBe("number");

312+

expect(typeof signal.request.toolResultReducibleChars).toBe("number");

313+

}

309314

});

310315311316

it("does not run mid-turn precheck when no new tool result was appended", async () => {

@@ -481,10 +486,9 @@ describe("installContextEngineLoopHook", () => {

481486

await callTransform(agent, messages);

482487483488

expect(engine.afterTurn).toHaveBeenCalledTimes(1);

484-

expect(engine.afterTurn.mock.calls[0]?.[0]).toMatchObject({

485-

prePromptMessageCount: 1,

486-

messages,

487-

});

489+

const afterTurnParams = engine.afterTurn.mock.calls[0]?.[0];

490+

expect(afterTurnParams?.prePromptMessageCount).toBe(1);

491+

expect(afterTurnParams?.messages).toBe(messages);

488492

expect(engine.assemble).toHaveBeenCalledTimes(1);

489493

});

490494

@@ -504,15 +508,14 @@ describe("installContextEngineLoopHook", () => {

504508

await callTransform(agent, messages);

505509506510

expect(engine.afterTurn).toHaveBeenCalledTimes(1);

507-

expect(engine.afterTurn.mock.calls[0]?.[0]).toMatchObject({

508-

prePromptMessageCount: 1,

509-

runtimeContext: {

510-

provider: "anthropic",

511-

modelId,

512-

promptCache: {

513-

retention: "short",

514-

lastCacheTouchAt: 123,

515-

},

511+

const afterTurnParams = engine.afterTurn.mock.calls[0]?.[0];

512+

expect(afterTurnParams?.prePromptMessageCount).toBe(1);

513+

expect(afterTurnParams?.runtimeContext).toEqual({

514+

provider: "anthropic",

515+

modelId,

516+

promptCache: {

517+

retention: "short",

518+

lastCacheTouchAt: 123,

516519

},

517520

});

518521

});

@@ -548,10 +551,9 @@ describe("installContextEngineLoopHook", () => {

548551

await callTransform(agent, withNew);

549552550553

expect(engine.afterTurn).toHaveBeenCalledTimes(1);

551-

expect(engine.afterTurn.mock.calls[0]?.[0]).toMatchObject({

552-

prePromptMessageCount: 2,

553-

messages: withNew,

554-

});

554+

const afterTurnParams = engine.afterTurn.mock.calls[0]?.[0];

555+

expect(afterTurnParams?.prePromptMessageCount).toBe(2);

556+

expect(afterTurnParams?.messages).toBe(withNew);

555557

expect(engine.assemble).toHaveBeenCalledTimes(1);

556558

});

557559

@@ -774,11 +776,10 @@ describe("installContextEngineLoopHook", () => {

774776

await callTransform(agent, messages);

775777776778

expect(engine.ingest).toHaveBeenCalledTimes(1);

777-

expect(engine.ingest.mock.calls[0]?.[0]).toMatchObject({

778-

sessionId,

779-

sessionKey,

780-

message: toolResult,

781-

});

779+

const ingestParams = engine.ingest.mock.calls[0]?.[0];

780+

expect(ingestParams?.sessionId).toBe(sessionId);

781+

expect(ingestParams?.sessionKey).toBe(sessionKey);

782+

expect(ingestParams?.message).toBe(toolResult);

782783

expect(engine.assemble).toHaveBeenCalledTimes(1);

783784

});

784785