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

推荐订阅源

GbyAI
GbyAI
B
Blog
Stack Overflow Blog
Stack Overflow Blog
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tailwind CSS Blog
MongoDB | Blog
MongoDB | Blog
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
Recent Announcements
Recent Announcements
U
Unit 42
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
腾讯CDC
D
DataBreaches.Net
Microsoft Azure Blog
Microsoft Azure Blog
G
Google Developers Blog
M
MIT News - Artificial intelligence
P
Proofpoint News Feed
罗磊的独立博客
L
LangChain Blog
V
Visual Studio Blog
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
宝玉的分享
宝玉的分享

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
perf(cli): narrow gateway dispatch startup · openclaw/ope...
steipete · 2026-05-31 · via Recent Commits to openclaw:main

@@ -10,6 +10,8 @@ import { agentCliCommand, agentViaGatewayTesting } from "./agent-via-gateway.js"

1010

import type { agentCommand as AgentCommand } from "./agent.js";

11111212

const loadConfig = vi.hoisted(() => vi.fn());

13+

const loadConfigWithShellEnvFallback = vi.hoisted(() => vi.fn());

14+

const loadRuntimeConfig = vi.hoisted(() => vi.fn());

1315

const callGateway = vi.hoisted(() => vi.fn());

1416

const isGatewayCredentialsRequiredError = vi.hoisted(() =>

1517

vi.fn(

@@ -49,7 +51,7 @@ const jsonRuntime = {

4951

};

50525153

function mockConfig(storePath: string, overrides?: Partial<OpenClawConfig>) {

52-

loadConfig.mockReturnValue({

54+

const config = {

5355

agents: {

5456

defaults: {

5557

timeoutSeconds: 600,

@@ -63,7 +65,10 @@ function mockConfig(storePath: string, overrides?: Partial<OpenClawConfig>) {

6365

...overrides?.session,

6466

},

6567

gateway: overrides?.gateway,

66-

});

68+

};

69+

loadConfig.mockReturnValue(config);

70+

loadConfigWithShellEnvFallback.mockResolvedValue(config);

71+

loadRuntimeConfig.mockReturnValue(config);

6772

}

68736974

async function withTempStore(

@@ -217,7 +222,14 @@ function createGatewayNormalCloseError() {

217222

});

218223

}

219224220-

vi.mock("../config/io.js", () => ({ getRuntimeConfig: loadConfig, loadConfig }));

225+

vi.mock("../config/gateway-dispatch-config.js", () => ({

226+

readGatewayDispatchConfig: loadConfig,

227+

readGatewayDispatchConfigWithShellEnvFallback: loadConfigWithShellEnvFallback,

228+

}));

229+

vi.mock("../config/io.js", () => ({

230+

getRuntimeConfig: loadRuntimeConfig,

231+

loadConfig: loadRuntimeConfig,

232+

}));

221233

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

222234

callGateway,

223235

isGatewayCredentialsRequiredError,

@@ -344,11 +356,7 @@ describe("agentCliCommand", () => {

344356

expect(params.sessionId).toBeUndefined();

345357

expect(params.to).toBeUndefined();

346358

expect(request.config).toBe(loadConfig.mock.results[0]?.value);

347-

expect(loadConfig).toHaveBeenCalledWith({

348-

skipPluginValidation: true,

349-

pin: false,

350-

skipShellEnvFallback: true,

351-

});

359+

expect(loadConfig).toHaveBeenCalledWith();

352360

expect(agentCommand).not.toHaveBeenCalled();

353361

expect(loadAgentSessionModuleMock).not.toHaveBeenCalled();

354362

});

@@ -366,18 +374,19 @@ describe("agentCliCommand", () => {

366374

};

367375

loadConfig.mockReset();

368376

loadConfig.mockReturnValueOnce(fastConfig);

369-

loadConfig.mockReturnValueOnce(shellEnvConfig);

377+

loadConfigWithShellEnvFallback.mockReset();

378+

loadConfigWithShellEnvFallback.mockResolvedValueOnce(shellEnvConfig);

370379

const authError = new Error("gateway agent requires credentials");

371380

authError.name = "GatewayCredentialsRequiredError";

372381

callGateway.mockRejectedValueOnce(authError);

373382

mockGatewaySuccessReply();

374383375384

await agentCliCommand({ message: "hi", sessionKey: "agent:main:incident-42" }, runtime);

376385377-

expect(loadConfig.mock.calls).toEqual([

378-

[{ skipPluginValidation: true, pin: false, skipShellEnvFallback: true }],

379-

[{ skipPluginValidation: true, pin: false, skipShellEnvFallback: false }],

380-

]);

386+

expect(loadConfig).toHaveBeenCalledTimes(1);

387+

expect(loadConfig).toHaveBeenCalledWith();

388+

expect(loadConfigWithShellEnvFallback).toHaveBeenCalledTimes(1);

389+

expect(loadConfigWithShellEnvFallback).toHaveBeenCalledWith();

381390

expect(callGateway).toHaveBeenCalledTimes(2);

382391

expect(requireRecord(callGateway.mock.calls[0]?.[0], "first gateway request").config).toBe(

383392

fastConfig,

@@ -396,18 +405,19 @@ describe("agentCliCommand", () => {

396405

};

397406

loadConfig.mockReset();

398407

loadConfig.mockReturnValueOnce(fastConfig);

399-

loadConfig.mockReturnValueOnce(fastConfig);

408+

loadConfigWithShellEnvFallback.mockReset();

409+

loadConfigWithShellEnvFallback.mockResolvedValueOnce(fastConfig);

400410

const authError = new Error("gateway url override requires explicit credentials");

401411

authError.name = "GatewayExplicitAuthRequiredError";

402412

callGateway.mockRejectedValueOnce(authError);

403413

mockGatewaySuccessReply();

404414405415

await agentCliCommand({ message: "hi", sessionKey: "agent:main:incident-42" }, runtime);

406416407-

expect(loadConfig.mock.calls).toEqual([

408-

[{ skipPluginValidation: true, pin: false, skipShellEnvFallback: true }],

409-

[{ skipPluginValidation: true, pin: false, skipShellEnvFallback: false }],

410-

]);

417+

expect(loadConfig).toHaveBeenCalledTimes(1);

418+

expect(loadConfig).toHaveBeenCalledWith();

419+

expect(loadConfigWithShellEnvFallback).toHaveBeenCalledTimes(1);

420+

expect(loadConfigWithShellEnvFallback).toHaveBeenCalledWith();

411421

expect(callGateway).toHaveBeenCalledTimes(2);

412422

});

413423

});

@@ -1559,10 +1569,7 @@ describe("agentCliCommand", () => {

15591569

};

15601570

expect(fallbackOpts.sessionId).toMatch(/^gateway-fallback-/);

15611571

expect(fallbackOpts.sessionKey).toBe(`agent:ops:explicit:${fallbackOpts.sessionId}`);

1562-

expect(loadConfig.mock.calls).toEqual([

1563-

[{ skipPluginValidation: true, pin: false, skipShellEnvFallback: true }],

1564-

[{ skipPluginValidation: true, pin: false, skipShellEnvFallback: true }],

1565-

]);

1572+

expect(loadConfig.mock.calls).toEqual([[], []]);

15661573

},

15671574

{ agents: { list: [{ id: "ops", default: true }, { id: "main" }] } },

15681575

);

@@ -1750,7 +1757,7 @@ describe("agentCliCommand", () => {

17501757

);

17511758

expect(localOpts.agentId).toBe("ops");

17521759

expect(localOpts.sessionKey).toBe("agent:ops:incident-42");

1753-

expect(loadConfig).toHaveBeenCalledWith();

1760+

expect(loadRuntimeConfig).toHaveBeenCalledWith();

17541761

});

17551762

});

17561763