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

推荐订阅源

V
V2EX
P
Proofpoint News Feed
D
DataBreaches.Net
C
Check Point Blog
L
LangChain Blog
量子位
美团技术团队
Vercel News
Vercel News
人人都是产品经理
人人都是产品经理
N
Netflix TechBlog - Medium
V
Visual Studio Blog
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
The GitHub Blog
The GitHub Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
U
Unit 42
腾讯CDC
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
Blog — PlanetScale
Blog — PlanetScale

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(test): bound extension memory profiler output · openc...
vincentkoc · 2026-05-28 · via Recent Commits to openclaw:main

@@ -10,6 +10,8 @@ const DEFAULT_CONCURRENCY = 6;

1010

const DEFAULT_TIMEOUT_MS = 90_000;

1111

const DEFAULT_COMBINED_TIMEOUT_MS = 180_000;

1212

const DEFAULT_TOP = 10;

13+

const OUTPUT_CAPTURE_MAX_CHARS = 128 * 1024;

14+

const STDERR_PREVIEW_MAX_CHARS = 8 * 1024;

1315

const RSS_MARKER = "__OPENCLAW_MAX_RSS_KB__=";

14161517

function printHelp() {

@@ -120,8 +122,49 @@ function parseMaxRssMb(stderr) {

120122

return last ? Number(last[1]) / 1024 : null;

121123

}

122124123-

function summarizeStderr(stderr, lines = 8) {

124-

return stderr.trim().split("\n").filter(Boolean).slice(0, lines).join("\n");

125+

function createOutputCapture() {

126+

return { text: "", truncatedChars: 0 };

127+

}

128+129+

function appendBoundedOutput(capture, chunk, maxChars = OUTPUT_CAPTURE_MAX_CHARS) {

130+

const nextText = capture.text + String(chunk);

131+

if (nextText.length <= maxChars) {

132+

return capture.truncatedChars === 0

133+

? { text: nextText, truncatedChars: 0 }

134+

: { text: nextText, truncatedChars: capture.truncatedChars };

135+

}

136+

const truncatedChars = capture.truncatedChars + nextText.length - maxChars;

137+

return { text: nextText.slice(-maxChars), truncatedChars };

138+

}

139+140+

function formatCapturedOutput(capture) {

141+

if (capture.truncatedChars === 0) {

142+

return capture.text;

143+

}

144+

return `[output truncated ${capture.truncatedChars} chars; showing tail]\n${capture.text}`;

145+

}

146+147+

function scanMaxRssMb(tail, chunk, current) {

148+

const text = `${tail}${String(chunk)}`;

149+

const parsed = parseMaxRssMb(text);

150+

const lineBreakIndex = Math.max(text.lastIndexOf("\n"), text.lastIndexOf("\r"));

151+

const openLine = lineBreakIndex === -1 ? text : text.slice(lineBreakIndex + 1);

152+

return {

153+

maxRssMb: parsed ?? current,

154+

tail: openLine.slice(-(RSS_MARKER.length + 32)),

155+

};

156+

}

157+158+

function summarizeStderr(stderr, lines = 8, maxChars = STDERR_PREVIEW_MAX_CHARS) {

159+

const text = stderr.trim().split("\n").filter(Boolean).slice(0, lines).join("\n");

160+

if (text.length <= maxChars) {

161+

return text;

162+

}

163+

const firstLine = text.split("\n", 1)[0] ?? "";

164+

const prefix = firstLine.startsWith("[output truncated") ? `${firstLine}\n` : "";

165+

return `${prefix}[stderr preview truncated ${text.length - maxChars} chars; showing tail]\n${text.slice(

166+

-maxChars,

167+

)}`;

125168

}

126169127170

async function runCase({ repoRoot, env, hookPath, name, body, timeoutMs }) {

@@ -136,30 +179,36 @@ async function runCase({ repoRoot, env, hookPath, name, body, timeoutMs }) {

136179

},

137180

);

138181139-

let stdout = "";

140-

let stderr = "";

182+

let stdout = createOutputCapture();

183+

let stderr = createOutputCapture();

184+

let stderrRssTail = "";

185+

let maxRssMb = null;

141186

let timedOut = false;

142187

const timer = setTimeout(() => {

143188

timedOut = true;

144189

child.kill("SIGKILL");

145190

}, timeoutMs);

146191147192

child.stdout.on("data", (chunk) => {

148-

stdout += String(chunk);

193+

stdout = appendBoundedOutput(stdout, chunk);

149194

});

150195

child.stderr.on("data", (chunk) => {

151-

stderr += String(chunk);

196+

const rssScan = scanMaxRssMb(stderrRssTail, chunk, maxRssMb);

197+

stderrRssTail = rssScan.tail;

198+

maxRssMb = rssScan.maxRssMb;

199+

stderr = appendBoundedOutput(stderr, chunk);

152200

});

153201

child.on("close", (code, signal) => {

154202

clearTimeout(timer);

203+

const stderrText = formatCapturedOutput(stderr);

155204

resolve({

156205

name,

157206

code,

158207

signal,

159208

timedOut,

160-

stdout,

161-

stderr,

162-

maxRssMb: parseMaxRssMb(stderr),

209+

stdout: formatCapturedOutput(stdout),

210+

stderr: stderrText,

211+

maxRssMb: maxRssMb ?? parseMaxRssMb(stderrText),

163212

});

164213

});

165214

});

@@ -213,9 +262,10 @@ async function main() {

213262

writeFileSync(

214263

hookPath,

215264

[

265+

"import { writeSync } from 'node:fs';",

216266

"process.on('exit', () => {",

217267

" const usage = typeof process.resourceUsage === 'function' ? process.resourceUsage() : null;",

218-

` if (usage && typeof usage.maxRSS === 'number') console.error('${RSS_MARKER}' + String(usage.maxRSS));`,

268+

` if (usage && typeof usage.maxRSS === 'number') writeSync(2, '${RSS_MARKER}' + String(usage.maxRSS) + '\\n');`,

219269

"});",

220270

"",

221271

].join("\n"),