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

推荐订阅源

人人都是产品经理
人人都是产品经理
有赞技术团队
有赞技术团队
L
LangChain Blog
C
Check Point Blog
博客园 - 【当耐特】
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
美团技术团队
博客园 - 司徒正美
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
S
SegmentFault 最新的问题
A
About on SuperTechFans
Blog — PlanetScale
Blog — PlanetScale
Hugging Face - Blog
Hugging Face - Blog
博客园 - 叶小钗
腾讯CDC
B
Blog
G
Google Developers Blog
The Cloudflare Blog
P
Proofpoint News 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
perf: reduce gateway startup sidecar overhead · openclaw/...
steipete · 2026-05-29 · via Recent Commits to openclaw:main
11

import fs from "node:fs";

22

import path from "node:path";

33

import { createTestPluginApi } from "openclaw/plugin-sdk/plugin-test-api";

4-

import { beforeAll, describe, expect, it, vi } from "vitest";

4+

import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";

55

import {

66

browserPluginNodeHostCommands,

77

browserPluginReload,

@@ -25,6 +25,7 @@ const runtimeApiMocks = vi.hoisted(() => ({

2525

handleBrowserGatewayRequest: vi.fn(),

2626

registerBrowserCli: vi.fn(),

2727

runBrowserProxyCommand: vi.fn(async () => "ok"),

28+

stopBrowserControlService: vi.fn(async () => undefined),

2829

}));

29303031

vi.mock("./register.runtime.js", async () => {

@@ -44,10 +45,22 @@ vi.mock("./src/cli/browser-cli.js", () => ({

4445

registerBrowserCli: runtimeApiMocks.registerBrowserCli,

4546

}));

464748+

vi.mock("./src/control-service.js", () => ({

49+

stopBrowserControlService: runtimeApiMocks.stopBrowserControlService,

50+

}));

51+4752

beforeAll(async () => {

4853

await import("./register.runtime.js");

4954

});

505556+

beforeEach(() => {

57+

vi.clearAllMocks();

58+

});

59+60+

afterEach(() => {

61+

vi.unstubAllEnvs();

62+

});

63+5164

function createApi() {

5265

const registerCli = vi.fn();

5366

const registerGatewayMethod = vi.fn();

@@ -189,7 +202,7 @@ describe("browser plugin", () => {

189202

expect(runtimeApiMocks.collectBrowserSecurityAuditFindings).toHaveBeenCalled();

190203

});

191204192-

it("lazy-loads the browser service on start", async () => {

205+

it("registers a lazy browser control service", async () => {

193206

const { api, registerService } = createApi();

194207

registerBrowserPlugin(api);

195208

@@ -203,10 +216,43 @@ describe("browser plugin", () => {

203216

expect(typeof service?.stop).toBe("function");

204217

expect(runtimeApiMocks.createBrowserPluginService).not.toHaveBeenCalled();

205218219+

await service.start({ config: {}, stateDir: "/tmp/openclaw", logger: { warn: vi.fn() } });

220+

expect(runtimeApiMocks.createBrowserPluginService).not.toHaveBeenCalled();

221+222+

await service.stop({ config: {}, stateDir: "/tmp/openclaw", logger: { warn: vi.fn() } });

223+

expect(runtimeApiMocks.stopBrowserControlService).toHaveBeenCalledOnce();

224+

});

225+226+

it("eager-loads the browser control service when explicitly requested", async () => {

227+

vi.stubEnv("OPENCLAW_EAGER_BROWSER_CONTROL_SERVER", "1");

228+

const { api, registerService } = createApi();

229+

registerBrowserPlugin(api);

230+231+

const service = mockCallArg(registerService) as {

232+

id: string;

233+

start: (...args: unknown[]) => unknown;

234+

};

235+206236

await service.start({ config: {}, stateDir: "/tmp/openclaw", logger: { warn: vi.fn() } });

207237

expect(runtimeApiMocks.createBrowserPluginService).toHaveBeenCalledOnce();

208238

});

209239240+

for (const value of ["false", "", "disabled"]) {

241+

it(`keeps browser control service env value ${JSON.stringify(value)} lazy`, async () => {

242+

vi.stubEnv("OPENCLAW_EAGER_BROWSER_CONTROL_SERVER", value);

243+

const { api, registerService } = createApi();

244+

registerBrowserPlugin(api);

245+246+

const service = mockCallArg(registerService) as {

247+

id: string;

248+

start: (...args: unknown[]) => unknown;

249+

};

250+251+

await service.start({ config: {}, stateDir: "/tmp/openclaw", logger: { warn: vi.fn() } });

252+

expect(runtimeApiMocks.createBrowserPluginService).not.toHaveBeenCalled();

253+

});

254+

}

255+210256

it("declares setup auto-enable reasons for browser config surfaces", () => {

211257

const probe = registerBrowserAutoEnableProbe();

212258