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

推荐订阅源

人人都是产品经理
人人都是产品经理
博客园_首页
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
小众软件
小众软件
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
博客园 - 【当耐特】
Apple Machine Learning Research
Apple Machine Learning Research
罗磊的独立博客
V
V2EX
酷 壳 – CoolShell
酷 壳 – CoolShell
IT之家
IT之家
量子位
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Recent Announcements
Recent Announcements
M
MIT News - Artificial intelligence
阮一峰的网络日志
阮一峰的网络日志
The GitHub Blog
The GitHub 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
fix(gateway): harden local reachability checks · openclaw...
steipete · 2026-04-29 · via Recent Commits to openclaw:main

@@ -8,6 +8,7 @@ const mocks = vi.hoisted(() => ({

88

buildGatewayConnectionDetailsWithResolvers: vi.fn(),

99

resolveGatewayProbeTarget: vi.fn(),

1010

probeGateway: vi.fn(),

11+

callGateway: vi.fn(),

1112

resolveGatewayProbeAuthResolution: vi.fn(),

1213

pickGatewaySelfPresence: vi.fn(),

1314

}));

@@ -24,6 +25,10 @@ vi.mock("../gateway/probe.js", () => ({

2425

probeGateway: mocks.probeGateway,

2526

}));

262728+

vi.mock("../gateway/call.js", () => ({

29+

callGateway: mocks.callGateway,

30+

}));

31+2732

vi.mock("./status.gateway-probe.js", () => ({

2833

resolveGatewayProbeAuthResolution: mocks.resolveGatewayProbeAuthResolution,

2934

}));

@@ -50,6 +55,7 @@ describe("resolveGatewayProbeSnapshot", () => {

5055

warning: "warn",

5156

});

5257

mocks.pickGatewaySelfPresence.mockReturnValue({ host: "box" });

58+

mocks.callGateway.mockRejectedValue(new Error("status rpc unavailable"));

5359

});

54605561

it("skips auth resolution and probe for missing remote urls by default", async () => {

@@ -178,6 +184,138 @@ describe("resolveGatewayProbeSnapshot", () => {

178184

expect(result.gatewayReachable).toBe(true);

179185

expect(result.gatewayProbe?.error).toBe("missing scope: operator.read; warn");

180186

});

187+188+

it("uses a bounded local status RPC fallback when the detail probe times out", async () => {

189+

mocks.resolveGatewayProbeTarget.mockReturnValue({

190+

mode: "local",

191+

gatewayMode: "local",

192+

remoteUrlMissing: false,

193+

});

194+

mocks.probeGateway.mockResolvedValue({

195+

ok: false,

196+

url: "ws://127.0.0.1:18789",

197+

connectLatencyMs: null,

198+

error: "timeout",

199+

close: null,

200+

auth: {

201+

role: null,

202+

scopes: [],

203+

capability: "unknown",

204+

},

205+

health: null,

206+

status: null,

207+

presence: null,

208+

configSnapshot: null,

209+

});

210+

mocks.callGateway.mockResolvedValue({ sessions: 1 });

211+212+

const result = await resolveGatewayProbeSnapshot({

213+

cfg: {},

214+

opts: {

215+

timeoutMs: 8000,

216+

},

217+

});

218+219+

expect(mocks.callGateway).toHaveBeenCalledWith(

220+

expect.objectContaining({

221+

config: {},

222+

method: "status",

223+

token: "tok",

224+

password: "pw",

225+

timeoutMs: 2000,

226+

mode: "backend",

227+

clientName: "gateway-client",

228+

}),

229+

);

230+

expect(mocks.callGateway.mock.calls[0]?.[0]).not.toHaveProperty("deviceIdentity");

231+

expect(result.gatewayReachable).toBe(true);

232+

expect(result.gatewayProbe).toMatchObject({

233+

ok: true,

234+

error: "timeout",

235+

status: { sessions: 1 },

236+

auth: { capability: "read_only" },

237+

});

238+

expect(result.gatewayProbeAuthWarning).toBe("warn");

239+

});

240+241+

it("lets callGateway reuse paired-device auth for local status RPC fallback", async () => {

242+

mocks.resolveGatewayProbeTarget.mockReturnValue({

243+

mode: "local",

244+

gatewayMode: "local",

245+

remoteUrlMissing: false,

246+

});

247+

mocks.resolveGatewayProbeAuthResolution.mockResolvedValue({

248+

auth: {},

249+

warning: undefined,

250+

});

251+

mocks.probeGateway.mockResolvedValue({

252+

ok: false,

253+

url: "ws://127.0.0.1:18789",

254+

connectLatencyMs: null,

255+

error: "timeout",

256+

close: null,

257+

auth: {

258+

role: "operator",

259+

scopes: ["operator.read"],

260+

capability: "read_only",

261+

},

262+

health: null,

263+

status: null,

264+

presence: null,

265+

configSnapshot: null,

266+

});

267+

mocks.callGateway.mockResolvedValue({ sessions: 1 });

268+269+

const result = await resolveGatewayProbeSnapshot({

270+

cfg: {},

271+

opts: {},

272+

});

273+274+

expect(mocks.callGateway).toHaveBeenCalledWith(

275+

expect.objectContaining({

276+

config: {},

277+

method: "status",

278+

token: undefined,

279+

password: undefined,

280+

mode: "backend",

281+

clientName: "gateway-client",

282+

}),

283+

);

284+

expect(mocks.callGateway.mock.calls[0]?.[0]).not.toHaveProperty("deviceIdentity");

285+

expect(result.gatewayReachable).toBe(true);

286+

});

287+288+

it("does not use the status RPC fallback for remote probe failures", async () => {

289+

mocks.resolveGatewayProbeTarget.mockReturnValue({

290+

mode: "remote",

291+

gatewayMode: "remote",

292+

remoteUrlMissing: false,

293+

});

294+

mocks.probeGateway.mockResolvedValue({

295+

ok: false,

296+

url: "wss://gateway.example/ws",

297+

connectLatencyMs: null,

298+

error: "timeout",

299+

close: null,

300+

auth: {

301+

role: null,

302+

scopes: [],

303+

capability: "unknown",

304+

},

305+

health: null,

306+

status: null,

307+

presence: null,

308+

configSnapshot: null,

309+

});

310+311+

const result = await resolveGatewayProbeSnapshot({

312+

cfg: { gateway: { mode: "remote", remote: { url: "wss://gateway.example/ws" } } },

313+

opts: {},

314+

});

315+316+

expect(mocks.callGateway).not.toHaveBeenCalled();

317+

expect(result.gatewayReachable).toBe(false);

318+

});

181319

});

182320183321

describe("resolveSharedMemoryStatusSnapshot", () => {