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

推荐订阅源

N
News and Events Feed by Topic
Malwarebytes
Malwarebytes
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cybersecurity and Infrastructure Security Agency CISA
F
Future of Privacy Forum
C
Cisco Blogs
T
The Exploit Database - CXSecurity.com
A
Arctic Wolf
S
Securelist
K
Kaspersky official blog
S
Schneier on Security
T
ThreatConnect
T
Tenable Blog
Spread Privacy
Spread Privacy
T
True Tiger Recordings
AWS News Blog
AWS News Blog
F
Fox-IT International blog
量子位
T
Threatpost
V
Vulnerabilities – Threatpost
C
CERT Recently Published Vulnerability Notes
Cisco Talos Blog
Cisco Talos Blog
GbyAI
GbyAI
宝玉的分享
宝玉的分享
腾讯CDC
G
Google Developers Blog
aimingoo的专栏
aimingoo的专栏
Cyberwarzone
Cyberwarzone
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
U
Unit 42
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The GitHub Blog
The GitHub Blog
The Register - Security
The Register - Security
MyScale Blog
MyScale Blog
小众软件
小众软件
A
About on SuperTechFans
Last Week in AI
Last Week in AI
Y
Y Combinator Blog
博客园 - 三生石上(FineUI控件)
美团技术团队
Google Online Security Blog
Google Online Security Blog
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog

Recent Commits to openclaw:main

