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

推荐订阅源

G
Google Developers Blog
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Help Net Security
B
Blog RSS Feed
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
N
Netflix TechBlog - Medium
S
SegmentFault 最新的问题
The Cloudflare Blog
I
InfoQ
美团技术团队
博客园 - 三生石上(FineUI控件)
MyScale Blog
MyScale Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 司徒正美
L
LangChain Blog
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
Y
Y Combinator 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(ollama): bound model-discovery JSON response reads (#...
Alix-007 · 2026-06-24 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

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

55

buildOllamaProvider,

66

buildOllamaModelDefinition,

77

enrichOllamaModelsWithContext,

8+

fetchOllamaModels,

89

parseOllamaNumCtxParameter,

10+

queryOllamaModelShowInfo,

911

resetOllamaModelShowInfoCacheForTest,

1012

resolveOllamaApiBase,

1113

type OllamaTagModel,

@@ -380,4 +382,57 @@ describe("ollama provider models", () => {

380382

expect(parseOllamaNumCtxParameter('stop "<|eot_id|>"')).toBeUndefined();

381383

expect(parseOllamaNumCtxParameter({ num_ctx: 8192 })).toBeUndefined();

382384

});

385+
386+

it("fails soft and stops reading when discovery streams exceed the JSON byte cap", async () => {

387+

// Larger than the shared 16 MiB readProviderJsonResponse cap so the bounded reader cancels

388+

// the stream mid-flight; if the cap were removed the reader would buffer the whole payload.

389+

const ONE_MIB = 1024 * 1024;

390+

const TOTAL_CHUNKS = 32; // 32 MiB advertised body, double the cap.

391+

const chunk = new Uint8Array(ONE_MIB);

392+
393+

let bytesPulled = 0;

394+

let canceled = false;

395+

const makeOversizedJsonResponse = (): Response => {

396+

bytesPulled = 0;

397+

canceled = false;

398+

let pulled = 0;

399+

const body = new ReadableStream<Uint8Array>({

400+

pull(controller) {

401+

if (pulled >= TOTAL_CHUNKS) {

402+

controller.close();

403+

return;

404+

}

405+

pulled += 1;

406+

bytesPulled += chunk.length;

407+

controller.enqueue(chunk);

408+

},

409+

cancel() {

410+

canceled = true;

411+

},

412+

});

413+

return new Response(body, {

414+

status: 200,

415+

headers: { "Content-Type": "application/json" },

416+

});

417+

};

418+
419+

vi.stubGlobal(

420+

"fetch",

421+

vi.fn(async () => makeOversizedJsonResponse()),

422+

);

423+

const tags = await fetchOllamaModels("http://127.0.0.1:11434");

424+

expect(tags).toEqual({ reachable: false, models: [] });

425+

expect(canceled).toBe(true);

426+

// Only the bounded prefix is pulled, never the full advertised 32 MiB stream.

427+

expect(bytesPulled).toBeLessThan(TOTAL_CHUNKS * ONE_MIB);

428+
429+

vi.stubGlobal(

430+

"fetch",

431+

vi.fn(async () => makeOversizedJsonResponse()),

432+

);

433+

const showInfo = await queryOllamaModelShowInfo("http://127.0.0.1:11434", "evil-model:latest");

434+

expect(showInfo).toEqual({});

435+

expect(canceled).toBe(true);

436+

expect(bytesPulled).toBeLessThan(TOTAL_CHUNKS * ONE_MIB);

437+

});

383438

});