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

推荐订阅源

量子位
D
Docker
月光博客
月光博客
MongoDB | Blog
MongoDB | Blog
Vercel News
Vercel News
美团技术团队
博客园 - 叶小钗
I
InfoQ
Jina AI
Jina AI
博客园 - 司徒正美
雷峰网
雷峰网
B
Blog
Y
Y Combinator Blog
A
About on SuperTechFans
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
大猫的无限游戏
大猫的无限游戏
Microsoft Security Blog
Microsoft Security Blog
Stack Overflow Blog
Stack Overflow Blog
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Recent Announcements
Recent Announcements
V
V2EX
N
Netflix TechBlog - Medium

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
Fix Codex app-server OAuth harness auth · openclaw/opencl...
jeffjhunter · 2026-05-11 · via Recent Commits to openclaw:main

@@ -3,7 +3,9 @@ import fs from "node:fs/promises";

33

import path from "node:path";

44

import {

55

ensureAuthProfileStore,

6+

ensureAuthProfileStoreWithoutExternalProfiles,

67

loadAuthProfileStoreForSecretsRuntime,

8+

refreshOAuthCredentialForRuntime,

79

resolveAuthProfileOrder,

810

resolveProviderIdForAuth,

911

resolveApiKeyForProfile,

@@ -50,7 +52,11 @@ export async function bridgeCodexAppServerStartOptions(params: {

5052

params.startOptions,

5153

params.agentDir,

5254

);

53-

const store = ensureAuthProfileStore(params.agentDir, { allowKeychainPrompt: false });

55+

const store = ensureCodexAppServerAuthProfileStore({

56+

agentDir: params.agentDir,

57+

authProfileId: params.authProfileId,

58+

config: params.config,

59+

});

5460

const authProfileId = resolveCodexAppServerAuthProfileId({

5561

authProfileId: params.authProfileId,

5662

store,

@@ -88,23 +94,75 @@ export function resolveCodexAppServerAuthProfileIdForAgent(params: {

8894

config?: AuthProfileOrderConfig;

8995

}): string | undefined {

9096

const agentDir = params.agentDir?.trim() || resolveDefaultAgentDir(params.config ?? {});

91-

const store = ensureAuthProfileStore(agentDir, { allowKeychainPrompt: false });

97+

const store = ensureCodexAppServerAuthProfileStore({

98+

agentDir,

99+

authProfileId: params.authProfileId,

100+

config: params.config,

101+

});

92102

return resolveCodexAppServerAuthProfileId({

93103

authProfileId: params.authProfileId,

94104

store,

95105

config: params.config,

96106

});

97107

}

98108109+

function ensureCodexAppServerAuthProfileStore(params: {

110+

agentDir?: string;

111+

authProfileId?: string;

112+

config?: AuthProfileOrderConfig;

113+

}): ReturnType<typeof ensureAuthProfileStore> {

114+

return ensureAuthProfileStore(params.agentDir, {

115+

allowKeychainPrompt: false,

116+

config: params.config,

117+

externalCliProviderIds: [CODEX_APP_SERVER_AUTH_PROVIDER],

118+

...(params.authProfileId ? { externalCliProfileIds: [params.authProfileId] } : {}),

119+

});

120+

}

121+122+

function resolveCodexAppServerAuthProfileStore(params: {

123+

agentDir?: string;

124+

authProfileId?: string;

125+

authProfileStore?: AuthProfileStore;

126+

config?: AuthProfileOrderConfig;

127+

}): AuthProfileStore {

128+

const overlaidStore = ensureCodexAppServerAuthProfileStore({

129+

agentDir: params.agentDir,

130+

authProfileId: params.authProfileId,

131+

config: params.config,

132+

});

133+

if (!params.authProfileStore) {

134+

return overlaidStore;

135+

}

136+

const order =

137+

params.authProfileStore.order || overlaidStore.order

138+

? {

139+

...overlaidStore.order,

140+

...params.authProfileStore.order,

141+

}

142+

: undefined;

143+

return {

144+

...params.authProfileStore,

145+

...(order ? { order } : {}),

146+

profiles: {

147+

...overlaidStore.profiles,

148+

...params.authProfileStore.profiles,

149+

},

150+

};

151+

}

152+99153

export async function resolveCodexAppServerAuthAccountCacheKey(params: {

100154

authProfileId?: string;

101155

authProfileStore?: AuthProfileStore;

102156

agentDir?: string;

103157

config?: AuthProfileOrderConfig;

104158

}): Promise<string | undefined> {

105159

const agentDir = params.agentDir?.trim() || resolveDefaultAgentDir(params.config ?? {});

106-

const store =

107-

params.authProfileStore ?? ensureAuthProfileStore(agentDir, { allowKeychainPrompt: false });

160+

const store = resolveCodexAppServerAuthProfileStore({

161+

agentDir,

162+

authProfileId: params.authProfileId,

163+

authProfileStore: params.authProfileStore,

164+

config: params.config,

165+

});

108166

const profileId = resolveCodexAppServerAuthProfileId({

109167

authProfileId: params.authProfileId,

110168

store,

@@ -292,7 +350,11 @@ async function resolveCodexAppServerAuthProfileLoginParamsInternal(params: {

292350

forceOAuthRefresh?: boolean;

293351

config?: AuthProfileOrderConfig;

294352

}): Promise<CodexLoginAccountParams | undefined> {

295-

const store = ensureAuthProfileStore(params.agentDir, { allowKeychainPrompt: false });

353+

const store = ensureCodexAppServerAuthProfileStore({

354+

agentDir: params.agentDir,

355+

authProfileId: params.authProfileId,

356+

config: params.config,

357+

});

296358

const profileId = resolveCodexAppServerAuthProfileId({

297359

authProfileId: params.authProfileId,

298360

store,

@@ -388,14 +450,38 @@ async function resolveOAuthCredentialForCodexAppServer(

388450

agentDir: params.agentDir,

389451

profileId,

390452

});

391-

const store = ensureAuthProfileStore(ownerAgentDir, { allowKeychainPrompt: false });

453+

const store = ensureCodexAppServerAuthProfileStore({

454+

agentDir: ownerAgentDir,

455+

authProfileId: profileId,

456+

config: params.config,

457+

});

458+

const persistedStore = ensureAuthProfileStoreWithoutExternalProfiles(ownerAgentDir, {

459+

allowKeychainPrompt: false,

460+

});

461+

const persistedCredential = persistedStore.profiles[profileId];

462+

const persistedOAuthCredential =

463+

persistedCredential?.type === "oauth" &&

464+

isCodexAppServerAuthProvider(persistedCredential.provider, params.config)

465+

? persistedCredential

466+

: undefined;

392467

const ownerCredential = store.profiles[profileId];

393-

const credentialForOwner =

468+

const overlaidOAuthCredential =

394469

ownerCredential?.type === "oauth" &&

395470

isCodexAppServerAuthProvider(ownerCredential.provider, params.config)

396471

? ownerCredential

397-

: credential;

398-

if (params.forceRefresh) {

472+

: undefined;

473+

const credentialForOwner = persistedOAuthCredential ?? overlaidOAuthCredential ?? credential;

474+

if (params.forceRefresh && !persistedOAuthCredential && overlaidOAuthCredential) {

475+

const refreshedRuntimeCredential = await refreshOAuthCredentialForRuntime({

476+

credential: overlaidOAuthCredential,

477+

});

478+

if (!refreshedRuntimeCredential?.access?.trim()) {

479+

throw new Error(`Codex app-server auth profile "${profileId}" could not refresh.`);

480+

}

481+

store.profiles[profileId] = refreshedRuntimeCredential;

482+

return refreshedRuntimeCredential;

483+

}

484+

if (params.forceRefresh && persistedOAuthCredential) {

399485

store.profiles[profileId] = { ...credentialForOwner, expires: 0 };

400486

saveAuthProfileStore(store, ownerAgentDir);

401487

}