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

推荐订阅源

爱范儿
爱范儿
WordPress大学
WordPress大学
C
Check Point Blog
GbyAI
GbyAI
U
Unit 42
Google DeepMind News
Google DeepMind News
B
Blog RSS Feed
Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
I
InfoQ
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Hugging Face - Blog
Hugging Face - Blog
Vercel News
Vercel News
博客园 - 【当耐特】
美团技术团队
小众软件
小众软件
S
SegmentFault 最新的问题
Jina AI
Jina AI
阮一峰的网络日志
阮一峰的网络日志
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The Cloudflare Blog
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog

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(models): use synthetic auth expiry for status · openc...
obviyus · 2026-04-26 · via Recent Commits to openclaw:main

@@ -12,6 +12,7 @@ import {

1212

} from "../../agents/auth-health.js";

1313

import { resolveAuthStorePathForDisplay } from "../../agents/auth-profiles/paths.js";

1414

import { ensureAuthProfileStoreWithoutExternalProfiles as ensureAuthProfileStore } from "../../agents/auth-profiles/store.js";

15+

import type { AuthProfileCredential } from "../../agents/auth-profiles/types.js";

1516

import { resolveProfileUnusableUntilForDisplay } from "../../agents/auth-profiles/usage.js";

1617

import { resolveProviderEnvApiKeyCandidates } from "../../agents/model-auth-env-vars.js";

1718

import { resolveEnvApiKey } from "../../agents/model-auth.js";

@@ -29,6 +30,8 @@ import {

2930

resolveAgentModelPrimaryValue,

3031

} from "../../config/model-input.js";

3132

import { getShellEnvAppliedKeys, shouldEnableShellEnvFallback } from "../../infra/shell-env.js";

33+

import type { ProviderSyntheticAuthResult } from "../../plugins/provider-external-auth.types.js";

34+

import { resolveProviderSyntheticAuthWithPlugin } from "../../plugins/provider-runtime.js";

3235

import { resolveRuntimeSyntheticAuthProviderRefs } from "../../plugins/synthetic-auth.runtime.js";

3336

import { type RuntimeEnv, writeRuntimeJson } from "../../runtime.js";

3437

import { normalizeOptionalString } from "../../shared/string-coerce.js";

@@ -57,6 +60,14 @@ let listProbeRuntimePromise: Promise<ListProbeRuntime> | undefined;

57605861

const DISPLAY_MODEL_PARSE_OPTIONS = { allowPluginNormalization: false } as const;

596263+

type StatusSyntheticAuth = {

64+

value: string;

65+

source: string;

66+

credential?: string;

67+

mode?: ProviderSyntheticAuthResult["mode"];

68+

expiresAt?: number;

69+

};

70+6071

function loadProviderUsageRuntime(): Promise<ProviderUsageRuntime> {

6172

providerUsageRuntimePromise ??= import("../../infra/provider-usage.js");

6273

return providerUsageRuntimePromise;

@@ -77,6 +88,56 @@ function loadListProbeRuntime(): Promise<ListProbeRuntime> {

7788

return listProbeRuntimePromise;

7889

}

799091+

function resolveProviderConfigForStatus(

92+

cfg: Awaited<ReturnType<typeof loadModelsConfig>>,

93+

provider: string,

94+

) {

95+

const providers = cfg.models?.providers ?? {};

96+

const direct = providers[provider];

97+

if (direct) {

98+

return direct;

99+

}

100+

const normalized = normalizeProviderId(provider);

101+

return (

102+

providers[normalized] ??

103+

Object.entries(providers).find(([key]) => normalizeProviderId(key) === normalized)?.[1]

104+

);

105+

}

106+107+

function syntheticAuthCredential(

108+

provider: string,

109+

auth: StatusSyntheticAuth,

110+

): AuthProfileCredential | undefined {

111+

if (!auth.mode) {

112+

return undefined;

113+

}

114+

if (auth.mode === "api-key") {

115+

return {

116+

type: "api_key",

117+

provider,

118+

key: auth.credential,

119+

};

120+

}

121+

if (auth.mode === "token") {

122+

return {

123+

type: "token",

124+

provider,

125+

token: auth.credential,

126+

expires: auth.expiresAt,

127+

};

128+

}

129+

if (auth.expiresAt === undefined) {

130+

return undefined;

131+

}

132+

return {

133+

type: "oauth",

134+

provider,

135+

access: auth.credential ?? "",

136+

refresh: "",

137+

expires: auth.expiresAt,

138+

};

139+

}

140+80141

export async function modelsStatusCommand(

81142

opts: {

82143

json?: boolean;

@@ -185,14 +246,30 @@ export async function modelsStatusCommand(

185246

providersFromEnv.add(provider);

186247

}

187248

}

188-

const syntheticAuthByProvider = new Map(

189-

resolveRuntimeSyntheticAuthProviderRefs().map((provider) => [

190-

normalizeProviderId(provider),

191-

{

192-

value: "plugin-owned",

193-

source: "plugin synthetic auth",

249+

const syntheticAuthByProvider = new Map<string, StatusSyntheticAuth>();

250+

for (const provider of resolveRuntimeSyntheticAuthProviderRefs()) {

251+

const normalized = normalizeProviderId(provider);

252+

const resolved = resolveProviderSyntheticAuthWithPlugin({

253+

provider: normalized,

254+

config: cfg,

255+

context: {

256+

config: cfg,

257+

provider: normalized,

258+

providerConfig: resolveProviderConfigForStatus(cfg, normalized),

194259

},

195-

]),

260+

});

261+

syntheticAuthByProvider.set(normalized, {

262+

value: "plugin-owned",

263+

source: resolved?.source ?? "plugin synthetic auth",

264+

credential: resolved?.apiKey,

265+

mode: resolved?.mode,

266+

expiresAt: resolved?.expiresAt,

267+

});

268+

}

269+

const runtimeCredentialsByProvider = new Map(

270+

Array.from(syntheticAuthByProvider.entries())

271+

.map(([provider, auth]) => [provider, syntheticAuthCredential(provider, auth)] as const)

272+

.filter((entry): entry is readonly [string, AuthProfileCredential] => Boolean(entry[1])),

196273

);

197274198275

const providers = Array.from(

@@ -325,6 +402,7 @@ export async function modelsStatusCommand(

325402

store,

326403

cfg,

327404

warnAfterMs: DEFAULT_OAUTH_WARN_MS,

405+

runtimeCredentialsByProvider,

328406

});

329407

const oauthProfiles = authHealth.profiles.filter(

330408

(profile) => profile.type === "oauth" || profile.type === "token",