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

推荐订阅源

月光博客
月光博客
Martin Fowler
Martin Fowler
Last Week in AI
Last Week in AI
罗磊的独立博客
阮一峰的网络日志
阮一峰的网络日志
博客园 - 【当耐特】
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
V
Visual Studio Blog
Hugging Face - Blog
Hugging Face - Blog
雷峰网
雷峰网
博客园_首页
人人都是产品经理
人人都是产品经理
量子位
美团技术团队
The Cloudflare Blog
小众软件
小众软件
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
Microsoft Security Blog
Microsoft Security Blog
D
DataBreaches.Net
博客园 - Franky

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: isolate status usage summary · openclaw/openclaw@94...
shakkernerd · 2026-05-10 · via Recent Commits to openclaw:main

@@ -26,6 +26,18 @@ import {

2626

configureInMemoryTaskRegistryStoreForTests,

2727

} from "./commands.test-harness.js";

282829+

const providerUsageMock = vi.hoisted(() => ({

30+

loadProviderUsageSummary: vi.fn(async () => ({ updatedAt: Date.now(), providers: [] })),

31+

}));

32+33+

vi.mock("../../infra/provider-usage.js", async (importOriginal) => {

34+

const actual = await importOriginal<typeof import("../../infra/provider-usage.js")>();

35+

return {

36+

...actual,

37+

loadProviderUsageSummary: providerUsageMock.loadProviderUsageSummary,

38+

};

39+

});

40+2941

