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

推荐订阅源

G
Google Developers Blog
F
Fortinet All Blogs
Microsoft Azure Blog
Microsoft Azure Blog
腾讯CDC
Vercel News
Vercel News
Recent Announcements
Recent Announcements
博客园 - Franky
小众软件
小众软件
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
宝玉的分享
宝玉的分享
I
InfoQ
博客园 - 聂微东
Jina AI
Jina AI
J
Java Code Geeks
V
V2EX
U
Unit 42
Stack Overflow Blog
Stack Overflow Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
阮一峰的网络日志
阮一峰的网络日志
L
LangChain Blog
T
The Blog of Author Tim Ferriss
量子位

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(agents): add large prompt cache coverage (#95653) · ...
vincentkoc · 2026-06-22 · via Recent Commits to openclaw:main

@@ -36,6 +36,7 @@ const OPENAI_TOOL_MIN_CACHE_READ = 4_096;

3636

const OPENAI_TOOL_MIN_HIT_RATE = 0.85;

3737

const OPENAI_IMAGE_MIN_CACHE_READ = 3_840;

3838

const OPENAI_IMAGE_MIN_HIT_RATE = 0.82;

39+

const LARGE_CACHE_PROMPT_SECTIONS = 1_024;

3940

const LIVE_TEST_PNG_URL = new URL(

4041

"../../apps/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png",

4142

import.meta.url,

@@ -1026,6 +1027,40 @@ describeCacheLive("embedded agent runner prompt caching (live)", () => {

10261027

8 * 60_000,

10271028

);

102810291030+

it(

1031+

"keeps OpenAI cache reuse across a large embedded prompt",

1032+

async () => {

1033+

const sessionId = `${OPENAI_SESSION_ID}-large`;

1034+

const warmup = await runEmbeddedCacheProbe({

1035+

...fixture,

1036+

cacheRetention: "short",

1037+

prefix: OPENAI_PREFIX,

1038+

providerTag: "openai",

1039+

sessionId,

1040+

suffix: "large-warmup",

1041+

promptSections: LARGE_CACHE_PROMPT_SECTIONS,

1042+

});

1043+

const hit = await runEmbeddedCacheProbe({

1044+

...fixture,

1045+

cacheRetention: "short",

1046+

prefix: OPENAI_PREFIX,

1047+

providerTag: "openai",

1048+

sessionId,

1049+

suffix: "large-hit",

1050+

promptSections: LARGE_CACHE_PROMPT_SECTIONS,

1051+

});

1052+

logLiveCache(

1053+

`openai large prompt sections=${LARGE_CACHE_PROMPT_SECTIONS} warmup=${warmup.usage.cacheWrite} hit=${hit.usage.cacheRead} input=${hit.usage.input} rate=${hit.hitRate.toFixed(3)}`,

1054+

);

1055+1056+

expect(warmup.usage.cacheWrite ?? 0).toBeGreaterThan(0);

1057+

expect(hit.usage.cacheRead ?? 0).toBeGreaterThan(4_096);

1058+

expect(hit.hitRate).toBeGreaterThanOrEqual(0.4);

1059+

await expectCacheTraceStages(sessionId, ["cache:state", "cache:result"]);

1060+

},

1061+

12 * 60_000,

1062+

);

1063+10291064

it(

10301065

"keeps OpenAI cache reuse when structured system context only changes by whitespace and line endings",

10311066

async () => {

@@ -1363,5 +1398,39 @@ describeCacheLive("embedded agent runner prompt caching (live)", () => {

13631398

},

13641399

8 * 60_000,

13651400

);

1401+1402+

it(

1403+

"keeps Anthropic cache reuse across a large embedded prompt",

1404+

async () => {

1405+

const sessionId = `${ANTHROPIC_SESSION_ID}-large`;

1406+

const warmup = await runEmbeddedCacheProbe({

1407+

...fixture,

1408+

cacheRetention: "short",

1409+

prefix: ANTHROPIC_PREFIX,

1410+

providerTag: "anthropic",

1411+

sessionId,

1412+

suffix: "large-warmup",

1413+

promptSections: LARGE_CACHE_PROMPT_SECTIONS,

1414+

});

1415+

const hit = await runEmbeddedCacheProbe({

1416+

...fixture,

1417+

cacheRetention: "short",

1418+

prefix: ANTHROPIC_PREFIX,

1419+

providerTag: "anthropic",

1420+

sessionId,

1421+

suffix: "large-hit",

1422+

promptSections: LARGE_CACHE_PROMPT_SECTIONS,

1423+

});

1424+

logLiveCache(

1425+

`anthropic large prompt sections=${LARGE_CACHE_PROMPT_SECTIONS} warmup=${warmup.usage.cacheWrite} hit=${hit.usage.cacheRead} input=${hit.usage.input} rate=${hit.hitRate.toFixed(3)}`,

1426+

);

1427+1428+

expect(warmup.usage.cacheWrite ?? 0).toBeGreaterThan(0);

1429+

expect(hit.usage.cacheRead ?? 0).toBeGreaterThan(4_096);

1430+

expect(hit.hitRate).toBeGreaterThanOrEqual(0.3);

1431+

await expectCacheTraceStages(sessionId, ["cache:state", "cache:result"]);

1432+

},

1433+

12 * 60_000,

1434+

);

13661435

});

13671436

});