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

推荐订阅源

IT之家
IT之家
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
About on SuperTechFans
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog RSS Feed
U
Unit 42
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
雷峰网
雷峰网
罗磊的独立博客
Microsoft Security Blog
Microsoft Security Blog
Hugging Face - Blog
Hugging Face - Blog
L
LangChain Blog
人人都是产品经理
人人都是产品经理
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
P
Proofpoint News Feed
The Cloudflare Blog
D
Docker
大猫的无限游戏
大猫的无限游戏

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: keep model catalog reads read-only · openclaw/opencl...
shakkernerd · 2026-04-24 · via Recent Commits to openclaw:main

@@ -81,15 +81,17 @@ function instantiatePiModelRegistry(

8181

export async function loadModelCatalog(params?: {

8282

config?: OpenClawConfig;

8383

useCache?: boolean;

84+

readOnly?: boolean;

8485

}): Promise<ModelCatalogEntry[]> {

85-

if (params?.useCache === false) {

86+

const readOnly = params?.readOnly === true;

87+

if (!readOnly && params?.useCache === false) {

8688

modelCatalogPromise = null;

8789

}

88-

if (modelCatalogPromise) {

90+

if (!readOnly && modelCatalogPromise) {

8991

return modelCatalogPromise;

9092

}

919392-

modelCatalogPromise = (async () => {

94+

const loadCatalog = async () => {

9395

const models: ModelCatalogEntry[] = [];

9496

const timingEnabled = shouldLogModelCatalogTiming();

9597

const startMs = timingEnabled ? Date.now() : 0;

@@ -110,8 +112,10 @@ export async function loadModelCatalog(params?: {

110112

});

111113

try {

112114

const cfg = params?.config ?? loadConfig();

113-

await ensureOpenClawModelsJson(cfg);

114-

logStage("models-json-ready");

115+

if (!readOnly) {

116+

await ensureOpenClawModelsJson(cfg);

117+

logStage("models-json-ready");

118+

}

115119

// IMPORTANT: keep the dynamic import *inside* the try/catch.

116120

// If this fails once (e.g. during a pnpm install that temporarily swaps node_modules),

117121

// we must not poison the cache with a rejected promise (otherwise all channel handlers

@@ -121,7 +125,10 @@ export async function loadModelCatalog(params?: {

121125

const agentDir = resolveOpenClawAgentDir();

122126

const { shouldSuppressBuiltInModel } = await loadModelSuppression();

123127

logStage("catalog-deps-ready");

124-

const authStorage = piSdk.discoverAuthStorage(agentDir);

128+

const authStorage = piSdk.discoverAuthStorage(

129+

agentDir,

130+

readOnly ? { readOnly: true } : undefined,

131+

);

125132

logStage("auth-storage-ready");

126133

const registry = instantiatePiModelRegistry(

127134

piSdk,

@@ -182,7 +189,9 @@ export async function loadModelCatalog(params?: {

182189183190

if (models.length === 0) {

184191

// If we found nothing, don't cache this result so we can try again.

185-

modelCatalogPromise = null;

192+

if (!readOnly) {

193+

modelCatalogPromise = null;

194+

}

186195

}

187196188197

const sorted = sortModels(models);

@@ -194,14 +203,21 @@ export async function loadModelCatalog(params?: {

194203

log.warn(`Failed to load model catalog: ${String(error)}`);

195204

}

196205

// Don't poison the cache on transient dependency/filesystem issues.

197-

modelCatalogPromise = null;

206+

if (!readOnly) {

207+

modelCatalogPromise = null;

208+

}

198209

if (models.length > 0) {

199210

return sortModels(models);

200211

}

201212

return [];

202213

}

203-

})();

214+

};

215+216+

if (readOnly) {

217+

return loadCatalog();

218+

}

204219220+

modelCatalogPromise = loadCatalog();

205221

return modelCatalogPromise;

206222

}

207223