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

推荐订阅源

J
Java Code Geeks
GbyAI
GbyAI
Google DeepMind News
Google DeepMind News
Jina AI
Jina AI
B
Blog
aimingoo的专栏
aimingoo的专栏
酷 壳 – CoolShell
酷 壳 – CoolShell
T
The Blog of Author Tim Ferriss
Last Week in AI
Last Week in AI
月光博客
月光博客
H
Help Net Security
V
Visual Studio Blog
量子位
A
About on SuperTechFans
博客园 - Franky
人人都是产品经理
人人都是产品经理
N
Netflix TechBlog - Medium
云风的 BLOG
云风的 BLOG
雷峰网
雷峰网
Martin Fowler
Martin Fowler
Microsoft Security Blog
Microsoft Security Blog
博客园 - 叶小钗
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog

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): bound kitchen sink log scans · openclaw/opencla...
vincentkoc · 2026-05-27 · via Recent Commits to openclaw:main

@@ -37,6 +37,21 @@ const OUTPUT_CAPTURE_CHARS = readPositiveInt(

3737

);

3838

const DEFAULT_PORT = 19000 + Math.floor(Math.random() * 1000);

3939

const LOG_SCAN_CHUNK_BYTES = 64 * 1024;

40+

const LOG_SCAN_MAX_LINE_CHARS = 16 * 1024;

41+

const LOG_TAIL_BYTES = 256 * 1024;

42+

const ERROR_LOG_DENY_PATTERNS = [

43+

/\buncaught exception\b/iu,

44+

/\bunhandled rejection\b/iu,

45+

/\bfatal\b/iu,

46+

/\bpanic\b/iu,

47+

/\blevel["']?\s*:\s*["']error["']/iu,

48+

/\[(?:error|ERROR)\]/u,

49+

];

50+

const ERROR_LOG_ALLOW_PATTERNS = [

51+

/0 errors?/iu,

52+

/expected no diagnostics errors?/iu,

53+

/diagnostics errors?:\s*$/iu,

54+

];

40554156

let callGatewayModulePromise;

4257

@@ -1138,37 +1153,109 @@ export function assertResourceCeiling(sample) {

11381153

}

11391154

}

114011551156+

export function findErrorLogFindings(logPath) {

1157+

if (!fs.existsSync(logPath)) {

1158+

return [];

1159+

}

1160+

const scanBytes = fs.statSync(logPath).size;

1161+1162+

const findings = [];

1163+

let currentLine = "";

1164+

let currentLineNumber = 1;

1165+

let currentLineHasFinding = false;

1166+

let currentLineTruncated = false;

1167+

const recordLine = (lineNumber, line) => {

1168+

if (currentLineHasFinding) {

1169+

return;

1170+

}

1171+

if (

1172+

ERROR_LOG_ALLOW_PATTERNS.some((pattern) => pattern.test(line)) ||

1173+

!ERROR_LOG_DENY_PATTERNS.some((pattern) => pattern.test(line))

1174+

) {

1175+

return;

1176+

}

1177+

currentLineHasFinding = true;

1178+

findings.push({ line, lineNumber });

1179+

if (findings.length > 20) {

1180+

findings.shift();

1181+

}

1182+

};

1183+

const inspectCurrentLine = () => {

1184+

const normalizedLine = currentLine.replace(/\r$/u, "");

1185+

const line = currentLineTruncated ? `[truncated] ${normalizedLine}` : normalizedLine;

1186+

recordLine(currentLineNumber, line);

1187+

};

1188+

const appendLineFragment = (fragment) => {

1189+

currentLine += fragment;

1190+

if (currentLine.length <= LOG_SCAN_MAX_LINE_CHARS) {

1191+

return;

1192+

}

1193+

inspectCurrentLine();

1194+

currentLine = currentLine.slice(-LOG_SCAN_MAX_LINE_CHARS);

1195+

currentLineTruncated = true;

1196+

};

1197+

const finishLine = () => {

1198+

inspectCurrentLine();

1199+

currentLine = "";

1200+

currentLineNumber += 1;

1201+

currentLineHasFinding = false;

1202+

currentLineTruncated = false;

1203+

};

1204+1205+

const fd = fs.openSync(logPath, "r");

1206+

try {

1207+

const buffer = Buffer.allocUnsafe(LOG_SCAN_CHUNK_BYTES);

1208+

let offset = 0;

1209+

while (offset < scanBytes) {

1210+

const bytesToRead = Math.min(buffer.length, scanBytes - offset);

1211+

const bytesRead = fs.readSync(fd, buffer, 0, bytesToRead, offset);

1212+

if (bytesRead <= 0) {

1213+

break;

1214+

}

1215+

offset += bytesRead;

1216+

const lines = buffer.subarray(0, bytesRead).toString("utf8").split(/\n/u);

1217+

for (const [index, line] of lines.entries()) {

1218+

appendLineFragment(line);

1219+

if (index < lines.length - 1) {

1220+

finishLine();

1221+

}

1222+

}

1223+

}

1224+

} finally {

1225+

fs.closeSync(fd);

1226+

}

1227+

if (currentLine) {

1228+

inspectCurrentLine();

1229+

}

1230+

return findings;

1231+

}

1232+11411233

function assertNoErrorLogs(logPath) {

1142-

const log = fs.existsSync(logPath) ? fs.readFileSync(logPath, "utf8") : "";

1143-

const deny = [

1144-

/\buncaught exception\b/iu,

1145-

/\bunhandled rejection\b/iu,

1146-

/\bfatal\b/iu,

1147-

/\bpanic\b/iu,

1148-

/\blevel["']?\s*:\s*["']error["']/iu,

1149-

/\[(?:error|ERROR)\]/u,

1150-

];

1151-

const allow = [/0 errors?/iu, /expected no diagnostics errors?/iu, /diagnostics errors?:\s*$/iu];

1152-

const findings = log

1153-

.split(/\r?\n/u)

1154-

.map((line, index) => ({ line, lineNumber: index + 1 }))

1155-

.filter(({ line }) => !allow.some((pattern) => pattern.test(line)))

1156-

.filter(({ line }) => deny.some((pattern) => pattern.test(line)));

1234+

const findings = findErrorLogFindings(logPath);

11571235

if (findings.length > 0) {

11581236

throw new Error(

11591237

`unexpected error-like gateway logs:\n${findings

1160-

.slice(-20)

11611238

.map(({ line, lineNumber }) => `${logPath}:${lineNumber}: ${line}`)

11621239

.join("\n")}`,

11631240

);

11641241

}

11651242

}

116612431167-

function tailFile(file) {

1244+

export function tailFile(file, maxBytes = LOG_TAIL_BYTES) {

11681245

if (!fs.existsSync(file)) {

11691246

return "";

11701247

}

1171-

return tailText(fs.readFileSync(file, "utf8"));

1248+

const stat = fs.statSync(file);

1249+

const start = Math.max(0, stat.size - Math.max(1, maxBytes));

1250+

const length = stat.size - start;

1251+

const fd = fs.openSync(file, "r");

1252+

try {

1253+

const buffer = Buffer.allocUnsafe(length);

1254+

fs.readSync(fd, buffer, 0, length, start);

1255+

return tailText(buffer.toString("utf8"));

1256+

} finally {

1257+

fs.closeSync(fd);

1258+

}

11721259

}

1173126011741261

function tailText(text) {