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

推荐订阅源

The GitHub Blog
The GitHub Blog
S
SegmentFault 最新的问题
MyScale Blog
MyScale Blog
有赞技术团队
有赞技术团队
V
Visual Studio Blog
T
The Blog of Author Tim Ferriss
爱范儿
爱范儿
Vercel News
Vercel News
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Y
Y Combinator Blog
Blog — PlanetScale
Blog — PlanetScale
D
DataBreaches.Net
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
大猫的无限游戏
大猫的无限游戏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
GbyAI
GbyAI
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
The Cloudflare Blog
宝玉的分享
宝玉的分享
V
V2EX
Microsoft Azure Blog
Microsoft Azure Blog

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: guard provider usage mock calls · openclaw/openclaw...
steipete · 2026-05-12 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -24,6 +24,22 @@ vi.mock("./model-selection.runtime.js", () => ({

2424

resolveCommitmentDefaultModelRef: resolveDefaultModelMock,

2525

}));

2626
27+

function requireFirstEmbeddedPiRequest(): {

28+

provider?: string;

29+

model?: string;

30+

disableTools?: boolean;

31+

} {

32+

const [call] = runEmbeddedPiAgentMock.mock.calls;

33+

if (!call) {

34+

throw new Error("expected embedded PI agent extraction request");

35+

}

36+

const [request] = call;

37+

if (!request || typeof request !== "object" || Array.isArray(request)) {

38+

throw new Error("expected embedded PI agent extraction request");

39+

}

40+

return request as { provider?: string; model?: string; disableTools?: boolean };

41+

}

42+
2743

describe("commitment extraction runtime", () => {

2844

const tmpDirs: string[] = [];

2945

const nowMs = Date.parse("2026-04-29T16:00:00.000Z");

@@ -204,12 +220,7 @@ describe("commitment extraction runtime", () => {

204220

await expect(drainCommitmentExtractionQueue()).resolves.toBe(1);

205221

expect(resolveDefaultModelMock).toHaveBeenCalledWith({ cfg, agentId: "main" });

206222

expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);

207-

const request = runEmbeddedPiAgentMock.mock.calls[0]?.[0] as

208-

| { provider?: string; model?: string; disableTools?: boolean }

209-

| undefined;

210-

if (!request) {

211-

throw new Error("Expected embedded PI agent extraction request");

212-

}

223+

const request = requireFirstEmbeddedPiRequest();

213224

expect(request.provider).toBe("openai-codex");

214225

expect(request.model).toBe("gpt-5.5");

215226

expect(request.disableTools).toBe(true);

Original file line numberDiff line numberDiff line change

@@ -7,6 +7,16 @@ import {

77

parseFiniteNumber,

88

} from "./provider-usage.fetch.shared.js";

99
10+

function requireFetchCall(

11+

mock: ReturnType<typeof vi.fn>,

12+

): [URL | RequestInfo, RequestInit | undefined] {

13+

const [call] = mock.mock.calls;

14+

if (!call) {

15+

throw new Error("expected fetch call");

16+

}

17+

return call as [URL | RequestInfo, RequestInit | undefined];

18+

}

19+
1020

describe("provider usage fetch shared helpers", () => {

1121

afterEach(() => {

1222

vi.restoreAllMocks();

@@ -48,7 +58,7 @@ describe("provider usage fetch shared helpers", () => {

4858

);

4959
5060

expect(fetchFnMock).toHaveBeenCalledOnce();

51-

const [input, init] = fetchFnMock.mock.calls[0] ?? [];

61+

const [input, init] = requireFetchCall(fetchFnMock);

5262

expect(input).toBe("https://example.com/usage");

5363

expect(init?.method).toBe("POST");

5464

expect(init?.headers).toEqual({ authorization: "Bearer test" });

Original file line numberDiff line numberDiff line change

@@ -22,6 +22,32 @@ let loadProviderUsageSummary: typeof import("./provider-usage.load.js").loadProv

2222
2323

const usageNow = Date.UTC(2026, 0, 7, 0, 0, 0);

2424
25+

function requireFirstPluginUsageCall(): {

26+

provider?: unknown;

27+

context?: {

28+

provider?: unknown;

29+

token?: unknown;

30+

timeoutMs?: unknown;

31+

};

32+

} {

33+

const [call] = resolveProviderUsageSnapshotWithPluginMock.mock.calls;

34+

if (!call) {

35+

throw new Error("expected provider usage plugin call");

36+

}

37+

const [pluginCall] = call;

38+

if (!pluginCall || typeof pluginCall !== "object" || Array.isArray(pluginCall)) {

39+

throw new Error("expected provider usage plugin call");

40+

}

41+

return pluginCall as {

42+

provider?: unknown;

43+

context?: {

44+

provider?: unknown;

45+

token?: unknown;

46+

timeoutMs?: unknown;

47+

};

48+

};

49+

}

50+
2551

describe("provider-usage.load plugin boundary", () => {

2652

beforeAll(async () => {

2753

({ loadProviderUsageSummary } = await import("./provider-usage.load.js"));

@@ -61,19 +87,7 @@ describe("provider-usage.load plugin boundary", () => {

6187
6288

expect(mockFetch).not.toHaveBeenCalled();

6389

expect(resolveProviderUsageSnapshotWithPluginMock).toHaveBeenCalledOnce();

64-

const pluginCall = resolveProviderUsageSnapshotWithPluginMock.mock.calls[0]?.[0] as

65-

| {

66-

provider?: unknown;

67-

context?: {

68-

provider?: unknown;

69-

token?: unknown;

70-

timeoutMs?: unknown;

71-

};

72-

}

73-

| undefined;

74-

if (!pluginCall) {

75-

throw new Error("missing provider usage plugin call");

76-

}

90+

const pluginCall = requireFirstPluginUsageCall();

7791

expect(pluginCall.provider).toBe("github-copilot");

7892

expect(pluginCall.context?.provider).toBe("github-copilot");

7993

expect(pluginCall.context?.token).toBe("copilot-token");