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

推荐订阅源

WordPress大学
WordPress大学
Vercel News
Vercel News
博客园_首页
Y
Y Combinator Blog
美团技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
阮一峰的网络日志
阮一峰的网络日志
aimingoo的专栏
aimingoo的专栏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MyScale Blog
MyScale Blog
GbyAI
GbyAI
人人都是产品经理
人人都是产品经理
T
Tailwind CSS Blog
MongoDB | Blog
MongoDB | Blog
D
DataBreaches.Net
博客园 - Franky
Engineering at Meta
Engineering at Meta
量子位
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
酷 壳 – CoolShell
酷 壳 – CoolShell
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(models): reset warmed provider auth on hot reload · o...
steipete · 2026-05-22 · via Recent Commits to openclaw:main

@@ -40,6 +40,10 @@ const hoisted = vi.hoisted(() => ({

4040

activeEmbeddedRunSessionKeys: [] as string[],

4141

markRestartAbortedMainSessions: vi.fn(async (_params: unknown) => ({ marked: 1, skipped: 0 })),

4242

runtimeConfig: { value: { session: { store: "/tmp/active-sessions.json" } } as OpenClawConfig },

43+

reloadEvents: [] as string[],

44+

resetModelCatalogCache: vi.fn(() => {}),

45+

clearCurrentProviderAuthState: vi.fn(() => {}),

46+

warmCurrentProviderAuthState: vi.fn(async (_cfg: OpenClawConfig) => {}),

4347

}));

44484549

vi.mock("../hooks/gmail-watcher.js", () => ({

@@ -95,6 +99,24 @@ vi.mock("../config/config.js", () => ({

9599

getRuntimeConfig: () => hoisted.runtimeConfig.value,

96100

}));

97101102+

vi.mock("../agents/model-catalog.js", () => ({

103+

resetModelCatalogCache: () => {

104+

hoisted.reloadEvents.push("reset-model-catalog");

105+

hoisted.resetModelCatalogCache();

106+

},

107+

}));

108+109+

vi.mock("../agents/model-provider-auth.js", () => ({

110+

clearCurrentProviderAuthState: () => {

111+

hoisted.reloadEvents.push("clear-provider-auth");

112+

hoisted.clearCurrentProviderAuthState();

113+

},

114+

warmCurrentProviderAuthState: async (cfg: OpenClawConfig) => {

115+

hoisted.reloadEvents.push("warm-provider-auth");

116+

await hoisted.warmCurrentProviderAuthState(cfg);

117+

},

118+

}));

119+98120

function createReloadHandlersForTest(logReload = { info: vi.fn(), warn: vi.fn() }) {

99121

const cron = { start: vi.fn(async () => {}), stop: vi.fn() };

100122

const heartbeatRunner = {

@@ -139,6 +161,76 @@ afterEach(() => {

139161

hoisted.activeEmbeddedRunSessionKeys.length = 0;

140162

hoisted.markRestartAbortedMainSessions.mockClear();

141163

hoisted.runtimeConfig.value = { session: { store: "/tmp/active-sessions.json" } };

164+

hoisted.reloadEvents.length = 0;

165+

hoisted.resetModelCatalogCache.mockClear();

166+

hoisted.clearCurrentProviderAuthState.mockClear();

167+

hoisted.warmCurrentProviderAuthState.mockClear();

168+

});

169+170+

describe("gateway hot reload model state", () => {

171+

it("resets prepared model runtime state for every hot reload and rewarms after plugin reload", async () => {

172+

const reloadPlugins = vi.fn(async (): Promise<GatewayPluginReloadResult> => {

173+

hoisted.reloadEvents.push("reload-plugins");

174+

return {

175+

restartChannels: new Set(),

176+

activeChannels: new Set(),

177+

};

178+

});

179+

const { applyHotReload } = createGatewayReloadHandlers({

180+

deps: {} as never,

181+

broadcast: vi.fn(),

182+

getState: () => ({

183+

hooksConfig: {} as never,

184+

hookClientIpConfig: {} as never,

185+

heartbeatRunner: { stop: vi.fn(), updateConfig: vi.fn() } as never,

186+

cronState: {

187+

cron: { start: vi.fn(async () => {}), stop: vi.fn() },

188+

storePath: "/tmp/cron.json",

189+

cronEnabled: false,

190+

} as never,

191+

channelHealthMonitor: null,

192+

}),

193+

setState: vi.fn(),

194+

startChannel: vi.fn(async () => {}),

195+

stopChannel: vi.fn(async () => {}),

196+

reloadPlugins,

197+

logHooks: { info: vi.fn(), warn: vi.fn(), error: vi.fn() },

198+

logChannels: { info: vi.fn(), error: vi.fn() },

199+

logCron: { error: vi.fn() },

200+

logReload: { info: vi.fn(), warn: vi.fn() },

201+

createHealthMonitor: () => null,

202+

});

203+204+

const nextConfig = { plugins: { enabled: true } } as OpenClawConfig;

205+

await applyHotReload(

206+

{

207+

changedPaths: ["plugins.enabled"],

208+

restartGateway: false,

209+

restartReasons: [],

210+

hotReasons: ["plugins.enabled"],

211+

reloadHooks: false,

212+

restartGmailWatcher: false,

213+

restartCron: false,

214+

restartHeartbeat: false,

215+

restartHealthMonitor: false,

216+

reloadPlugins: true,

217+

restartChannels: new Set(),

218+

disposeMcpRuntimes: false,

219+

noopPaths: [],

220+

},

221+

nextConfig,

222+

);

223+224+

expect(hoisted.reloadEvents).toEqual([

225+

"reset-model-catalog",

226+

"clear-provider-auth",

227+

"reload-plugins",

228+

"reset-model-catalog",

229+

"clear-provider-auth",

230+

"warm-provider-auth",

231+

]);

232+

expect(hoisted.warmCurrentProviderAuthState).toHaveBeenCalledWith(nextConfig);

233+

});

142234

});

143235144236

describe("gateway restart deferral preflight", () => {