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

推荐订阅源

博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
美团技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
aimingoo的专栏
aimingoo的专栏
腾讯CDC
WordPress大学
WordPress大学
Apple Machine Learning Research
Apple Machine Learning Research
F
Fortinet All Blogs
G
Google Developers Blog
MongoDB | Blog
MongoDB | Blog
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
Engineering at Meta
Engineering at Meta
博客园_首页
B
Blog RSS Feed
D
Docker
M
MIT News - Artificial intelligence
爱范儿
爱范儿
I
InfoQ

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: tighten external oauth assertions · openclaw/opencl...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -40,6 +40,17 @@ function createUsableOAuthExpiry(): number {

4040

return Date.now() + 30 * 60 * 1000;

4141

}

424243+

function requireRecord(value: unknown, label: string): Record<string, unknown> {

44+

if (!value || typeof value !== "object") {

45+

throw new Error(`expected ${label}`);

46+

}

47+

return value as Record<string, unknown>;

48+

}

49+50+

function requireProfile(store: AuthProfileStore, profileId: string): Record<string, unknown> {

51+

return requireRecord(store.profiles[profileId], profileId);

52+

}

53+4354

describe("auth external oauth helpers", () => {

4455

beforeEach(() => {

4556

resolveExternalAuthProfilesWithPluginsMock.mockReset();

@@ -63,11 +74,10 @@ describe("auth external oauth helpers", () => {

63746475

const store = overlayExternalOAuthProfiles(createStore());

657666-

expect(store.profiles["openai-codex:default"]).toMatchObject({

67-

type: "oauth",

68-

provider: "openai-codex",

69-

access: "access-token",

70-

});

77+

const profile = requireProfile(store, "openai-codex:default");

78+

expect(profile.type).toBe("oauth");

79+

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

80+

expect(profile.access).toBe("access-token");

7181

});

72827383

it("passes config and CLI scope through overlay resolution", () => {

@@ -84,12 +94,12 @@ describe("auth external oauth helpers", () => {

8494

externalCliProviderIds: ["openai-codex"],

8595

});

869687-

expect(resolveExternalAuthProfilesWithPluginsMock).toHaveBeenCalledWith(

88-

expect.objectContaining({

89-

config: cfg,

90-

context: expect.objectContaining({ config: cfg }),

91-

}),

97+

const resolveParams = requireRecord(

98+

resolveExternalAuthProfilesWithPluginsMock.mock.calls[0]?.[0],

99+

"resolve external auth params",

92100

);

101+

expect(resolveParams.config).toBe(cfg);

102+

expect(requireRecord(resolveParams.context, "resolve context").config).toBe(cfg);

93103

expect(readCodexCliCredentialsCachedMock).toHaveBeenCalledTimes(1);

94104

});

95105

@@ -169,11 +179,10 @@ describe("auth external oauth helpers", () => {

169179

}),

170180

);

171181172-

expect(overlaid.profiles["openai-codex:default"]).toMatchObject({

173-

access: "stale-store-access-token",

174-

refresh: "stale-store-refresh-token",

175-

accountId: "acct-cli",

176-

});

182+

const profile = requireProfile(overlaid, "openai-codex:default");

183+

expect(profile.access).toBe("stale-store-access-token");

184+

expect(profile.refresh).toBe("stale-store-refresh-token");

185+

expect(profile.accountId).toBe("acct-cli");

177186

});

178187179188

it("keeps healthy local oauth even when external cli has a fresher token", () => {

@@ -195,10 +204,9 @@ describe("auth external oauth helpers", () => {

195204

}),

196205

);

197206198-

expect(overlaid.profiles["openai-codex:default"]).toMatchObject({

199-

access: "healthy-local-access-token",

200-

refresh: "healthy-local-refresh-token",

201-

});

207+

const profile = requireProfile(overlaid, "openai-codex:default");

208+

expect(profile.access).toBe("healthy-local-access-token");

209+

expect(profile.refresh).toBe("healthy-local-refresh-token");

202210

});

203211204212

it("keeps explicit local non-oauth auth over external cli oauth overlays", () => {

@@ -220,11 +228,10 @@ describe("auth external oauth helpers", () => {

220228

}),

221229

);

222230223-

expect(overlaid.profiles["openai-codex:default"]).toMatchObject({

224-

type: "api_key",

225-

provider: "openai-codex",

226-

key: "sk-local",

227-

});

231+

const profile = requireProfile(overlaid, "openai-codex:default");

232+

expect(profile.type).toBe("api_key");

233+

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

234+

expect(profile.key).toBe("sk-local");

228235

});

229236230237

it("keeps expired local oauth when external cli belongs to a different account", () => {

@@ -248,10 +255,9 @@ describe("auth external oauth helpers", () => {

248255

}),

249256

);

250257251-

expect(overlaid.profiles["openai-codex:default"]).toMatchObject({

252-

access: "expired-local-access-token",

253-

refresh: "expired-local-refresh-token",

254-

accountId: "acct-local",

255-

});

258+

const profile = requireProfile(overlaid, "openai-codex:default");

259+

expect(profile.access).toBe("expired-local-access-token");

260+

expect(profile.refresh).toBe("expired-local-refresh-token");

261+

expect(profile.accountId).toBe("acct-local");

256262

});

257263

});