chore(skills): normalize release skill routing · openclaw/openclaw@4737e19 docs(release): require early performance regression check · openclaw/openclaw@0336938 feat(qa): add coverage scenario matching · openclaw/openclaw@a1fe86a fix(perf): avoid duplicate docker package ui build build: enable modern TypeScript module syntax · openclaw/openclaw@bbc1772 ci: include performance evidence in release validation fix(providers): stream ordinary tool-like prose promptly fix(perf): harden gateway restart bench exits · openclaw/openclaw@82bbcf6 fix(gateway): gate talk secret bootstrap handoff (#85690) · openclaw/openclaw@c791e42 fix: suppress async media incomplete-turn errors (#85933) · openclaw/openclaw@35dcd42 migrate auth credentials · openclaw/openclaw@f036bac fix migrate auth lint · openclaw/openclaw@50e6cb0 fix migrate supported auth imports · openclaw/openclaw@44bb2be fix migrate auth opt-out precedence · openclaw/openclaw@2016a51 honor migrate auth opt-out in plan · openclaw/openclaw@17edec7 address migrate auth review comments · openclaw/openclaw@0a98c2d fix ci blockers for migrate auth docs: add migrate auth changelog (#85667) · openclaw/openclaw@f7fcbdb fix(scripts): avoid duplicate install smoke ui build · openclaw/openclaw@b1b2841 fix(telegram): preserve inbound text entities (#83873) · openclaw/openclaw@b552919 chore: ignore Python bytecode caches · openclaw/openclaw@b6b2755 fix: make autoreview progress visible · openclaw/openclaw@236edb2 ci(release): fix plugin prerelease extension batch invocation test(telegram): provide topic cache store in message context harness · openclaw/openclaw@ff1fde1 test(agents): complete provider runtime test mocks · openclaw/openclaw@be8cd12 test(telegram): type topic cache harness store · openclaw/openclaw@84ab206 test(agents): sync provider runtime mocks · openclaw/openclaw@a289dd9 refactor: keep plain text tool-call promotion private (#86374) · openclaw/openclaw@c3ab2de fix(discord): suppress self-reply prompt echoes (#86238) docs: clarify config migration policy · openclaw/openclaw@c44367f fix(perf): fail startup bench on early gateway exit · openclaw/openclaw@a8fc28c fix: prevent plain text tool call leaks (#86222) · openclaw/openclaw@cd62780 fix: handle npm min-release-age in installers · openclaw/openclaw@316d97c fix(scripts): include ui:build in build-all full and ciArtifacts prof… · openclaw/openclaw@6704d0a fix(e2e): sample Windows kitchen sink gateway RSS · openclaw/openclaw@73189e3 fix(cron): respect isolated target and error on missing remove id (#8… · openclaw/openclaw@6709f4e fix(pi-embedded-runner): propagate trigger-derived priority to the gl… · openclaw/openclaw@0580f57 fix(cli): suppress self-update version warnings · openclaw/openclaw@e2bd20f fix: preserve webchat source reply details · openclaw/openclaw@aa50c51 docs: replace OpenClaw docs skill and add plugin permissions guide · openclaw/openclaw@0dabb70 fix(codex): preserve source reply mode for active runs (#86325) · openclaw/openclaw@b962110 fix: make compaction reinjection opt-in · openclaw/openclaw@ab910f8 fix codex usage-limit recovery copy (#86305) · openclaw/openclaw@c3c8a65 feat(ui): add ephemeral Activity tab · openclaw/openclaw@3dd0e8e fix(tests): harden native macos plugin proof · openclaw/openclaw@a5d5604 fix(commitments): serialize load-modify-save with in-process queue + … · openclaw/openclaw@d3c293d Fail Codex compaction at the Codex boundary (#85958) · openclaw/openclaw@dd47e47 fix(docker): restore config parent ownership · openclaw/openclaw@908b894 docs: clarify config default review policy (#86329) · openclaw/openclaw@3a03dd5 docs: clean changelog script entries · openclaw/openclaw@0eead19 fix(scripts): budget restart benchmark timeouts · openclaw/openclaw@5bd5509 fix: align ui vitest config assertion · openclaw/openclaw@730fd19 fix: route unit ui vitest targets narrowly · openclaw/openclaw@777402e fix: route explicit ui vitest targets narrowly · openclaw/openclaw@56a383c fix(android): harden play media permission removal fix(webchat): stabilize live transcript run state · openclaw/openclaw@119a01c fix(scripts): fail restart benchmark regressions · openclaw/openclaw@95d1b39 fix(openai): scope external codex auth to realtime fix(openai): prefer codex auth for GPT realtime · openclaw/openclaw@48c4f57 fix(openai): discover codex cli auth for provider checks · openclaw/openclaw@4656275 fix(android): keep talk mode on realtime relay · openclaw/openclaw@70614f8 test(android): add gateway connect adb probe · openclaw/openclaw@d7aa1f3 fix(android): stabilize realtime talk connection state · openclaw/openclaw@ffb02a5 test(android): add voice mode adb e2e harness · openclaw/openclaw@e52a3b3 fix(ci): stabilize deadcode and catalog checks · openclaw/openclaw@3db1508 fix(scripts): prebuild gateway cpu bench · openclaw/openclaw@ca70015 fix(e2e): harden bundled lifecycle probe on Windows · openclaw/openclaw@4798264 test(e2e): sample kitchen sink rpc peak rss · openclaw/openclaw@60c0f24 fix(scripts): remove stale deadcode allowlist entries · openclaw/openclaw@ea3bb92 fix(telegram): route polling diagnostics away from errors · openclaw/openclaw@b5c1199 fix(plugins): support linked source checkouts on Windows · openclaw/openclaw@793e300 fix(gateway): back off session tool mirrors under pressure (#84846) · openclaw/openclaw@42bdc94 fix(config): skip shell env fallback on Windows (#85739) · openclaw/openclaw@06bf302 fix(gateway): avoid duplicate session message broadcasts · openclaw/openclaw@1459044 fix: repair anchorless iMessage watch payloads · openclaw/openclaw@f37fbc9 fix(cli): route node status hints to stdout (#85780) · openclaw/openclaw@749692e fix(oc-path): support deep config edits (#86060) · openclaw/openclaw@3a72a30 fix(config): quiet benign metadata anomaly output · openclaw/openclaw@f3f4f29 fix(test): fail multi-node update regressions · openclaw/openclaw@732cf54 fix(google-vertex): support production ADC modes (#83971) · openclaw/openclaw@f09b4eb test(e2e): expose corrupt plugin deps smoke · openclaw/openclaw@fa3ff4d fix(codex): log app-server approval promotion trigger · openclaw/openclaw@d9af23f test(e2e): harden multi-node update smoke Clean up browser MCP subprocess tree (#85832) · openclaw/openclaw@8dc6b4d fix(agents): log warnings instead of swallowing subagent errors (#82943) · openclaw/openclaw@907bc03 fix(compaction): preserve partial summary on mid-chain chunk failure … · openclaw/openclaw@f0061dd fix(config): do not suppress recovery retry after failed backup resto… · openclaw/openclaw@5d174a5 chore: release 2026.5.25 fix(installer): support alpine cli installs · openclaw/openclaw@f68ed72 test(agents): keep runtime-plan provider mock current fix(scripts): launch env package scripts on Windows · openclaw/openclaw@4d4ce9e fix(agents): cache fallback provider resolution · openclaw/openclaw@3c8d101 fix(test): make import timing scripts Windows-safe · openclaw/openclaw@8ae9977 fix(telegram): transient Telegram pairing prompts (#85555) · openclaw/openclaw@8209426 fix(test): make max Vitest scripts Windows-safe · openclaw/openclaw@b681d5d fix(doctor): migrate Feishu account bot names (#86081) · openclaw/openclaw@9e8cc7e fix(scripts): prefilter conflict marker scans docs: add ClawSweeper review policy to AGENTS (#86197) · openclaw/openclaw@242e876 fix(installer): avoid before with npm release-age configs (#85491) · openclaw/openclaw@4742db6 fix(e2e): retry Windows kitchen sink probes · openclaw/openclaw@3e275a5
fix(qa): capture Windows gateway metrics · openclaw/openclaw@9afbfc1
vincentkoc · 2026-05-25 · via Recent Commits to openclaw:main

@@ -1,5 +1,45 @@

11

import { spawnSync } from "node:child_process";

223+

type ProcessTreeSnapshot = {

4+

childrenByParent: Map<number, number[]>;

5+

cpuByPid: Map<number, number>;

6+

rssByPid: Map<number, number>;

7+

};

8+9+

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

10+

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

11+

}

