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

推荐订阅源

The GitHub Blog
The GitHub Blog
博客园 - 三生石上(FineUI控件)
V
V2EX
博客园 - 司徒正美
小众软件
小众软件
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tailwind CSS Blog
Last Week in AI
Last Week in AI
雷峰网
雷峰网
月光博客
月光博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Apple Machine Learning Research
Apple Machine Learning Research
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
SegmentFault 最新的问题
美团技术团队
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
爱范儿
爱范儿
博客园 - 聂微东
量子位
J
Java Code Geeks
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Vercel News
Vercel News

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(secret-providers): clean PTY configure timeout trees ...
vincentkoc · 2026-06-20 · via Recent Commits to openclaw:main

@@ -1700,7 +1700,7 @@ async function p12OpenAiLiveProof() {

17001700

return "OpenAI model auth probe consumed API key through plugin-managed auth-profile SecretRef";

17011701

}

170217021703-

async function runPtySecretsConfigurePreset(envCtx) {

1703+

async function runPtySecretsConfigurePreset(envCtx, options = {}) {

17041704

const { spawn } = await import("@lydell/node-pty");

17051705

const command = await resolveOpenClawCommand(

17061706

["secrets", "configure", "--providers-only", "--apply", "--yes", "--allow-exec", "--json"],

@@ -1715,16 +1715,39 @@ async function runPtySecretsConfigurePreset(envCtx) {

17151715

});

17161716

const output = createOutputCapture("secrets configure stdout");

17171717

let phase = "providers-menu";

1718+

const keyTimers = new Set();

1719+

const clearKeyTimers = () => {

1720+

for (const keyTimer of keyTimers) {

1721+

clearTimeout(keyTimer);

1722+

}

1723+

keyTimers.clear();

1724+

};

17181725

const sendKeys = (keys) => {

17191726

keys.forEach((key, index) => {

1720-

setTimeout(() => child.write(key), index * 80);

1727+

const keyTimer = setTimeout(() => {

1728+

keyTimers.delete(keyTimer);

1729+

child.write(key);

1730+

}, index * 80);

1731+

keyTimers.add(keyTimer);

17211732

});

17221733

};

17231734

return await new Promise((resolve, reject) => {

1735+

let timedOut = false;

1736+

let forceKillAt;

1737+

let forceKillTimer;

1738+

const timeoutMs = options.timeoutMs ?? 60000;

1739+

const timeoutKillGraceMs = options.timeoutKillGraceMs ?? COMMAND_TIMEOUT_KILL_GRACE_MS;

17241740

const timer = setTimeout(() => {

1725-

child.kill();

1726-

reject(new Error(`secrets configure preset timed out: ${scrub(output.text())}`));

1727-

}, 60000);

1741+

timedOut = true;

1742+

signalPtyProcessTree(child, "SIGHUP");

1743+

forceKillAt = Date.now() + timeoutKillGraceMs;

1744+

forceKillTimer = setTimeout(() => {

1745+

forceKillTimer = undefined;

1746+

forceKillAt = undefined;

1747+

signalPtyProcessTree(child, "SIGKILL");

1748+

}, timeoutKillGraceMs);

1749+

forceKillTimer.unref?.();

1750+

}, timeoutMs);

17281751

child.onData((data) => {

17291752

output.append(data);

17301753

const outputText = output.text();

@@ -1746,6 +1769,20 @@ async function runPtySecretsConfigurePreset(envCtx) {

17461769

});

17471770

child.onExit(({ exitCode }) => {

17481771

clearTimeout(timer);

1772+

clearKeyTimers();

1773+

if (timedOut) {

1774+

void finishTimedOutPtyProcessTree(child, {

1775+

forceKillAt,

1776+

forceKillTimer,

1777+

timeoutKillGraceMs,

1778+

}).finally(() =>

1779+

reject(new Error(`secrets configure preset timed out: ${scrub(output.text())}`)),

1780+

);

1781+

return;

1782+

}

1783+

if (forceKillTimer) {

1784+

clearTimeout(forceKillTimer);

1785+

}

17491786

if (exitCode !== 0) {

17501787

reject(new Error(`secrets configure preset failed (${exitCode}): ${scrub(output.text())}`));

17511788

return;

@@ -1755,6 +1792,57 @@ async function runPtySecretsConfigurePreset(envCtx) {

17551792

});

17561793

}

175717941795+

async function finishTimedOutPtyProcessTree(

1796+

child,

1797+

{ forceKillAt, forceKillTimer, timeoutKillGraceMs },

1798+

) {

1799+

const graceRemainingMs =

1800+

forceKillAt === undefined ? timeoutKillGraceMs : Math.max(0, forceKillAt - Date.now());

1801+

if (graceRemainingMs > 0) {

1802+

await waitForPtyProcessTreeExit(child, graceRemainingMs);

1803+

}

1804+

if (forceKillTimer) {

1805+

clearTimeout(forceKillTimer);

1806+

}

1807+

if (ptyProcessTreeIsAlive(child)) {

1808+

signalPtyProcessTree(child, "SIGKILL");

1809+

}

1810+

await waitForPtyProcessTreeExit(child, timeoutKillGraceMs);

1811+

}

1812+1813+

function ptyProcessTreeIsAlive(child) {

1814+

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

1815+

return false;

1816+

}

1817+

try {

1818+

process.kill(-child.pid, 0);

1819+

return true;

1820+

} catch (error) {

1821+

return error?.code === "EPERM";

1822+

}

1823+

}

1824+1825+

async function waitForPtyProcessTreeExit(child, timeoutMs) {

1826+

const started = Date.now();

1827+

while (Date.now() - started < timeoutMs) {

1828+

if (!ptyProcessTreeIsAlive(child)) {

1829+

return true;

1830+

}

1831+

await delay(50);

1832+

}

1833+

return !ptyProcessTreeIsAlive(child);

1834+

}

1835+1836+

function signalPtyProcessTree(child, signal) {

1837+

if (process.platform !== "win32" && typeof child.pid === "number") {

1838+

try {

1839+

process.kill(-child.pid, signal);

1840+

return;

1841+

} catch {}

1842+

}

1843+

child.kill(signal);

1844+

}

1845+17581846

async function p13SecretsConfigurePreset() {

17591847

await withProofEnv("p13", async (envCtx) => {

17601848

const port = await allocatePort();