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

推荐订阅源

量子位
博客园_首页
罗磊的独立博客
云风的 BLOG
云风的 BLOG
J
Java Code Geeks
Last Week in AI
Last Week in AI
D
DataBreaches.Net
Jina AI
Jina AI
博客园 - Franky
大猫的无限游戏
大猫的无限游戏
Apple Machine Learning Research
Apple Machine Learning Research
V
V2EX
D
Docker
MongoDB | Blog
MongoDB | Blog
B
Blog RSS Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
H
Help Net Security
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 test: merge chat context notice checks · openclaw/openclaw@5c2f4af 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(status): align oauth health with runtime · openclaw/o...
vincentkoc · 2026-04-18 · via Recent Commits to openclaw:main

@@ -1,4 +1,15 @@

1-

import { afterEach, describe, expect, it, vi } from "vitest";

1+

import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

2+3+

const { readCodexCliCredentialsCachedMock } = vi.hoisted(() => ({

4+

readCodexCliCredentialsCachedMock: vi.fn(() => null),

5+

}));

6+7+

vi.mock("./cli-credentials.js", () => ({

8+

readCodexCliCredentialsCached: readCodexCliCredentialsCachedMock,

9+

readMiniMaxCliCredentialsCached: () => null,

10+

resetCliCredentialCachesForTest: () => undefined,

11+

}));

12+213

import {

314

buildAuthHealthSummary,

415

DEFAULT_OAUTH_WARN_MS,

@@ -16,6 +27,11 @@ describe("buildAuthHealthSummary", () => {

1627

vi.restoreAllMocks();

1728

});

182930+

beforeEach(() => {

31+

readCodexCliCredentialsCachedMock.mockReset();

32+

readCodexCliCredentialsCachedMock.mockReturnValue(null);

33+

});

34+1935

it("classifies OAuth and API key profiles", () => {

2036

vi.spyOn(Date, "now").mockReturnValue(now);

2137

const store = {

@@ -58,13 +74,12 @@ describe("buildAuthHealthSummary", () => {

5874

const statuses = profileStatuses(summary);

59756076

expect(statuses["anthropic:ok"]).toBe("ok");

61-

// OAuth credentials with refresh tokens are auto-renewable, so they report "ok"

62-

expect(statuses["anthropic:expiring"]).toBe("ok");

63-

expect(statuses["anthropic:expired"]).toBe("ok");

77+

expect(statuses["anthropic:expiring"]).toBe("expiring");

78+

expect(statuses["anthropic:expired"]).toBe("expired");

6479

expect(statuses["anthropic:api"]).toBe("static");

65806681

const provider = summary.providers.find((entry) => entry.provider === "anthropic");

67-

expect(provider?.status).toBe("ok");

82+

expect(provider?.status).toBe("expired");

6883

});

69847085

it("reports expired for OAuth without a refresh token", () => {

@@ -92,6 +107,38 @@ describe("buildAuthHealthSummary", () => {

92107

expect(statuses["google:no-refresh"]).toBe("expired");

93108

});

94109110+

it("prefers fresher imported external OAuth credentials when reporting health", () => {

111+

vi.spyOn(Date, "now").mockReturnValue(now);

112+

readCodexCliCredentialsCachedMock.mockReturnValue({

113+

type: "oauth",

114+

provider: "openai-codex",

115+

access: "fresh-cli-access",

116+

refresh: "fresh-cli-refresh",

117+

expires: now + DEFAULT_OAUTH_WARN_MS + 60_000,

118+

accountId: "acct-cli",

119+

});

120+

const store = {

121+

version: 1,

122+

profiles: {

123+

"openai-codex:default": {

124+

type: "oauth" as const,

125+

provider: "openai-codex",

126+

access: "expired-access",

127+

refresh: "expired-refresh",

128+

expires: now - 10_000,

129+

},

130+

},

131+

};

132+133+

const summary = buildAuthHealthSummary({

134+

store,

135+

warnAfterMs: DEFAULT_OAUTH_WARN_MS,

136+

});

137+138+

const statuses = profileStatuses(summary);

139+

expect(statuses["openai-codex:default"]).toBe("ok");

140+

});

141+95142

it("marks token profiles with invalid expires as missing with reason code", () => {

96143

vi.spyOn(Date, "now").mockReturnValue(now);

97144

const store = {