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

推荐订阅源

Jina AI
Jina AI
T
The Blog of Author Tim Ferriss
B
Blog
L
LangChain Blog
Y
Y Combinator Blog
美团技术团队
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
G
Google Developers Blog
量子位
博客园_首页
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
C
Check Point Blog
D
Docker
小众软件
小众软件
The Cloudflare Blog
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 聂微东
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
Google DeepMind News
Google DeepMind News
IT之家
IT之家

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(agents): infer runtime provider from qualified model ...
yu-xin-c · 2026-06-23 · via Recent Commits to openclaw:main

@@ -88,6 +88,17 @@ function parseProviderModelKey(key: string): { provider: string; modelId: string

8888

return provider && modelId ? { provider, modelId } : undefined;

8989

}

909091+

function resolveEffectiveProvider(

92+

provider: string | undefined,

93+

modelId: string | undefined,

94+

): string | undefined {

95+

const normalizedProvider = normalizeProviderId(provider ?? "");

96+

if (normalizedProvider) {

97+

return normalizedProvider;

98+

}

99+

return parseProviderModelKey(modelId?.trim() ?? "")?.provider;

100+

}

101+91102

function providerMatchesCaller(provider: string, callerProvider: string): boolean {

92103

return !callerProvider || provider === callerProvider;

93104

}

@@ -96,11 +107,15 @@ function resolvePolicyMatch(

96107

matches: AgentModelRuntimePolicyMatch[],

97108

callerProvider: string,

98109

): AgentModelRuntimePolicyResolution {

99-

const [first] = matches;

110+

const providerMatches = callerProvider

111+

? matches.filter((match) => match.provider === callerProvider)

112+

: [];

113+

const candidates = providerMatches.length > 0 ? providerMatches : matches;

114+

const [first] = candidates;

100115

if (!first) {

101116

return {};

102117

}

103-

if (!callerProvider && matches.some((match) => match.provider !== first.provider)) {

118+

if (!callerProvider && candidates.some((match) => match.provider !== first.provider)) {

104119

return { ambiguous: true };

105120

}

106121

return {

@@ -237,38 +252,54 @@ export function resolveModelRuntimePolicy(params: {

237252

agentId?: string;

238253

sessionKey?: string;

239254

}): ResolvedModelRuntimePolicy {

255+

const callerProvider = normalizeProviderId(params.provider ?? "");

256+

const effectiveProvider = resolveEffectiveProvider(params.provider, params.modelId);

257+

const inferredMatchedProvider = callerProvider ? undefined : effectiveProvider;

240258

if (process.env.OPENCLAW_BUILD_PRIVATE_QA === "1") {

241259

const forcedRuntime = process.env.OPENCLAW_QA_FORCE_RUNTIME?.trim().toLowerCase();

242260

if (forcedRuntime === "openclaw" || forcedRuntime === "codex") {

243261

return { policy: { id: forcedRuntime }, source: "model" };

244262

}

245263

}

246264247-

const agentModelPolicy = resolveAgentModelEntryRuntimePolicy({ ...params, matchKind: "exact" });

265+

const agentModelPolicy = resolveAgentModelEntryRuntimePolicy({

266+

...params,

267+

provider: effectiveProvider,

268+

matchKind: "exact",

269+

});

248270

if (agentModelPolicy.ambiguous) {

249271

return {};

250272

}

251273

if (agentModelPolicy.policy) {

252274

return agentModelPolicy;

253275

}

254-

const providerConfig = resolveProviderConfig(params.config, params.provider);

276+

const providerConfig = resolveProviderConfig(params.config, effectiveProvider);

255277

const modelConfig = resolveModelConfig({

256278

providerConfig,

257-

provider: params.provider,

279+

provider: effectiveProvider,

258280

modelId: params.modelId,

259281

});

260282

if (hasRuntimePolicy(modelConfig?.agentRuntime)) {

261-

return { policy: modelConfig?.agentRuntime, source: "model" };

283+

return {

284+

policy: modelConfig?.agentRuntime,

285+

source: "model",

286+

...(inferredMatchedProvider ? { matchedProvider: inferredMatchedProvider } : {}),

287+

};

262288

}

263289

const agentWildcardModelPolicy = resolveAgentModelEntryRuntimePolicy({

264290

...params,

291+

provider: effectiveProvider,

265292

matchKind: "provider-wildcard",

266293

});

267294

if (agentWildcardModelPolicy.policy) {

268295

return agentWildcardModelPolicy;

269296

}

270297

if (hasRuntimePolicy(providerConfig?.agentRuntime)) {

271-

return { policy: providerConfig?.agentRuntime, source: "provider" };

298+

return {

299+

policy: providerConfig?.agentRuntime,

300+

source: "provider",

301+

...(inferredMatchedProvider ? { matchedProvider: inferredMatchedProvider } : {}),

302+

};

272303

}

273304

return {};

274305

}