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

推荐订阅源

MongoDB | Blog
MongoDB | Blog
B
Blog
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
aimingoo的专栏
aimingoo的专栏
B
Blog RSS Feed
博客园 - Franky
V
V2EX
IT之家
IT之家
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
F
Fortinet All Blogs
I
InfoQ
云风的 BLOG
云风的 BLOG
腾讯CDC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Proofpoint News Feed
Microsoft Security Blog
Microsoft Security Blog

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(agents): release provider error body readers · opencl...
vincentkoc · 2026-06-19 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

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

11

// Verifies provider HTTP error parsing, redaction, and response-size limits.

2-

import { describe, expect, it } from "vitest";

2+

import { describe, expect, it, vi } from "vitest";

33

import {

44

assertOkOrThrowProviderError,

55

assertOkOrThrowHttpError,

@@ -9,6 +9,7 @@ import {

99

ProviderHttpError,

1010

readProviderBinaryResponse,

1111

readProviderJsonResponse,

12+

readResponseTextLimited,

1213

} from "./provider-http-errors.js";

1314
1415

function createStreamingBinaryResponse(params: {

@@ -108,6 +109,46 @@ describe("provider error utils", () => {

108109

} satisfies Partial<ProviderHttpError>);

109110

});

110111
112+

it("releases provider error body reader locks after bounded reads complete", async () => {

113+

const releaseLock = vi.fn();

114+

const cancel = vi.fn(async () => undefined);

115+

const chunks: Array<ReadableStreamReadResult<Uint8Array>> = [

116+

{ done: false, value: new TextEncoder().encode("provider error") },

117+

{ done: true, value: undefined },

118+

];

119+

const response = {

120+

body: {

121+

getReader: () => ({

122+

read: async () => chunks.shift() ?? { done: true, value: undefined },

123+

cancel,

124+

releaseLock,

125+

}),

126+

},

127+

} as unknown as Response;

128+
129+

await expect(readResponseTextLimited(response, 64)).resolves.toBe("provider error");

130+

expect(cancel).not.toHaveBeenCalled();

131+

expect(releaseLock).toHaveBeenCalledTimes(1);

132+

});

133+
134+

it("cancels and releases provider error body readers after diagnostic truncation", async () => {

135+

const releaseLock = vi.fn();

136+

const cancel = vi.fn(async () => undefined);

137+

const response = {

138+

body: {

139+

getReader: () => ({

140+

read: async () => ({ done: false, value: new TextEncoder().encode("provider error") }),

141+

cancel,

142+

releaseLock,

143+

}),

144+

},

145+

} as unknown as Response;

146+
147+

await expect(readResponseTextLimited(response, 8)).resolves.toBe("provider");

148+

expect(cancel).toHaveBeenCalledTimes(1);

149+

expect(releaseLock).toHaveBeenCalledTimes(1);

150+

});

151+
111152

it("attaches structured provider error metadata", async () => {

112153

// API-key-like substrings must be redacted from stored error bodies.

113154

const response = new Response(