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

推荐订阅源

Y
Y Combinator Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
博客园 - 三生石上(FineUI控件)
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
罗磊的独立博客
博客园_首页
量子位
雷峰网
雷峰网
GbyAI
GbyAI
小众软件
小众软件
酷 壳 – CoolShell
酷 壳 – CoolShell
D
DataBreaches.Net
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Cloudflare Blog
IT之家
IT之家
WordPress大学
WordPress大学
人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research
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
fix(scripts): prebuild gateway cpu bench · openclaw/openc...
vincentkoc · 2026-05-25 · via Recent Commits to openclaw:main

@@ -1,9 +1,10 @@

11

#!/usr/bin/env node

223-

import { spawnSync } from "node:child_process";

3+

import { spawnSync as defaultSpawnSync } from "node:child_process";

44

import fs from "node:fs";

55

import path from "node:path";

66

import process from "node:process";

7+

import { pathToFileURL } from "node:url";

78

import { collectGatewayCpuObservations } from "./lib/plugin-gateway-gauntlet.mjs";

89

import { createPnpmRunnerSpawnSpec } from "./pnpm-runner.mjs";

910

@@ -137,9 +138,10 @@ function readJsonIfExists(filePath) {

137138

return JSON.parse(fs.readFileSync(filePath, "utf8"));

138139

}

139140140-

function runStep(name, command, args, options = {}) {

141+

function runStep(name, command, args, options = {}, params = {}) {

141142

console.error(`[gateway-cpu] start ${name}`);

142-

const result = spawnSync(command, args, {

143+

const spawn = params.spawnSync ?? defaultSpawnSync;

144+

const result = spawn(command, args, {

143145

cwd: process.cwd(),

144146

env: process.env,

145147

stdio: "inherit",

@@ -167,8 +169,7 @@ function toRepoRelativePath(absolutePath) {

167169

return relativePath;

168170

}

169171170-

async function main() {

171-

const options = parseArgs(process.argv.slice(2));

172+

async function runGatewayCpuScenarios(options, params = {}) {

172173

fs.mkdirSync(options.outputDir, { recursive: true });

173174174175

const startupOutput = path.join(options.outputDir, "gateway-startup-bench.json");

@@ -177,19 +178,35 @@ async function main() {

177178

const steps = [];

178179179180

if (!options.skipStartup) {

181+

const startupBuild = runStep(

182+

"startup build",

183+

process.execPath,

184+

["scripts/ensure-cli-startup-build.mjs"],

185+

{},

186+

params,

187+

);

188+

steps.push(startupBuild);

180189

steps.push(

181-

runStep("startup bench", process.execPath, [

182-

"--import",

183-

"tsx",

184-

"scripts/bench-gateway-startup.ts",

185-

"--runs",

186-

String(options.runs),

187-

"--warmup",

188-

String(options.warmup),

189-

"--output",

190-

startupOutput,

191-

...options.startupCases.flatMap((id) => ["--case", id]),

192-

]),

190+

startupBuild.status === 0

191+

? runStep(

192+

"startup bench",

193+

process.execPath,

194+

[

195+

"--import",

196+

"tsx",

197+

"scripts/bench-gateway-startup.ts",

198+

"--runs",

199+

String(options.runs),

200+

"--warmup",

201+

String(options.warmup),

202+

"--output",

203+

startupOutput,

204+

...options.startupCases.flatMap((id) => ["--case", id]),

205+

],

206+

{},

207+

params,

208+

)

209+

: { name: "startup bench", signal: null, status: 1 },

193210

);

194211

}

195212

@@ -207,7 +224,7 @@ async function main() {

207224

...options.qaScenarios.flatMap((id) => ["--scenario", id]),

208225

]);

209226

steps.push(

210-

runStep("qa suite", qaCommand.command, qaCommand.args, qaCommand.options),

227+

runStep("qa suite", qaCommand.command, qaCommand.args, qaCommand.options, params),

211228

);

212229

}

213230

@@ -239,14 +256,30 @@ async function main() {

239256

};

240257

const summaryPath = path.join(options.outputDir, "summary.json");

241258

fs.writeFileSync(summaryPath, `${JSON.stringify(summary, null, 2)}\n`);

242-

console.log(JSON.stringify(summary, null, 2));

259+

if (!params.silent) {

260+

console.log(JSON.stringify(summary, null, 2));

261+

}

262+263+

const exitCode = steps.some((step) => step.status !== 0) ? 1 : 0;

264+

return { exitCode, summary };

265+

}

243266244-

if (steps.some((step) => step.status !== 0)) {

267+

async function main(params = {}) {

268+

const options = parseArgs(params.argv ?? process.argv.slice(2));

269+

const result = await runGatewayCpuScenarios(options, params);

270+

if (result.exitCode !== 0) {

245271

process.exitCode = 1;

246272

}

247273

}

248274249-

main().catch((error) => {

250-

console.error(error instanceof Error ? error.stack : String(error));

251-

process.exitCode = 1;

252-

});

275+

export const testing = {

276+

parseArgs,

277+

runGatewayCpuScenarios,

278+

};

279+280+

if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {

281+

main().catch((error) => {

282+

console.error(error instanceof Error ? error.stack : String(error));

283+

process.exitCode = 1;

284+

});

285+

}