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

推荐订阅源

F
Fortinet All Blogs
有赞技术团队
有赞技术团队
量子位
N
Netflix TechBlog - Medium
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
GbyAI
GbyAI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Blog — PlanetScale
Blog — PlanetScale
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
Martin Fowler
Martin Fowler
Y
Y Combinator Blog
宝玉的分享
宝玉的分享
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
V
V2EX
IT之家
IT之家
L
LangChain 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(plugins): cancel marketplace archive error bodies · o...
vincentkoc · 2026-06-19 · via Recent Commits to openclaw:main

@@ -215,6 +215,25 @@ function expectFetchDownloadCall(url = "https://example.com/frontend-design.tgz"

215215

expect(input.auditContext).toBe("marketplace-plugin-download");

216216

}

217217218+

function cancelTrackedResponse(init?: ResponseInit): {

219+

response: Response;

220+

wasCanceled: () => boolean;

221+

} {

222+

let canceled = false;

223+

const stream = new ReadableStream<Uint8Array>({

224+

start(controller) {

225+

controller.enqueue(new TextEncoder().encode("ignored"));

226+

},

227+

cancel() {

228+

canceled = true;

229+

},

230+

});

231+

return {

232+

response: new Response(stream, init),

233+

wasCanceled: () => canceled,

234+

};

235+

}

236+218237

function expectRemoteMarketplaceInstallResult(result: unknown) {

219238

expectRemoteCloneCommand();

220239

expect(String(installPluginInput().path)).toMatch(/[\\/]repo[\\/]plugins[\\/]frontend-design$/);

@@ -696,6 +715,42 @@ describe("marketplace plugins", () => {

696715

});

697716

});

698717718+

it("cancels archive download error bodies before returning structured HTTP errors", async () => {

719+

await withTempDir("openclaw-marketplace-test-", async (rootDir) => {

720+

const tracked = cancelTrackedResponse({

721+

status: 503,

722+

statusText: "Service Unavailable",

723+

});

724+

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

725+

fetchWithSsrFGuardMock.mockResolvedValueOnce({

726+

response: tracked.response,

727+

finalUrl: "https://example.com/frontend-design.tgz",

728+

release,

729+

});

730+

const manifestPath = await writeMarketplaceManifest(rootDir, {

731+

plugins: [

732+

{

733+

name: "frontend-design",

734+

source: "https://example.com/frontend-design.tgz",

735+

},

736+

],

737+

});

738+739+

const result = await installPluginFromMarketplace({

740+

marketplace: manifestPath,

741+

plugin: "frontend-design",

742+

});

743+744+

expect(result).toEqual({

745+

ok: false,

746+

error: "failed to download https://example.com/frontend-design.tgz: HTTP 503",

747+

});

748+

expect(tracked.wasCanceled()).toBe(true);

749+

expect(installPluginFromPathMock).not.toHaveBeenCalled();

750+

expect(release).toHaveBeenCalledTimes(1);

751+

});

752+

});

753+699754

it("returns a structured error for invalid archive URLs", async () => {

700755

await withTempDir("openclaw-marketplace-test-", async (rootDir) => {

701756

const manifestPath = await writeMarketplaceManifest(rootDir, {

@@ -847,11 +902,12 @@ describe("marketplace plugins", () => {

847902

it("rejects non-streaming archive responses before buffering them", async () => {

848903

await withTempDir("openclaw-marketplace-test-", async (rootDir) => {

849904

const arrayBuffer = vi.fn(async () => new Uint8Array([1, 2, 3]).buffer);

905+

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

850906

fetchWithSsrFGuardMock.mockResolvedValueOnce({

851907

response: {

852908

ok: true,

853909

status: 200,

854-

body: {} as Response["body"],

910+

body: { cancel } as unknown as Response["body"],

855911

headers: new Headers(),

856912

arrayBuffer,

857913

} as unknown as Response,

@@ -879,6 +935,7 @@ describe("marketplace plugins", () => {

879935

"streaming response body unavailable",

880936

});

881937

expect(arrayBuffer).not.toHaveBeenCalled();

938+

expect(cancel).toHaveBeenCalledTimes(1);

882939

expect(installPluginFromPathMock).not.toHaveBeenCalled();

883940

});

884941

});

@@ -933,12 +990,15 @@ describe("marketplace plugins", () => {

933990

"download too large: 268435457 bytes (limit: 268435456 bytes)",

934991

});

935992

expect(arrayBuffer).not.toHaveBeenCalled();

993+

expect(reader.cancel).toHaveBeenCalledTimes(1);

994+

expect(reader.releaseLock).toHaveBeenCalledTimes(1);

936995

expect(installPluginFromPathMock).not.toHaveBeenCalled();

937996

});

938997

});

939998940999

it("rejects malformed archive content-length headers before streaming", async () => {

9411000

await withTempDir("openclaw-marketplace-test-", async (rootDir) => {

1001+

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

9421002

const reader = {

9431003

read: vi.fn(),

9441004

cancel: vi.fn(async () => undefined),

@@ -950,6 +1010,7 @@ describe("marketplace plugins", () => {

9501010

status: 200,

9511011

body: {

9521012

getReader: () => reader,

1013+

cancel,

9531014

} as unknown as Response["body"],

9541015

headers: new Headers({ "content-length": "1e9" }),

9551016

} as unknown as Response,

@@ -977,6 +1038,56 @@ describe("marketplace plugins", () => {

9771038

"invalid content-length header: 1e9",

9781039

});

9791040

expect(reader.read).not.toHaveBeenCalled();

1041+

expect(reader.cancel).not.toHaveBeenCalled();

1042+

expect(cancel).toHaveBeenCalledTimes(1);

1043+

expect(installPluginFromPathMock).not.toHaveBeenCalled();

1044+

});

1045+

});

1046+1047+

it("rejects oversized archive content-length headers before streaming", async () => {

1048+

await withTempDir("openclaw-marketplace-test-", async (rootDir) => {

1049+

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

1050+

const reader = {

1051+

read: vi.fn(),

1052+

cancel: vi.fn(async () => undefined),

1053+

releaseLock: vi.fn(),

1054+

};

1055+

fetchWithSsrFGuardMock.mockResolvedValueOnce({

1056+

response: {

1057+

ok: true,

1058+

status: 200,

1059+

body: {

1060+

getReader: () => reader,

1061+

cancel,

1062+

} as unknown as Response["body"],

1063+

headers: new Headers({ "content-length": String(256 * 1024 * 1024 + 1) }),

1064+

} as unknown as Response,

1065+

finalUrl: "https://cdn.example.com/releases/frontend-design.tgz",

1066+

release: vi.fn(async () => undefined),

1067+

});

1068+

const manifestPath = await writeMarketplaceManifest(rootDir, {

1069+

plugins: [

1070+

{

1071+

name: "frontend-design",

1072+

source: "https://example.com/frontend-design.tgz",

1073+

},

1074+

],

1075+

});

1076+1077+

const result = await installPluginFromMarketplace({

1078+

marketplace: manifestPath,

1079+

plugin: "frontend-design",

1080+

});

1081+1082+

expect(result).toEqual({

1083+

ok: false,

1084+

error:

1085+

"failed to download https://example.com/frontend-design.tgz: " +

1086+

"download too large: 268435457 bytes (limit: 268435456 bytes)",

1087+

});

1088+

expect(reader.read).not.toHaveBeenCalled();

1089+

expect(reader.cancel).not.toHaveBeenCalled();

1090+

expect(cancel).toHaveBeenCalledTimes(1);

9801091

expect(installPluginFromPathMock).not.toHaveBeenCalled();

9811092

});

9821093

});