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

推荐订阅源

L
LangChain Blog
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
MyScale Blog
MyScale Blog
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
GbyAI
GbyAI
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
Martin Fowler
Martin Fowler
Vercel News
Vercel News
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
Last Week in AI
Last Week in AI
Hugging Face - Blog
Hugging Face - Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
Google DeepMind News
Google DeepMind News
Engineering at Meta
Engineering at Meta
云风的 BLOG
云风的 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
refactor(doctor): share primary model resolution · opencl...
vincentkoc · 2026-06-22 · via Recent Commits to openclaw:main

@@ -3,19 +3,17 @@ import { normalizeProviderId } from "@openclaw/model-catalog-core/provider-id";

33

import { isRecord as hasRecord } from "@openclaw/normalization-core/record-coerce";

44

import { normalizeLowercaseStringOrEmpty } from "@openclaw/normalization-core/string-coerce";

55

import { resolveAgentConfig } from "../../../agents/agent-scope-config.js";

6-

import { DEFAULT_MODEL, DEFAULT_PROVIDER } from "../../../agents/defaults.js";

7-

import { parseModelRef } from "../../../agents/model-selection-normalize.js";

86

import { pickSandboxToolPolicy } from "../../../agents/sandbox-tool-policy.js";

97

import {

108

isToolAllowedByPolicies,

119

isToolAllowedByPolicyName,

1210

} from "../../../agents/tool-policy-match.js";

1311

import { mergeAlsoAllowPolicy, resolveToolProfilePolicy } from "../../../agents/tool-policy.js";

14-

import { resolveAgentModelPrimaryValue } from "../../../config/model-input.js";

1512

import type { OpenClawConfig } from "../../../config/types.openclaw.js";

1613

import type { AgentToolsConfig, ToolsConfig } from "../../../config/types.tools.js";

1714

import { collectChannelRouteTargets } from "../../../routing/channel-route-targets.js";

1815

import { createLazyImportLoader } from "../../../shared/lazy-promise.js";

16+

import { resolveDoctorPrimaryModelRef } from "./primary-model-ref.js";

19172018

type ChannelDoctorModule = typeof import("./channel-doctor.js");

2119

@@ -148,7 +146,7 @@ function resolveMessageToolAvailability(params: {

148146

runtimeAlsoAllow?: string[];

149147

}): boolean {

150148

const agentConfig = params.agentId ? resolveAgentConfig(params.cfg, params.agentId) : undefined;

151-

const modelRef = resolvePrimaryModelRef(params.cfg, agentConfig?.model);

149+

const modelRef = resolveDoctorPrimaryModelRef(params.cfg, agentConfig?.model);

152150

const providerPolicy = resolveProviderToolPolicy({

153151

byProvider: params.globalTools?.byProvider,

154152

modelProvider: modelRef.provider,

@@ -189,22 +187,6 @@ function resolveMessageToolAvailability(params: {

189187190188

const SOURCE_REPLY_RUNTIME_MESSAGE_ALLOW = ["message"];

191189192-

function resolvePrimaryModelRef(

193-

cfg: OpenClawConfig,

194-

agentModel?: NonNullable<ReturnType<typeof resolveAgentConfig>>["model"],

195-

): { provider: string; model: string } {

196-

const raw =

197-

resolveAgentModelPrimaryValue(agentModel) ??

198-

resolveAgentModelPrimaryValue(cfg.agents?.defaults?.model) ??

199-

DEFAULT_MODEL;

200-

return (

201-

parseModelRef(raw, DEFAULT_PROVIDER, { allowPluginNormalization: false }) ?? {

202-

provider: DEFAULT_PROVIDER,

203-

model: DEFAULT_MODEL,

204-

}

205-

);

206-

}

207-208190

function resolveSourceReplyMessageToolAvailability(params: {

209191

cfg: OpenClawConfig;

210192

agentId?: string;

@@ -705,7 +687,7 @@ export function collectProfileConfiguredToolSectionWarnings(cfg: OpenClawConfig)

705687

const agentTools = hasRecord(agent.tools) ? agent.tools : undefined;

706688

const agentId = typeof agent.id === "string" ? agent.id : undefined;

707689

const agentConfig = agentId ? resolveAgentConfig(cfg, agentId) : undefined;

708-

const modelRef = resolvePrimaryModelRef(cfg, agentConfig?.model);

690+

const modelRef = resolveDoctorPrimaryModelRef(cfg, agentConfig?.model);

709691

const agentPath = `agents.list[${index}].tools`;

710692

const includeInheritedSections =

711693

agentTools !== undefined && typeof agentTools.profile !== "string";