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

推荐订阅源

爱范儿
爱范儿
WordPress大学
WordPress大学
博客园 - 【当耐特】
The Cloudflare Blog
B
Blog
Last Week in AI
Last Week in AI
小众软件
小众软件
量子位
S
SegmentFault 最新的问题
V
Visual Studio Blog
博客园 - 叶小钗
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
Hugging Face - Blog
Hugging Face - Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
宝玉的分享
宝玉的分享
A
About on SuperTechFans
雷峰网
雷峰网
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
腾讯CDC
MongoDB | Blog
MongoDB | Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Martin Fowler
Martin Fowler

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
fix: validate limit edge cases and voicecall numeric flag...
leno23 · 2026-05-17 · via Recent Commits to openclaw:main

@@ -1962,4 +1962,97 @@ example

19621962

expect(lastPoint?.cumulativeTokens).toBe(165);

19631963

expect(lastPoint?.cumulativeCost).toBeCloseTo(0.055, 8);

19641964

});

1965+1966+

it("returns empty points for zero, negative, and non-finite maxPoints", async () => {

1967+

const root = await makeSessionCostRoot("timeseries-invalid-max-points");

1968+

const sessionsDir = path.join(root, "agents", "main", "sessions");

1969+

await fs.mkdir(sessionsDir, { recursive: true });

1970+

const sessionFile = path.join(sessionsDir, "sess-invalid-max-points.jsonl");

1971+

const entries = [

1972+

{

1973+

type: "message",

1974+

timestamp: new Date(Date.UTC(2026, 1, 12, 10, 1, 0)).toISOString(),

1975+

message: {

1976+

role: "assistant",

1977+

provider: "openai",

1978+

model: "gpt-5.4",

1979+

usage: {

1980+

input: 1,

1981+

output: 2,

1982+

cacheRead: 0,

1983+

cacheWrite: 0,

1984+

totalTokens: 3,

1985+

cost: { total: 0.001 },

1986+

},

1987+

},

1988+

},

1989+

{

1990+

type: "message",

1991+

timestamp: new Date(Date.UTC(2026, 1, 12, 10, 2, 0)).toISOString(),

1992+

message: {

1993+

role: "assistant",

1994+

provider: "openai",

1995+

model: "gpt-5.4",

1996+

usage: {

1997+

input: 2,

1998+

output: 4,

1999+

cacheRead: 0,

2000+

cacheWrite: 0,

2001+

totalTokens: 6,

2002+

cost: { total: 0.002 },

2003+

},

2004+

},

2005+

},

2006+

];

2007+

await fs.writeFile(

2008+

sessionFile,

2009+

entries.map((entry) => JSON.stringify(entry)).join("\n"),

2010+

"utf-8",

2011+

);

2012+2013+

await expect(loadSessionUsageTimeSeries({ sessionFile, maxPoints: 0 })).resolves.toEqual({

2014+

sessionId: undefined,

2015+

points: [],

2016+

});

2017+

await expect(loadSessionUsageTimeSeries({ sessionFile, maxPoints: -1 })).resolves.toEqual({

2018+

sessionId: undefined,

2019+

points: [],

2020+

});

2021+

await expect(

2022+

loadSessionUsageTimeSeries({ sessionFile, maxPoints: Number.NaN }),

2023+

).resolves.toEqual({ sessionId: undefined, points: [] });

2024+

await expect(

2025+

loadSessionUsageTimeSeries({ sessionFile, maxPoints: Number.POSITIVE_INFINITY }),

2026+

).resolves.toEqual({ sessionId: undefined, points: [] });

2027+

});

2028+2029+

it("returns empty logs for zero, negative, and non-finite limits", async () => {

2030+

const root = await makeSessionCostRoot("session-logs-invalid-limit");

2031+

const sessionsDir = path.join(root, "agents", "main", "sessions");

2032+

await fs.mkdir(sessionsDir, { recursive: true });

2033+

const sessionFile = path.join(sessionsDir, "sess-invalid-limit.jsonl");

2034+

await fs.writeFile(

2035+

sessionFile,

2036+

[

2037+

JSON.stringify({

2038+

type: "message",

2039+

timestamp: new Date(Date.UTC(2026, 1, 12, 10, 0, 0)).toISOString(),

2040+

message: { role: "user", content: "hello" },

2041+

}),

2042+

JSON.stringify({

2043+

type: "message",

2044+

timestamp: new Date(Date.UTC(2026, 1, 12, 10, 1, 0)).toISOString(),

2045+

message: { role: "user", content: "world" },

2046+

}),

2047+

].join("\n"),

2048+

"utf-8",

2049+

);

2050+2051+

await expect(loadSessionLogs({ sessionFile, limit: 0 })).resolves.toEqual([]);

2052+

await expect(loadSessionLogs({ sessionFile, limit: -1 })).resolves.toEqual([]);

2053+

await expect(loadSessionLogs({ sessionFile, limit: Number.NaN })).resolves.toEqual([]);

2054+

await expect(

2055+

loadSessionLogs({ sessionFile, limit: Number.POSITIVE_INFINITY }),

2056+

).resolves.toEqual([]);

2057+

});

19652058

});