vi.mock("../../agents/harness/builtin-pi.js", () => ({

3042

createPiAgentHarness: () => ({

3143

id: "pi",

@@ -91,6 +103,11 @@ function registerStatusCodexHarness(): void {

9110392104

afterEach(() => {

93105

clearAgentHarnesses();

106+

providerUsageMock.loadProviderUsageSummary.mockReset();

107+

providerUsageMock.loadProviderUsageSummary.mockResolvedValue({

108+

updatedAt: Date.now(),

109+

providers: [],

110+

});

94111

});

9511296113

function writeTranscriptUsageLog(params: {

@@ -607,78 +624,80 @@ describe("buildStatusReply subagent summary", () => {

607624

"utf8",

608625

);

609626

const usageResetBase = Math.floor(Date.now() / 1000);

610-

const usageFetch = vi.spyOn(globalThis, "fetch").mockImplementation(async () => {

611-

return new Response(

612-

JSON.stringify({

613-

rate_limit: {

614-

primary_window: {

615-

limit_window_seconds: 18_000,

616-

used_percent: 9,

617-

reset_at: usageResetBase + 60 * 60,

627+

providerUsageMock.loadProviderUsageSummary.mockResolvedValue({

628+

updatedAt: Date.now(),

629+

providers: [

630+

{

631+

provider: "openai-codex",

632+

displayName: "Codex",

633+

windows: [

634+

{

635+

label: "5h",

636+

usedPercent: 9,

637+

resetAt: (usageResetBase + 60 * 60) * 1000,

618638

},

619-

secondary_window: {

620-

limit_window_seconds: 604_800,

621-

used_percent: 30,

622-

reset_at: usageResetBase + 3 * 24 * 60 * 60,

639+

{

640+

label: "Week",

641+

usedPercent: 30,

642+

resetAt: (usageResetBase + 3 * 24 * 60 * 60) * 1000,

623643

},

624-

},

625-

}),

626-

{ status: 200, headers: { "content-type": "application/json" } },

627-

);

644+

],

645+

},

646+

],

628647

});

629648630-

try {

631-

const commonParams = {

632-

sessionEntry: {

633-

sessionId: "sess-status-codex-oauth",

634-

updatedAt: 0,

635-

},

636-

sessionKey: "agent:main:main",

637-

parentSessionKey: "agent:main:main",

638-

sessionScope: "per-sender" as const,

639-

statusChannel: "mobilechat",

640-

provider: "openai",

641-

model: "gpt-5.5",

642-

contextTokens: 32_000,

643-

resolvedFastMode: false,

644-

resolvedVerboseLevel: "off" as const,

645-

resolvedReasoningLevel: "off" as const,

646-

resolveDefaultThinkingLevel: async () => undefined,

647-

isGroup: false,

648-

defaultGroupActivation: () => "mention" as const,

649-

};

649+

const commonParams = {

650+

sessionEntry: {

651+

sessionId: "sess-status-codex-oauth",

652+

updatedAt: 0,

653+

},

654+

sessionKey: "agent:main:main",

655+

parentSessionKey: "agent:main:main",

656+

sessionScope: "per-sender" as const,

657+

statusChannel: "mobilechat",

658+

provider: "openai",

659+

model: "gpt-5.5",

660+

contextTokens: 32_000,

661+

resolvedFastMode: false,

662+

resolvedVerboseLevel: "off" as const,

663+

resolvedReasoningLevel: "off" as const,

664+

resolveDefaultThinkingLevel: async () => undefined,

665+

isGroup: false,

666+

defaultGroupActivation: () => "mention" as const,

667+

};

650668651-

const codexText = await buildStatusText({

652-

cfg: {

653-

...baseCfg,

654-

agents: {

655-

defaults: {

656-

agentRuntime: { id: "codex" },

657-

},

669+

const codexText = await buildStatusText({

670+

cfg: {

671+

...baseCfg,

672+

agents: {

673+

defaults: {

674+

agentRuntime: { id: "codex" },

658675

},

659676

},

660-

...commonParams,

661-

});

662-

const implicitCodexText = await buildStatusText({

663-

cfg: baseCfg,

664-

...commonParams,

665-

});

677+

},

678+

...commonParams,

679+

});

680+

const implicitCodexText = await buildStatusText({

681+

cfg: baseCfg,

682+

...commonParams,

683+

});

666684667-

const normalizedCodex = normalizeTestText(codexText);

668-

const normalizedImplicitCodex = normalizeTestText(implicitCodexText);

669-

expect(normalizedCodex).toContain("Model: openai/gpt-5.5");

670-

expect(normalizedCodex).toContain("oauth (openai-codex:status)");

671-

expect(normalizedCodex).toContain("openai-codex:status");

672-

expect(normalizedCodex).toContain("Usage: 5h 91% left");

673-

expect(normalizedCodex).toContain("Week 70% left");

674-

expect(normalizedImplicitCodex).toContain("Model: openai/gpt-5.5");

675-

expect(normalizedImplicitCodex).toContain("oauth (openai-codex:status)");

676-

expect(normalizedImplicitCodex).toContain("Runtime: OpenAI Codex");

677-

expect(normalizedImplicitCodex).toContain("Usage: 5h 91% left");

678-

expect(usageFetch).toHaveBeenCalled();

679-

} finally {

680-

usageFetch.mockRestore();

681-

}

685+

const normalizedCodex = normalizeTestText(codexText);

686+

const normalizedImplicitCodex = normalizeTestText(implicitCodexText);

687+

expect(normalizedCodex).toContain("Model: openai/gpt-5.5");

688+

expect(normalizedCodex).toContain("oauth (openai-codex:status)");

689+

expect(normalizedCodex).toContain("openai-codex:status");

690+

expect(normalizedCodex).toContain("Usage: 5h 91% left");

691+

expect(normalizedCodex).toContain("Week 70% left");

692+

expect(normalizedImplicitCodex).toContain("Model: openai/gpt-5.5");

693+

expect(normalizedImplicitCodex).toContain("oauth (openai-codex:status)");

694+

expect(normalizedImplicitCodex).toContain("Runtime: OpenAI Codex");

695+

expect(normalizedImplicitCodex).toContain("Usage: 5h 91% left");

696+

expect(providerUsageMock.loadProviderUsageSummary).toHaveBeenCalledWith(

697+

expect.objectContaining({

698+

providers: ["openai-codex"],

699+

}),

700+

);

682701

},

683702

{

684703

env: {