12+13+

function parsePositiveInteger(value: unknown): number | null {

14+

const raw = typeof value === "string" ? value.trim() : value;

15+

const parsed = Number(raw);

16+

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

17+

return null;

18+

}

19+

return parsed;

20+

}

21+22+

function parseNonNegativeInteger(value: unknown): number | null {

23+

const raw = typeof value === "string" ? value.trim() : value;

24+

const parsed = Number(raw);

25+

if (!Number.isInteger(parsed) || parsed < 0) {

26+

return null;

27+

}

28+

return parsed;

29+

}

30+31+

function parseNonNegativeNumber(value: unknown): number | null {

32+

const raw = typeof value === "string" ? value.trim() : value;

33+

if (raw === "") {

34+

return null;

35+

}

36+

const parsed = Number(raw);

37+

if (!Number.isFinite(parsed) || parsed < 0) {

38+

return null;

39+

}

40+

return parsed;

41+

}

42+343

export function parsePsCpuTimeMs(raw: string): number | null {

444

const parts = raw.trim().split(":").map(Number);

545

if (parts.some((part) => !Number.isFinite(part) || part < 0)) {

@@ -26,15 +66,136 @@ export function parsePsRssBytes(raw: string): number | null {

2666

return Math.round(rssKiB * 1024);

2767

}

286869+

export function parseWindowsProcessCpuTimeMs(params: {

70+

kernelModeTime: unknown;

71+

userModeTime: unknown;

72+

}): number | null {

73+

const kernelModeTime = parseNonNegativeNumber(params.kernelModeTime);

74+

const userModeTime = parseNonNegativeNumber(params.userModeTime);

75+

if (kernelModeTime === null || userModeTime === null) {

76+

return null;

77+

}

78+

return Math.round((kernelModeTime + userModeTime) / 10_000);

79+

}

80+81+

export function parseWindowsWorkingSetBytes(raw: unknown): number | null {

82+

const parsed = parseNonNegativeNumber(raw);

83+

return parsed === null ? null : Math.round(parsed);

84+

}

85+86+

export function parseWindowsProcessTreeSnapshot(raw: string): ProcessTreeSnapshot | null {

87+

let parsed: unknown;

88+

try {

89+

parsed = JSON.parse(raw);

90+

} catch {

91+

return null;

92+

}

93+

const entries = Array.isArray(parsed) ? parsed : isPlainObject(parsed) ? [parsed] : [];

94+

if (entries.length === 0) {

95+

return null;

96+

}

97+98+

const childrenByParent = new Map<number, number[]>();

99+

const cpuByPid = new Map<number, number>();

100+

const rssByPid = new Map<number, number>();

101+

for (const entry of entries) {

102+

if (!isPlainObject(entry)) {

103+

continue;

104+

}

105+

const pid = parsePositiveInteger(entry.ProcessId);

106+

const ppid = parseNonNegativeInteger(entry.ParentProcessId);

107+

if (pid === null || ppid === null) {

108+

continue;

109+

}

110+111+

const children = childrenByParent.get(ppid) ?? [];

112+

children.push(pid);

113+

childrenByParent.set(ppid, children);

114+115+

const cpuMs = parseWindowsProcessCpuTimeMs({

116+

kernelModeTime: entry.KernelModeTime,

117+

userModeTime: entry.UserModeTime,

118+

});

119+

if (cpuMs !== null) {

120+

cpuByPid.set(pid, cpuMs);

121+

}

122+123+

const rssBytes = parseWindowsWorkingSetBytes(entry.WorkingSetSize);

124+

if (rssBytes !== null) {

125+

rssByPid.set(pid, rssBytes);

126+

}

127+

}

128+129+

return {

130+

childrenByParent,

131+

cpuByPid,

132+

rssByPid,

133+

};

134+

}

135+136+

function collectProcessTreeMetric(

137+

rootPid: number,

138+

childrenByParent: Map<number, number[]>,

139+

metricByPid: Map<number, number>,

140+

): number | null {

141+

if (!metricByPid.has(rootPid)) {

142+

return null;

143+

}

144+145+

let total = 0;

146+

const seen = new Set<number>();

147+

const stack: number[] = [rootPid];

148+

while (stack.length > 0) {

149+

const pid = stack.pop();

150+

if (pid === undefined || seen.has(pid)) {

151+

continue;

152+

}

153+

seen.add(pid);

154+

total += metricByPid.get(pid) ?? 0;

155+

for (const childPid of childrenByParent.get(pid) ?? []) {

156+

stack.push(childPid);

157+

}

158+

}

159+

return total;

160+

}

161+162+

function readWindowsProcessTreeSnapshot(): ProcessTreeSnapshot | null {

163+

const result = spawnSync(

164+

"powershell.exe",

165+

[

166+

"-NoProfile",

167+

"-ExecutionPolicy",

168+

"Bypass",

169+

"-Command",

170+

[

171+

"$ErrorActionPreference='Stop';",

172+

"Get-CimInstance Win32_Process |",

173+

"Select-Object ProcessId,ParentProcessId,KernelModeTime,UserModeTime,WorkingSetSize |",

174+

"ConvertTo-Json -Compress",

175+

].join(" "),

176+

],

177+

{

178+

encoding: "utf8",

179+

maxBuffer: 16 * 1024 * 1024,

180+

stdio: ["ignore", "pipe", "ignore"],

181+

},

182+

);

183+

if (result.status !== 0) {

184+

return null;

185+

}

186+

return parseWindowsProcessTreeSnapshot(result.stdout);

187+

}

188+29189

export function readProcessTreeCpuMs(rootPid: number | null | undefined): number | null {

30-

if (

31-

typeof rootPid !== "number" ||

32-

!Number.isInteger(rootPid) ||

33-

rootPid <= 0 ||

34-

process.platform === "win32"

35-

) {

190+

if (typeof rootPid !== "number" || !Number.isInteger(rootPid) || rootPid <= 0) {

36191

return null;

37192

}

193+

if (process.platform === "win32") {

194+

const snapshot = readWindowsProcessTreeSnapshot();

195+

return snapshot

196+

? collectProcessTreeMetric(rootPid, snapshot.childrenByParent, snapshot.cpuByPid)

197+

: null;

198+

}

38199

const result = spawnSync("ps", ["-eo", "pid=,ppid=,time="], {

39200

encoding: "utf8",

40201

stdio: ["ignore", "pipe", "ignore"],

@@ -66,32 +227,19 @@ export function readProcessTreeCpuMs(rootPid: number | null | undefined): number

66227

return null;

67228

}

6822969-

let totalCpuMs = 0;

70-

const seen = new Set<number>();

71-

const stack: number[] = [rootPid];

72-

while (stack.length > 0) {

73-

const pid = stack.pop();

74-

if (pid === undefined || seen.has(pid)) {

75-

continue;

76-

}

77-

seen.add(pid);

78-

totalCpuMs += cpuByPid.get(pid) ?? 0;

79-

for (const childPid of childrenByParent.get(pid) ?? []) {

80-

stack.push(childPid);

81-

}

82-

}

83-

return totalCpuMs;

230+

return collectProcessTreeMetric(rootPid, childrenByParent, cpuByPid);

84231

}

8523286233

export function readProcessTreeRssBytes(rootPid: number | null | undefined): number | null {

87-

if (

88-

typeof rootPid !== "number" ||

89-

!Number.isInteger(rootPid) ||

90-

rootPid <= 0 ||

91-

process.platform === "win32"

92-

) {

234+

if (typeof rootPid !== "number" || !Number.isInteger(rootPid) || rootPid <= 0) {

93235

return null;

94236

}

237+

if (process.platform === "win32") {

238+

const snapshot = readWindowsProcessTreeSnapshot();

239+

return snapshot

240+

? collectProcessTreeMetric(rootPid, snapshot.childrenByParent, snapshot.rssByPid)

241+

: null;

242+

}

95243

const result = spawnSync("ps", ["-eo", "pid=,ppid=,rss="], {

96244

encoding: "utf8",

97245

stdio: ["ignore", "pipe", "ignore"],

@@ -123,19 +271,5 @@ export function readProcessTreeRssBytes(rootPid: number | null | undefined): num

123271

return null;

124272

}

125273126-

let totalRssBytes = 0;

127-

const seen = new Set<number>();

128-

const stack: number[] = [rootPid];

129-

while (stack.length > 0) {

130-

const pid = stack.pop();

131-

if (pid === undefined || seen.has(pid)) {

132-

continue;

133-

}

134-

seen.add(pid);

135-

totalRssBytes += rssByPid.get(pid) ?? 0;

136-

for (const childPid of childrenByParent.get(pid) ?? []) {

137-

stack.push(childPid);

138-

}

139-

}

140-

return totalRssBytes;

274+

return collectProcessTreeMetric(rootPid, childrenByParent, rssByPid);

141275

}