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

推荐订阅源

aimingoo的专栏
aimingoo的专栏
腾讯CDC
Y
Y Combinator Blog
L
LangChain Blog
B
Blog
U
Unit 42
P
Proofpoint News Feed
G
Google Developers Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 【当耐特】
WordPress大学
WordPress大学
月光博客
月光博客
Vercel News
Vercel News
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 叶小钗

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): cancel stalled kitchen sink response streams · ...
vincentkoc · 2026-06-19 · via Recent Commits to openclaw:main

@@ -923,7 +923,7 @@ export async function fetchJson(url, options = {}) {

923923

...(abortPromise ? [abortPromise] : []),

924924

]);

925925

const text = await Promise.race([

926-

readBoundedResponseText(response, maxBodyBytes),

926+

readBoundedResponseText(response, maxBodyBytes, timeoutPromise),

927927

timeoutPromise,

928928

...(abortPromise ? [abortPromise] : []),

929929

]);

@@ -950,39 +950,44 @@ export async function fetchJson(url, options = {}) {

950950

throw toLintErrorObject(lastError ?? new Error(`fetch ${url} failed`), "Non-Error thrown");

951951

}

952952953-

export async function readBoundedResponseText(

954-

response,

955-

byteLimit = resolveKitchenSinkRpcConfig().fetchBodyMaxBytes,

956-

) {

953+

export async function readBoundedResponseText(response, byteLimit, timeoutPromise) {

954+

const resolvedByteLimit = byteLimit ?? resolveKitchenSinkRpcConfig().fetchBodyMaxBytes;

957955

const contentLength = response.headers?.get?.("content-length");

958956

if (contentLength && /^\d+$/u.test(contentLength)) {

959957

const parsedContentLength = Number(contentLength);

960-

if (Number.isSafeInteger(parsedContentLength) && parsedContentLength > byteLimit) {

958+

if (Number.isSafeInteger(parsedContentLength) && parsedContentLength > resolvedByteLimit) {

961959

await response.body?.cancel?.().catch(() => undefined);

962-

throw createFetchBodyTooLargeError(byteLimit);

960+

throw createFetchBodyTooLargeError(resolvedByteLimit);

963961

}

964962

}

965963966964

const reader = response.body?.getReader?.();

967965

if (!reader) {

968-

const text = await response.text();

969-

if (Buffer.byteLength(text, "utf8") > byteLimit) {

970-

throw createFetchBodyTooLargeError(byteLimit);

966+

const text = await withOptionalTimeout(response.text(), timeoutPromise);

967+

if (Buffer.byteLength(text, "utf8") > resolvedByteLimit) {

968+

throw createFetchBodyTooLargeError(resolvedByteLimit);

971969

}

972970

return text;

973971

}

974972

const chunks = [];

975973

let totalBytes = 0;

976974

for (;;) {

977-

const { done, value } = await reader.read();

975+

const read = reader.read();

976+

const { done, value } = await withOptionalTimeout(

977+

read,

978+

timeoutPromise?.catch((error) => {

979+

cancelReaderSoon(reader);

980+

throw error;

981+

}),

982+

);

978983

if (done) {

979984

break;

980985

}

981986

const chunk = Buffer.from(value);

982987

totalBytes += chunk.byteLength;

983-

if (totalBytes > byteLimit) {

988+

if (totalBytes > resolvedByteLimit) {

984989

await reader.cancel().catch(() => undefined);

985-

throw createFetchBodyTooLargeError(byteLimit);

990+

throw createFetchBodyTooLargeError(resolvedByteLimit);

986991

}

987992

chunks.push(chunk);

988993

}

@@ -995,6 +1000,19 @@ function createFetchBodyTooLargeError(byteLimit) {

9951000

});

9961001

}

99710021003+

async function withOptionalTimeout(promise, timeoutPromise) {

1004+

if (!timeoutPromise) {

1005+

return await promise;

1006+

}

1007+

return await Promise.race([promise, timeoutPromise]);

1008+

}

1009+1010+

function cancelReaderSoon(reader) {

1011+

void Promise.resolve()

1012+

.then(() => reader.cancel())

1013+

.catch(() => undefined);

1014+

}

1015+9981016

function configureKitchenSink(env, port) {

9991017

const configPath = env.OPENCLAW_CONFIG_PATH;

10001018

const config = fs.existsSync(configPath) ? readJson(configPath) : {};