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

推荐订阅源

Martin Fowler
Martin Fowler
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
The Cloudflare Blog
WordPress大学
WordPress大学
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 司徒正美
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
J
Java Code Geeks
云风的 BLOG
云风的 BLOG
C
Check Point Blog
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
V
V2EX
F
Fortinet All Blogs
B
Blog
大猫的无限游戏
大猫的无限游戏
N
Netflix TechBlog - Medium
B
Blog RSS Feed
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: dedupe compaction safeguard mock reads · openclaw/o...
steipete · 2026-05-13 · via Recent Commits to openclaw:main

@@ -201,6 +201,32 @@ function expectCompactionResult(result: {

201201

return result.compaction;

202202

}

203203204+

function mockCallArg(

205+

mock: { mock: { calls: ReadonlyArray<ReadonlyArray<unknown>> } },

206+

callIndex = 0,

207+

argIndex = 0,

208+

): unknown {

209+

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

210+

if (!call) {

211+

throw new Error(`expected mock call ${callIndex + 1}`);

212+

}

213+

return call[argIndex];

214+

}

215+216+

function requireRecord(value: unknown): Record<string, unknown> {

217+

if (!value || typeof value !== "object") {

218+

throw new Error("expected record");

219+

}

220+

return value as Record<string, unknown>;

221+

}

222+223+

function requireArray(value: unknown): unknown[] {

224+

if (!Array.isArray(value)) {

225+

throw new Error("expected array");

226+

}

227+

return value;

228+

}

229+204230

describe("compaction-safeguard tool failures", () => {

205231

it("formats tool failures with meta and summary", () => {

206232

const messages: AgentMessage[] = [

@@ -1308,7 +1334,7 @@ describe("compaction-safeguard recent-turn preservation", () => {

1308133413091335

expect(result.cancel).not.toBe(true);

13101336

expect(mockSummarizeInStages).toHaveBeenCalledTimes(1);

1311-

const droppedCall = mockSummarizeInStages.mock.calls.at(0)?.[0];

1337+

const droppedCall = requireRecord(mockCallArg(mockSummarizeInStages));

13121338

expect(droppedCall?.customInstructions).toContain(

13131339

"Produce a compact, factual summary with these exact section headings:",

13141340

);

@@ -1351,7 +1377,7 @@ describe("compaction-safeguard recent-turn preservation", () => {

1351137713521378

await compactionHandler(event, mockContext);

135313791354-

const call = mockSummarizeInStages.mock.calls.at(0)?.[0];

1380+

const call = requireRecord(mockCallArg(mockSummarizeInStages));

13551381

expect(call?.reserveTokens).toBe(128_000);

13561382

});

13571383

@@ -1817,10 +1843,11 @@ describe("compaction-safeguard recent-turn preservation", () => {

1817184318181844

expect(result.cancel).not.toBe(true);

18191845

expect(mockSummarizeInStages).toHaveBeenCalledTimes(1);

1820-

const call = mockSummarizeInStages.mock.calls.at(0)?.[0];

1846+

const call = requireRecord(mockCallArg(mockSummarizeInStages));

18211847

expect(call?.previousSummary).toBeUndefined();

1822-

expect(JSON.stringify(call?.messages[0])).toContain("<previous-compaction-summary>");

1823-

expect(JSON.stringify(call?.messages[0])).toContain("Old duplicated section");

1848+

const messages = requireArray(call.messages);

1849+

expect(JSON.stringify(messages[0])).toContain("<previous-compaction-summary>");

1850+

expect(JSON.stringify(messages[0])).toContain("Old duplicated section");

18241851

});

1825185218261853

it("passes compaction instructions to providers and preserves suffix context", async () => {

@@ -1880,14 +1907,14 @@ describe("compaction-safeguard recent-turn preservation", () => {

18801907

const compaction = expectCompactionResult(result);

18811908

expect(getApiKeyAndHeadersMock).not.toHaveBeenCalled();

18821909

expect(mockSummarizeInStages).not.toHaveBeenCalled();

1883-

const providerInput = providerSummarize.mock.calls.at(0)?.[0];

1910+

const providerInput = requireRecord(mockCallArg(providerSummarize));

18841911

expect(providerInput?.previousSummary).toBe("previous provider summary");

18851912

expect(providerInput?.customInstructions).toContain("Keep milestone names.");

18861913

expect(providerInput?.summarizationInstructions).toEqual({

18871914

identifierPolicy: "custom",

18881915

identifierInstructions: "Preserve ticket IDs exactly.",

18891916

});

1890-

const providerMessages = providerSummarize.mock.calls.at(0)?.[0]?.messages ?? [];

1917+

const providerMessages = providerInput.messages ?? [];

18911918

expect(JSON.stringify(providerMessages)).not.toContain("openclaw.runtime-context");

18921919

expect(JSON.stringify(providerMessages)).not.toContain("secret runtime context");

18931920

expect(compaction.summary).toContain("provider summary body");