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

推荐订阅源

博客园 - 【当耐特】
云风的 BLOG
云风的 BLOG
罗磊的独立博客
C
Check Point Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Blog — PlanetScale
Blog — PlanetScale
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园_首页
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
I
InfoQ
Hugging Face - Blog
Hugging Face - Blog
T
Tailwind CSS Blog
B
Blog RSS Feed

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(gateway): isolate gmail watcher restart and abort han...
samzong · 2026-05-16 · via Recent Commits to openclaw:main

@@ -4,6 +4,8 @@ import type { GatewayPluginReloadResult } from "./server-reload-handlers.js";

44

import { createGatewayReloadHandlers } from "./server-reload-handlers.js";

5566

const hoisted = vi.hoisted(() => ({

7+

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

8+

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

79

activeTaskCount: { value: 0 },

810

activeTaskBlockers: [] as Array<{

911

taskId: string;

@@ -15,6 +17,14 @@ const hoisted = vi.hoisted(() => ({

1517

}>,

1618

}));

171920+

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

21+

stopGmailWatcher: hoisted.stopGmailWatcher,

22+

}));

23+24+

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

25+

startGmailWatcherWithLogs: hoisted.startGmailWatcherWithLogs,

26+

}));

27+1828

vi.mock("../tasks/task-registry.maintenance.js", async () => {

1929

const actual = await vi.importActual<typeof import("../tasks/task-registry.maintenance.js")>(

2030

"../tasks/task-registry.maintenance.js",

@@ -65,6 +75,7 @@ function createReloadHandlersForTest(logReload = { info: vi.fn(), warn: vi.fn()

6575

setState: vi.fn(),

6676

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

6777

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

78+

stopPostReadySidecars: vi.fn(),

6879

reloadPlugins: vi.fn(

6980

async (): Promise<GatewayPluginReloadResult> => ({

7081

restartChannels: new Set(),

@@ -80,6 +91,8 @@ function createReloadHandlersForTest(logReload = { info: vi.fn(), warn: vi.fn()

8091

}

81928293

afterEach(() => {

94+

hoisted.startGmailWatcherWithLogs.mockClear();

95+

hoisted.stopGmailWatcher.mockClear();

8396

hoisted.activeTaskCount.value = 0;

8497

hoisted.activeTaskBlockers.length = 0;

8598

});

@@ -158,6 +171,69 @@ describe("gateway restart deferral preflight", () => {

158171

});

159172

});

160173174+

describe("gateway Gmail hot reload handlers", () => {

175+

it("stops queued post-ready sidecars before restarting Gmail watcher", async () => {

176+

const stopPostReadySidecars = vi.fn();

177+

const { applyHotReload } = createGatewayReloadHandlers({

178+

deps: {} as never,

179+

broadcast: vi.fn(),

180+

getState: () => ({

181+

hooksConfig: {} as never,

182+

hookClientIpConfig: {} as never,

183+

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

184+

cronState: {

185+

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

186+

storePath: "/tmp/cron.json",

187+

cronEnabled: false,

188+

} as never,

189+

channelHealthMonitor: null,

190+

}),

191+

setState: vi.fn(),

192+

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

193+

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

194+

stopPostReadySidecars,

195+

reloadPlugins: vi.fn(

196+

async (): Promise<GatewayPluginReloadResult> => ({

197+

restartChannels: new Set(),

198+

activeChannels: new Set(),

199+

}),

200+

),

201+

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

202+

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

203+

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

204+

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

205+

createHealthMonitor: () => null,

206+

});

207+

const nextConfig = {

208+

hooks: { enabled: true, gmail: { account: "next@example.com" } },

209+

} as never;

210+211+

await applyHotReload(

212+

{

213+

changedPaths: ["hooks.gmail.account"],

214+

restartGateway: false,

215+

restartReasons: [],

216+

hotReasons: ["hooks.gmail.account"],

217+

reloadHooks: false,

218+

restartGmailWatcher: true,

219+

restartCron: false,

220+

restartHeartbeat: false,

221+

restartHealthMonitor: false,

222+

reloadPlugins: false,

223+

restartChannels: new Set(),

224+

disposeMcpRuntimes: false,

225+

noopPaths: [],

226+

},

227+

nextConfig,

228+

);

229+230+

expect(stopPostReadySidecars).toHaveBeenCalledBefore(hoisted.stopGmailWatcher);

231+

expect(hoisted.startGmailWatcherWithLogs).toHaveBeenCalledWith(

232+

expect.objectContaining({ cfg: nextConfig }),

233+

);

234+

});

235+

});

236+161237

describe("gateway plugin hot reload handlers", () => {

162238

it("stops removed channel plugins from broad activation before swapping plugin runtime", async () => {

163239

const previousSkipChannels = process.env.OPENCLAW_SKIP_CHANNELS;