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

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
U
Unit 42
GbyAI
GbyAI
M
MIT News - Artificial intelligence
美团技术团队
罗磊的独立博客
雷峰网
雷峰网
量子位
博客园 - 【当耐特】
Last Week in AI
Last Week in AI
D
Docker
小众软件
小众软件
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
WordPress大学
WordPress大学
V
V2EX
博客园_首页
腾讯CDC
The Cloudflare Blog
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

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(ios): reject malformed node e2e wait seconds · opencl...
vincentkoc · 2026-06-17 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -4,7 +4,6 @@ import {

44

MIN_CLIENT_PROTOCOL_VERSION,

55

PROTOCOL_VERSION,

66

} from "../../packages/gateway-protocol/src/version.js";

7-

import { createArgReader, createGatewayWsClient, resolveGatewayUrl } from "./gateway-ws-client.ts";

87
98

function writeStdoutLine(message = ""): void {

109

process.stdout.write(`${message}\n`);

@@ -18,6 +17,13 @@ function writeStderrLine(message: string): void {

1817

process.stderr.write(`${message}\n`);

1918

}

2019
20+

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

21+

const getArg = (flag: string) => {

22+

const index = argv.indexOf(flag);

23+

return index === -1 ? undefined : argv[index + 1];

24+

};

25+

const hasFlag = (flag: string) => argv.includes(flag);

26+
2127

type NodeListPayload = {

2228

ts?: number;

2329

nodes?: Array<{

@@ -33,8 +39,6 @@ type NodeListPayload = {

3339
3440

type NodeListNode = NonNullable<NodeListPayload["nodes"]>[number];

3541
36-

const { get: getArg, has: hasFlag } = createArgReader();

37-
3842

const urlRaw = getArg("--url") ?? process.env.OPENCLAW_GATEWAY_URL;

3943

const token = getArg("--token") ?? process.env.OPENCLAW_GATEWAY_TOKEN;

4044

const nodeHint = getArg("--node");

@@ -49,6 +53,8 @@ if (!urlRaw || !token) {

4953

process.exit(1);

5054

}

5155
56+

const waitSeconds = parseWaitSeconds(getArg("--wait-seconds"));

57+

const { createGatewayWsClient, resolveGatewayUrl } = await import("./gateway-ws-client.ts");

5258

const url = resolveGatewayUrl(urlRaw);

5359
5460

const isoNow = () => new Date().toISOString();

@@ -79,6 +85,21 @@ function formatErr(err: unknown): string {

7985

}

8086

}

8187
88+

function parseWaitSeconds(raw: string | undefined): number {

89+

const value = raw ?? "25";

90+

const text = value.trim();

91+

if (!/^[1-9]\d*$/u.test(text)) {

92+

writeStderrLine(`--wait-seconds must be a positive integer; got: ${value}`);

93+

process.exit(1);

94+

}

95+

const parsed = Number(text);

96+

if (!Number.isSafeInteger(parsed)) {

97+

writeStderrLine(`--wait-seconds must be a safe positive integer; got: ${value}`);

98+

process.exit(1);

99+

}

100+

return parsed;

101+

}

102+
82103

function isRecord(value: unknown): value is Record<string, unknown> {

83104

return Boolean(value && typeof value === "object" && !Array.isArray(value));

84105

}

@@ -190,7 +211,6 @@ async function main() {

190211

const listPayload = (nodesRes.payload ?? {}) as NodeListPayload;

191212

let node = pickIosNode(listPayload, nodeHint);

192213

if (!node) {

193-

const waitSeconds = Number.parseInt(getArg("--wait-seconds") ?? "25", 10);

194214

const deadline = Date.now() + Math.max(1, waitSeconds) * 1000;

195215

while (!node && Date.now() < deadline) {

196216

await new Promise((r) => {

Original file line numberDiff line numberDiff line change

@@ -164,7 +164,7 @@ async function listenGateway(params: {

164164

return `ws://127.0.0.1:${address.port}`;

165165

}

166166
167-

function runScript(url: string): Promise<ScriptResult> {

167+

function runScript(url: string, extraArgs: readonly string[] = []): Promise<ScriptResult> {

168168

return new Promise((resolve) => {

169169

const child = spawn(

170170

process.execPath,

@@ -177,6 +177,7 @@ function runScript(url: string): Promise<ScriptResult> {

177177

"--token",

178178

"token",

179179

"--json",

180+

...extraArgs,

180181

],

181182

{ stdio: "pipe" },

182183

);

@@ -216,6 +217,14 @@ function runScript(url: string): Promise<ScriptResult> {

216217

}

217218
218219

describe("ios-node-e2e", () => {

220+

it("rejects malformed wait seconds before connecting", async () => {

221+

const result = await runScript("ws://127.0.0.1:9", ["--wait-seconds", "1e3"]);

222+
223+

expect(result).toMatchObject({ signal: null, status: 1, timedOut: false });

224+

expect(result.stderr).toContain("--wait-seconds must be a positive integer; got: 1e3");

225+

expect(result.stdout).toBe("");

226+

});

227+
219228

it("fails empty node invoke payloads instead of counting them as proof", async () => {

220229

const invokeParams: Array<{ command?: string; idempotencyKey?: string }> = [];

221230

const url = await listenGateway({ mode: "empty", invokeParams });