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

推荐订阅源

Y
Y Combinator Blog
IT之家
IT之家
博客园_首页
人人都是产品经理
人人都是产品经理
博客园 - Franky
I
InfoQ
Recent Announcements
Recent Announcements
P
Proofpoint News Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
GbyAI
GbyAI
大猫的无限游戏
大猫的无限游戏
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
月光博客
月光博客
Microsoft Security Blog
Microsoft Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
B
Blog RSS Feed
MongoDB | Blog
MongoDB | Blog
雷峰网
雷峰网
博客园 - 聂微东
N
Netflix TechBlog - Medium
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The GitHub Blog
The GitHub Blog
D
Docker

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
test(e2e): sample kitchen sink RSS on Windows · openclaw/...
vincentkoc · 2026-05-23 · via Recent Commits to openclaw:main

@@ -4,7 +4,7 @@ import os from "node:os";

44

import path from "node:path";

55

import process from "node:process";

66

import { setTimeout as delay } from "node:timers/promises";

7-

import { pathToFileURL } from "node:url";

7+

import { fileURLToPath, pathToFileURL } from "node:url";

8899

const PLUGIN_SPEC =

1010

process.env.OPENCLAW_KITCHEN_SINK_NPM_SPEC || "npm:@openclaw/kitchen-sink@latest";

@@ -517,12 +517,21 @@ function assertToolInvokeResult(payload) {

517517

}

518518

}

519519520-

async function sampleProcess(pid) {

521-

if (!pid || process.platform === "win32") {

520+

export async function sampleProcess(pid, options = {}) {

521+

const platform = options.platform ?? process.platform;

522+

const run = options.runCommand ?? runCommand;

523+

if (!pid) {

522524

return null;

523525

}

526+

if (platform === "win32") {

527+

return sampleWindowsProcess(pid, run);

528+

}

529+

return samplePosixProcess(pid, run);

530+

}

531+532+

async function samplePosixProcess(pid, run) {

524533

try {

525-

const { stdout } = await runCommand("ps", ["-o", "rss=,pcpu=", "-p", String(pid)], {

534+

const { stdout } = await run("ps", ["-o", "rss=,pcpu=", "-p", String(pid)], {

526535

timeoutMs: 5000,

527536

});

528537

const [rssKbRaw, cpuRaw] = stdout.trim().split(/\s+/u);

@@ -540,7 +549,44 @@ async function sampleProcess(pid) {

540549

}

541550

}

542551543-

function assertResourceCeiling(sample) {

552+

async function sampleWindowsProcess(pid, run) {

553+

const safePid = Number(pid);

554+

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

555+

return null;

556+

}

557+

const command = [

558+

"$ErrorActionPreference = 'Stop'",

559+

`$process = Get-Process -Id ${safePid} -ErrorAction Stop`,

560+

"$cpu = 0",

561+

"if ($null -ne $process.CPU) { $cpu = $process.CPU }",

562+

"[Console]::Out.Write(('{0} {1}' -f $process.WorkingSet64, $cpu))",

563+

].join("; ");

564+

for (const powershell of ["powershell.exe", "powershell"]) {

565+

try {

566+

const { stdout } = await run(

567+

powershell,

568+

["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", command],

569+

{ timeoutMs: 5000 },

570+

);

571+

const [workingSetBytesRaw, cpuSecondsRaw] = stdout.trim().split(/\s+/u);

572+

const workingSetBytes = Number.parseInt(workingSetBytesRaw ?? "", 10);

573+

const cpuSeconds = Number.parseFloat(cpuSecondsRaw ?? "");

574+

if (!Number.isFinite(workingSetBytes)) {

575+

return null;

576+

}

577+

return {

578+

rssMiB: Math.round((workingSetBytes / 1024 / 1024) * 10) / 10,

579+

cpuPercent: null,

580+

cpuSeconds: Number.isFinite(cpuSeconds) ? cpuSeconds : null,

581+

};

582+

} catch {

583+

// Try the next Windows PowerShell command name.

584+

}

585+

}

586+

return null;

587+

}

588+589+

export function assertResourceCeiling(sample) {

544590

if (!sample) {

545591

return;

546592

}

@@ -590,7 +636,7 @@ function isNonEmptyString(value) {

590636

return typeof value === "string" && value.trim().length > 0;

591637

}

592638593-

async function main() {

639+

export async function main() {

594640

const runner = resolveOpenClawRunner();

595641

const port = readPositiveInt(process.env.OPENCLAW_KITCHEN_SINK_RPC_PORT, DEFAULT_PORT);

596642

const { root, env } = makeEnv();

@@ -725,4 +771,6 @@ async function main() {

725771

}

726772

}

727773728-

await main();

774+

if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {

775+

await main();

776+

}