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

推荐订阅源

有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
量子位
S
SegmentFault 最新的问题
V
Visual Studio Blog
博客园 - 【当耐特】
Apple Machine Learning Research
Apple Machine Learning Research
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
Stack Overflow Blog
Stack Overflow Blog
Vercel News
Vercel News
D
Docker
J
Java Code Geeks
博客园 - 三生石上(FineUI控件)
博客园 - Franky
Recent Announcements
Recent Announcements
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
D
DataBreaches.Net
Y
Y Combinator Blog
云风的 BLOG
云风的 BLOG
V
V2EX

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 ClawHub preflight waits · openclaw/opencl...
vincentkoc · 2026-05-27 · via Recent Commits to openclaw:main

@@ -4,9 +4,44 @@ import path from "node:path";

4455

const command = process.argv[2];

66

const scratchRoot = process.env.OPENCLAW_PLUGINS_TMP_DIR || os.tmpdir();

7+

const CLAWHUB_PREFLIGHT_TIMEOUT_MS = readPositiveInt(

8+

process.env.OPENCLAW_PLUGINS_E2E_CLAWHUB_PREFLIGHT_TIMEOUT_MS,

9+

30_000,

10+

);

711

const readJson = (file) => JSON.parse(fs.readFileSync(file, "utf8"));

812

const scratchFile = (name) => path.join(scratchRoot, name);

91314+

function readPositiveInt(raw, fallback) {

15+

const parsed = Number.parseInt(String(raw || ""), 10);

16+

return Number.isInteger(parsed) && parsed > 0 ? parsed : fallback;

17+

}

18+19+

function createTimeoutError(label, timeoutMs) {

20+

const error = new Error(`${label} timed out after ${timeoutMs}ms`);

21+

error.code = "ETIMEDOUT";

22+

return error;

23+

}

24+25+

async function withTimeout(label, timeoutMs, run) {

26+

const controller = new AbortController();

27+

const timeoutError = createTimeoutError(label, timeoutMs);

28+

let timeout;

29+

const timeoutPromise = new Promise((_, reject) => {

30+

timeout = setTimeout(() => {

31+

controller.abort(timeoutError);

32+

reject(timeoutError);

33+

}, timeoutMs);

34+

timeout.unref?.();

35+

});

36+

try {

37+

return await Promise.race([run(controller.signal), timeoutPromise]);

38+

} finally {

39+

if (timeout) {

40+

clearTimeout(timeout);

41+

}

42+

}

43+

}

44+1045

function resolveHomePath(value) {

1146

if (value === "~") {

1247

return process.env.HOME;

@@ -420,12 +455,18 @@ function assertGitPlugin() {

420455

}

421456

assertRealPathInside(installPath, dependencyPackagePath, "git plugin installed dependency");

422457

fs.writeFileSync(scratchFile("plugins-git-install-path.txt"), installPath, "utf8");

423-

fs.writeFileSync(scratchFile("plugins-git-install-parent.txt"), path.dirname(installPath), "utf8");

458+

fs.writeFileSync(

459+

scratchFile("plugins-git-install-parent.txt"),

460+

path.dirname(installPath),

461+

"utf8",

462+

);

424463

}

425464426465

function assertGitPluginRemoved() {

427466

const installPath = fs.readFileSync(scratchFile("plugins-git-install-path.txt"), "utf8").trim();

428-

const installParent = fs.readFileSync(scratchFile("plugins-git-install-parent.txt"), "utf8").trim();

467+

const installParent = fs

468+

.readFileSync(scratchFile("plugins-git-install-parent.txt"), "utf8")

469+

.trim();

429470

assertPluginRemoved({

430471

pluginId: "demo-plugin-git",

431472

listFile: scratchFile("plugins-git-uninstalled.json"),

@@ -597,7 +638,10 @@ function assertNpmPlugin() {

597638

}

598639599640

function assertNpmPluginUpdateUnchanged() {

600-

assertUpdateOutput(scratchFile("plugins-npm-update.log"), "demo-plugin-npm is up to date (0.0.1).");

641+

assertUpdateOutput(

642+

scratchFile("plugins-npm-update.log"),

643+

"demo-plugin-npm is up to date (0.0.1).",

644+

);

601645

assertNpmPlugin();

602646

}

603647

@@ -748,16 +792,31 @@ async function assertClawHubPreflight() {

748792

process.env.CLAWHUB_TOKEN ||

749793

process.env.CLAWHUB_AUTH_TOKEN ||

750794

"";

751-

const response = await fetch(`${baseUrl}/api/v1/packages/${encodeURIComponent(packageName)}`, {

752-

headers: token ? { Authorization: `Bearer ${token}` } : undefined,

753-

});

795+

const preflightUrl = `${baseUrl}/api/v1/packages/${encodeURIComponent(packageName)}`;

796+

const response = await withTimeout(

797+

`ClawHub package preflight for ${packageName}`,

798+

CLAWHUB_PREFLIGHT_TIMEOUT_MS,

799+

(signal) =>

800+

fetch(preflightUrl, {

801+

headers: token ? { Authorization: `Bearer ${token}` } : undefined,

802+

signal,

803+

}),

804+

);

754805

if (!response.ok) {

755-

const body = await response.text().catch(() => "");

806+

const body = await withTimeout(

807+

`ClawHub package preflight response for ${packageName}`,

808+

CLAWHUB_PREFLIGHT_TIMEOUT_MS,

809+

() => response.text().catch(() => ""),

810+

);

756811

throw new Error(

757812

`ClawHub package preflight failed for ${packageName}: ${response.status} ${body}`,

758813

);

759814

}

760-

const detail = await response.json();

815+

const detail = await withTimeout(

816+

`ClawHub package preflight response for ${packageName}`,

817+

CLAWHUB_PREFLIGHT_TIMEOUT_MS,

818+

() => response.json(),

819+

);

761820

const family = detail.package?.family;

762821

if (family !== "code-plugin" && family !== "bundle-plugin") {

763822

throw new Error(`ClawHub package ${packageName} is not installable as a plugin: ${family}`);

@@ -834,7 +893,9 @@ function assertClawHubInstalled() {

834893835894

function assertClawHubRemoved() {

836895

const pluginId = process.env.CLAWHUB_PLUGIN_ID;

837-

const installPath = fs.readFileSync(scratchFile("plugins-clawhub-install-path.txt"), "utf8").trim();

896+

const installPath = fs

897+

.readFileSync(scratchFile("plugins-clawhub-install-path.txt"), "utf8")

898+

.trim();

838899

const list = readJson(scratchFile("plugins-clawhub-uninstalled.json"));

839900

if ((list.plugins || []).some((entry) => entry.id === pluginId)) {

840901

throw new Error(`ClawHub plugin still listed after uninstall: ${pluginId}`);