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

推荐订阅源

aimingoo的专栏
aimingoo的专栏
B
Blog RSS Feed
Recent Announcements
Recent Announcements
Vercel News
Vercel News
M
MIT News - Artificial intelligence
阮一峰的网络日志
阮一峰的网络日志
L
LangChain Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
H
Help Net Security
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog
G
Google Developers Blog
罗磊的独立博客
爱范儿
爱范儿
宝玉的分享
宝玉的分享
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园_首页
S
SegmentFault 最新的问题
WordPress大学
WordPress大学
月光博客
月光博客
人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research

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

@@ -28,6 +28,14 @@ const {

2828

formatProviderAuthProfileApiKeyWithPluginMock,

2929

} = getOAuthProviderRuntimeMocks();

303031+

function requireOAuthCredential(store: AuthProfileStore, profileId: string): OAuthCredential {

32+

const profile = store.profiles[profileId];

33+

if (!profile || profile.type !== "oauth") {

34+

throw new Error(`expected OAuth credential for ${profileId}`);

35+

}

36+

return profile;

37+

}

38+3139

vi.mock("@mariozechner/pi-ai/oauth", () => ({

3240

getOAuthProviders: () => [{ id: "anthropic" }, { id: "openai-codex" }],

3341

getOAuthApiKey: vi.fn(async (provider: string, credentials: Record<string, OAuthCredential>) => {

@@ -113,11 +121,10 @@ describe("resolveApiKeyForProfile OAuth refresh mirror-to-main (#26322)", () =>

113121

const mainRaw = JSON.parse(

114122

await fs.readFile(path.join(mainAgentDir, "auth-profiles.json"), "utf8"),

115123

) as AuthProfileStore;

116-

expect(mainRaw.profiles[profileId]).toMatchObject({

117-

access: "sub-refreshed-access",

118-

refresh: "sub-refreshed-refresh",

119-

expires: freshExpiry,

120-

});

124+

const mainCredential = requireOAuthCredential(mainRaw, profileId);

125+

expect(mainCredential.access).toBe("sub-refreshed-access");

126+

expect(mainCredential.refresh).toBe("sub-refreshed-refresh");

127+

expect(mainCredential.expires).toBe(freshExpiry);

121128

});

122129123130

it("does not mirror when refresh was performed from the main agent itself", async () => {

@@ -154,11 +161,10 @@ describe("resolveApiKeyForProfile OAuth refresh mirror-to-main (#26322)", () =>

154161

const mainRaw = JSON.parse(

155162

await fs.readFile(path.join(mainAgentDir, "auth-profiles.json"), "utf8"),

156163

) as AuthProfileStore;

157-

expect(mainRaw.profiles[profileId]).toMatchObject({

158-

access: "main-refreshed-access",

159-

refresh: "main-refreshed-refresh",

160-

expires: freshExpiry,

161-

});

164+

const mainCredential = requireOAuthCredential(mainRaw, profileId);

165+

expect(mainCredential.access).toBe("main-refreshed-access");

166+

expect(mainCredential.refresh).toBe("main-refreshed-refresh");

167+

expect(mainCredential.expires).toBe(freshExpiry);

162168

expect(refreshProviderOAuthCredentialWithPluginMock).toHaveBeenCalledTimes(1);

163169

});

164170

@@ -326,19 +332,17 @@ describe("resolveApiKeyForProfile OAuth refresh mirror-to-main (#26322)", () =>

326332

const subRaw = JSON.parse(

327333

await fs.readFile(path.join(subAgentDir, "auth-profiles.json"), "utf8"),

328334

) as AuthProfileStore;

329-

expect(subRaw.profiles[profileId]).toMatchObject({

330-

access: "local-stale-access",

331-

refresh: "local-stale-refresh",

332-

});

335+

const subCredential = requireOAuthCredential(subRaw, profileId);

336+

expect(subCredential.access).toBe("local-stale-access");

337+

expect(subCredential.refresh).toBe("local-stale-refresh");

333338334339

const mainRaw = JSON.parse(

335340

await fs.readFile(path.join(mainAgentDir, "auth-profiles.json"), "utf8"),

336341

) as AuthProfileStore;

337-

expect(mainRaw.profiles[profileId]).toMatchObject({

338-

access: "main-owner-refreshed-access",

339-

refresh: "main-owner-refreshed-refresh",

340-

expires: freshExpiry,

341-

});

342+

const mainCredential = requireOAuthCredential(mainRaw, profileId);

343+

expect(mainCredential.access).toBe("main-owner-refreshed-access");

344+

expect(mainCredential.refresh).toBe("main-owner-refreshed-refresh");

345+

expect(mainCredential.expires).toBe(freshExpiry);

342346

});

343347344348

it("inherits main-agent credentials via the catch-block fallback when refresh throws after main becomes fresh", async () => {

@@ -406,9 +410,7 @@ describe("resolveApiKeyForProfile OAuth refresh mirror-to-main (#26322)", () =>

406410

const subRaw = JSON.parse(

407411

await fs.readFile(path.join(subAgentDir, "auth-profiles.json"), "utf8"),

408412

) as AuthProfileStore;

409-

expect(subRaw.profiles[profileId]).toMatchObject({

410-

access: "cached-access-token",

411-

});

413+

expect(requireOAuthCredential(subRaw, profileId).access).toBe("cached-access-token");

412414

});

413415414416

it("mirrors refreshed credentials produced by the plugin-refresh path", async () => {

@@ -446,10 +448,9 @@ describe("resolveApiKeyForProfile OAuth refresh mirror-to-main (#26322)", () =>

446448

const mainRaw = JSON.parse(

447449

await fs.readFile(path.join(mainAgentDir, "auth-profiles.json"), "utf8"),

448450

) as AuthProfileStore;

449-

expect(mainRaw.profiles[profileId]).toMatchObject({

450-

access: "plugin-refreshed-access",

451-

refresh: "plugin-refreshed-refresh",

452-

expires: freshExpiry,

453-

});

451+

const mainCredential = requireOAuthCredential(mainRaw, profileId);

452+

expect(mainCredential.access).toBe("plugin-refreshed-access");

453+

expect(mainCredential.refresh).toBe("plugin-refreshed-refresh");

454+

expect(mainCredential.expires).toBe(freshExpiry);

454455

});

455456

});