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

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
Stack Overflow Blog
Stack Overflow Blog
D
DataBreaches.Net
罗磊的独立博客
博客园 - 司徒正美
Last Week in AI
Last Week in AI
The Cloudflare Blog
大猫的无限游戏
大猫的无限游戏
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog RSS Feed
The GitHub Blog
The GitHub Blog
宝玉的分享
宝玉的分享
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
小众软件
小众软件
Jina AI
Jina AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hugging Face - Blog
Hugging Face - Blog
B
Blog
博客园 - 【当耐特】
V
V2EX
Apple Machine Learning Research
Apple Machine Learning Research
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell

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(e2e): reject loose mock config limits · openclaw/open...
vincentkoc · 2026-05-29 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -1,15 +1,13 @@

1+

import { readPositiveIntEnv } from "../env-limits.mjs";

12

import { createConfigReloadLogScanner } from "./log-scanner.mjs";

23
34

const logPath = process.env.OPENCLAW_CONFIG_RELOAD_LOG_PATH ?? "/tmp/config-reload-e2e.log";

4-

const deadlineMs = Date.now() + Number(process.env.OPENCLAW_CONFIG_RELOAD_LOG_TIMEOUT_MS ?? 30_000);

5-

const maxReadBytes = Number.parseInt(

6-

process.env.OPENCLAW_CONFIG_RELOAD_LOG_MAX_READ_BYTES ?? `${256 * 1024}`,

7-

10,

8-

);

5+

const deadlineMs = Date.now() + readPositiveIntEnv("OPENCLAW_CONFIG_RELOAD_LOG_TIMEOUT_MS", 30_000);

6+

const maxReadBytes = readPositiveIntEnv("OPENCLAW_CONFIG_RELOAD_LOG_MAX_READ_BYTES", 256 * 1024);

97
108

const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

119

const scanner = createConfigReloadLogScanner(logPath, {

12-

maxReadBytes: Number.isSafeInteger(maxReadBytes) && maxReadBytes > 0 ? maxReadBytes : 256 * 1024,

10+

maxReadBytes,

1311

tailLineLimit: 160,

1412

});

1513

let result = { reloadLines: [], restartLines: [], tailLines: [] };

Original file line numberDiff line numberDiff line change

@@ -1,7 +1,8 @@

11

import fs from "node:fs";

22

import http from "node:http";

3+

import { readPositiveIntEnv } from "../env-limits.mjs";

34
4-

const port = Number(process.env.MOCK_PORT);

5+

const port = readPositiveIntEnv("MOCK_PORT");

56

const requestLog = process.env.MOCK_REQUEST_LOG;

67

const successMarker = process.env.SUCCESS_MARKER;

78

const rawSchemaError = process.env.RAW_SCHEMA_ERROR;

Original file line numberDiff line numberDiff line change

@@ -1,14 +1,14 @@

11

import fs from "node:fs";

22

import http from "node:http";

3+

import { readPositiveIntEnv } from "./lib/env-limits.mjs";

34
4-

const port = Number(process.env.MOCK_PORT ?? process.env.OPENCLAW_MOCK_OPENAI_PORT);

5+

const port =

6+

process.env.MOCK_PORT != null

7+

? readPositiveIntEnv("MOCK_PORT")

8+

: readPositiveIntEnv("OPENCLAW_MOCK_OPENAI_PORT");

59

const successMarker = process.env.SUCCESS_MARKER ?? "OPENCLAW_E2E_OK";

610

const requestLog = process.env.MOCK_REQUEST_LOG;

711
8-

if (!Number.isInteger(port) || port <= 0) {

9-

throw new Error("missing valid MOCK_PORT or OPENCLAW_MOCK_OPENAI_PORT");

10-

}

11-
1212

function readBody(req) {

1313

return new Promise((resolve, reject) => {

1414

let body = "";

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,68 @@

1+

import { spawnSync } from "node:child_process";

2+

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

3+
4+

const mockOpenAiPath = "scripts/e2e/mock-openai-server.mjs";

5+

const webSearchMockPath = "scripts/e2e/lib/openai-web-search-minimal/mock-server.mjs";

6+

const configReloadAssertPath = "scripts/e2e/lib/config-reload/assert-log.mjs";

7+

const scrubbedEnvKeys = [

8+

"MOCK_PORT",

9+

"MOCK_REQUEST_LOG",

10+

"OPENCLAW_CONFIG_RELOAD_LOG_MAX_READ_BYTES",

11+

"OPENCLAW_CONFIG_RELOAD_LOG_PATH",

12+

"OPENCLAW_CONFIG_RELOAD_LOG_TIMEOUT_MS",

13+

"OPENCLAW_MOCK_OPENAI_PORT",

14+

"RAW_SCHEMA_ERROR",

15+

"SUCCESS_MARKER",

16+

];

17+
18+

function runScript(scriptPath: string, env: Record<string, string>) {

19+

const childEnv = { ...process.env };

20+

for (const key of scrubbedEnvKeys) {

21+

delete childEnv[key];

22+

}

23+

return spawnSync(process.execPath, [scriptPath], {

24+

encoding: "utf8",

25+

env: { ...childEnv, ...env },

26+

killSignal: "SIGKILL",

27+

timeout: 3_000,

28+

});

29+

}

30+
31+

describe("e2e mock and config helper numeric limits", () => {

32+

it("rejects loose mock OpenAI port env values", () => {

33+

const mockPort = runScript(mockOpenAiPath, { MOCK_PORT: "44080tcp" });

34+

expect(mockPort.status).not.toBe(0);

35+

expect(mockPort.stderr).toContain("invalid MOCK_PORT: 44080tcp");

36+
37+

const fallbackPort = runScript(mockOpenAiPath, {

38+

OPENCLAW_MOCK_OPENAI_PORT: "44080http",

39+

});

40+

expect(fallbackPort.status).not.toBe(0);

41+

expect(fallbackPort.stderr).toContain("invalid OPENCLAW_MOCK_OPENAI_PORT: 44080http");

42+

});

43+
44+

it("rejects loose OpenAI web-search mock port env values", () => {

45+

const result = runScript(webSearchMockPath, { MOCK_PORT: "80http" });

46+
47+

expect(result.status).not.toBe(0);

48+

expect(result.stderr).toContain("invalid MOCK_PORT: 80http");

49+

});

50+
51+

it("rejects loose config-reload log timeout env values", () => {

52+

const result = runScript(configReloadAssertPath, {

53+

OPENCLAW_CONFIG_RELOAD_LOG_TIMEOUT_MS: "30000ms",

54+

});

55+
56+

expect(result.status).not.toBe(0);

57+

expect(result.stderr).toContain("invalid OPENCLAW_CONFIG_RELOAD_LOG_TIMEOUT_MS: 30000ms");

58+

});

59+
60+

it("rejects loose config-reload log read caps", () => {

61+

const result = runScript(configReloadAssertPath, {

62+

OPENCLAW_CONFIG_RELOAD_LOG_MAX_READ_BYTES: "256kb",

63+

});

64+
65+

expect(result.status).not.toBe(0);

66+

expect(result.stderr).toContain("invalid OPENCLAW_CONFIG_RELOAD_LOG_MAX_READ_BYTES: 256kb");

67+

});

68+

});