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

推荐订阅源

云风的 BLOG
云风的 BLOG
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
博客园 - 三生石上(FineUI控件)
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
V
Visual Studio Blog
小众软件
小众软件
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
MongoDB | Blog
MongoDB | Blog
V
V2EX
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
The Cloudflare Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Engineering at Meta
Engineering at Meta
L
LangChain Blog
Martin Fowler
Martin Fowler
GbyAI
GbyAI
博客园 - 司徒正美

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): reject short flag values in bench parsers ·...
vincentkoc · 2026-06-22 · via Recent Commits to openclaw:main

@@ -85,24 +85,24 @@ type Report = {

8585

cpuProfilePath?: string;

8686

};

878788-

function parseFlagValue(flag: string): string | undefined {

89-

const index = process.argv.indexOf(flag);

88+

function parseFlagValue(flag: string, args = process.argv.slice(2)): string | undefined {

89+

const index = args.indexOf(flag);

9090

if (index === -1) {

9191

return undefined;

9292

}

93-

const value = process.argv[index + 1];

94-

if (!value || value.startsWith("--")) {

93+

const value = args[index + 1];

94+

if (!value || value.startsWith("-")) {

9595

throw new CliArgumentError(`${flag} requires a value`);

9696

}

9797

return value;

9898

}

9999100-

function hasFlag(flag: string): boolean {

101-

return process.argv.includes(flag);

100+

function hasFlag(flag: string, args = process.argv.slice(2)): boolean {

101+

return args.includes(flag);

102102

}

103103104-

function parsePositiveInt(flag: string, fallback: number): number {

105-

const raw = parseFlagValue(flag);

104+

function parsePositiveInt(flag: string, fallback: number, args = process.argv.slice(2)): number {

105+

const raw = parseFlagValue(flag, args);

106106

if (!raw) {

107107

return fallback;

108108

}

@@ -116,8 +116,8 @@ function parsePositiveInt(flag: string, fallback: number): number {

116116

return value;

117117

}

118118119-

function parseNonNegativeInt(flag: string, fallback: number): number {

120-

const raw = parseFlagValue(flag);

119+

function parseNonNegativeInt(flag: string, fallback: number, args = process.argv.slice(2)): number {

120+

const raw = parseFlagValue(flag, args);

121121

if (!raw) {

122122

return fallback;

123123

}

@@ -138,28 +138,32 @@ function validateCliArgs(args = process.argv.slice(2)): void {

138138

continue;

139139

}

140140

if (VALUE_FLAGS.has(arg)) {

141+

const value = args[index + 1];

142+

if (!value || value.startsWith("-")) {

143+

throw new CliArgumentError(`${arg} requires a value`);

144+

}

141145

index += 1;

142146

continue;

143147

}

144148

throw new CliArgumentError(`Unknown argument: ${arg}`);

145149

}

146150

}

147151148-

function parseOptions(): Options {

149-

validateCliArgs();

152+

function parseOptions(args = process.argv.slice(2)): Options {

153+

validateCliArgs(args);

150154

return {

151-

agentCount: parsePositiveInt("--agents", 8),

152-

cpuProfDir: parseFlagValue("--cpu-prof-dir"),

153-

cpuProfOutput: parseFlagValue("--cpu-prof-output"),

154-

json: hasFlag("--json"),

155-

keepTemp: hasFlag("--keep-temp"),

156-

lookupsPerRun: parsePositiveInt("--lookups", 32),

157-

modelsPerProvider: parsePositiveInt("--models-per-provider", 16),

158-

output: parseFlagValue("--output"),

159-

providers: parsePositiveInt("--providers", 48),

160-

runs: parsePositiveInt("--runs", 8),

161-

runtimeHooks: hasFlag("--runtime-hooks"),

162-

warmup: parseNonNegativeInt("--warmup", 1),

155+

agentCount: parsePositiveInt("--agents", 8, args),

156+

cpuProfDir: parseFlagValue("--cpu-prof-dir", args),

157+

cpuProfOutput: parseFlagValue("--cpu-prof-output", args),

158+

json: hasFlag("--json", args),

159+

keepTemp: hasFlag("--keep-temp", args),

160+

lookupsPerRun: parsePositiveInt("--lookups", 32, args),

161+

modelsPerProvider: parsePositiveInt("--models-per-provider", 16, args),

162+

output: parseFlagValue("--output", args),

163+

providers: parsePositiveInt("--providers", 48, args),

164+

runs: parsePositiveInt("--runs", 8, args),

165+

runtimeHooks: hasFlag("--runtime-hooks", args),

166+

warmup: parseNonNegativeInt("--warmup", 1, args),

163167

};

164168

}

165169

@@ -468,11 +472,13 @@ function printHuman(report: Report, cpuProfilePath?: string): void {

468472

}

469473470474

async function main(): Promise<void> {

471-

if (hasFlag("--help") || hasFlag("-h")) {

475+

const args = process.argv.slice(2);

476+

validateCliArgs(args);

477+

if (hasFlag("--help", args) || hasFlag("-h", args)) {

472478

printUsage();

473479

return;

474480

}

475-

const options = parseOptions();

481+

const options = parseOptions(args);

476482

const tempRoot = await mkdtemp(path.join(tmpdir(), "openclaw-issue-78851-"));

477483

const workspaceDir = path.join(tempRoot, "workspace");

478484

await mkdir(workspaceDir, { recursive: true });