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

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
Hugging Face - Blog
Hugging Face - Blog
Recent Announcements
Recent Announcements
MongoDB | Blog
MongoDB | Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
G
Google Developers Blog
L
LangChain Blog
The GitHub Blog
The GitHub Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
GbyAI
GbyAI
MyScale Blog
MyScale Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
U
Unit 42
Martin Fowler
Martin Fowler
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Apple Machine Learning Research
Apple Machine Learning Research
爱范儿
爱范儿
博客园 - 聂微东
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
A
About on SuperTechFans
Stack Overflow Blog
Stack Overflow Blog
V
V2EX

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(github-copilot): bound embedding error bodies · openc...
vincentkoc · 2026-06-19 · via Recent Commits to openclaw:main

@@ -47,6 +47,28 @@ function buildModelsResponse(models: Array<{ id: string; supported_endpoints?: u

4747

return { data: models };

4848

}

494950+

function cancelTrackedResponse(

51+

text: string,

52+

init: ResponseInit,

53+

): {

54+

response: Response;

55+

wasCanceled: () => boolean;

56+

} {

57+

let canceled = false;

58+

const stream = new ReadableStream<Uint8Array>({

59+

start(controller) {

60+

controller.enqueue(new TextEncoder().encode(text));

61+

},

62+

cancel() {

63+

canceled = true;

64+

},

65+

});

66+

return {

67+

response: new Response(stream, init),

68+

wasCanceled: () => canceled,

69+

};

70+

}

71+5072

function mockDiscoveryResponse(spec: {

5173

ok: boolean;

5274

status?: number;

@@ -116,6 +138,7 @@ describe("githubCopilotMemoryEmbeddingProviderAdapter", () => {

116138117139

afterEach(() => {

118140

vi.restoreAllMocks();

141+

vi.unstubAllGlobals();

119142

resolveConfiguredSecretInputStringMock.mockReset();

120143

resolveFirstGithubTokenMock.mockReset();

121144

resolveCopilotApiTokenMock.mockReset();

@@ -221,6 +244,63 @@ describe("githubCopilotMemoryEmbeddingProviderAdapter", () => {

221244

).rejects.toThrow("GitHub Copilot model discovery returned invalid JSON");

222245

});

223246247+

it("bounds model discovery error bodies", async () => {

248+

const tracked = cancelTrackedResponse(`${"discovery denied ".repeat(1024)}tail`, {

249+

status: 503,

250+

headers: { "content-type": "text/plain" },

251+

});

252+

const textSpy = vi.spyOn(tracked.response, "text").mockRejectedValue(new Error("unbounded"));

253+

fetchWithSsrFGuardMock.mockImplementationOnce(async () => ({

254+

response: tracked.response,

255+

release: vi.fn(async () => {}),

256+

}));

257+258+

let caught: Error | undefined;

259+

try {

260+

await githubCopilotMemoryEmbeddingProviderAdapter.create(defaultCreateOptions());

261+

} catch (error) {

262+

caught = error as Error;

263+

}

264+265+

expect(caught?.message).toContain("GitHub Copilot model discovery HTTP 503");

266+

expect(caught?.message).toContain("discovery denied");

267+

expect(caught?.message).not.toContain("tail");

268+

expect(caught?.message.length).toBeLessThan(8_300);

269+

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

270+

expect(textSpy).not.toHaveBeenCalled();

271+

});

272+273+

it("bounds embeddings error bodies", async () => {

274+

mockDiscoveryResponse({

275+

ok: true,

276+

json: buildModelsResponse([

277+

{ id: "text-embedding-3-small", supported_endpoints: ["/v1/embeddings"] },

278+

]),

279+

});

280+

const tracked = cancelTrackedResponse(`${"embedding denied ".repeat(1024)}tail`, {

281+

status: 429,

282+

headers: { "content-type": "text/plain" },

283+

});

284+

const textSpy = vi.spyOn(tracked.response, "text").mockRejectedValue(new Error("unbounded"));

285+

const fetchImpl = vi.fn(async () => tracked.response);

286+

vi.stubGlobal("fetch", fetchImpl);

287+

const result = await githubCopilotMemoryEmbeddingProviderAdapter.create(defaultCreateOptions());

288+289+

let caught: Error | undefined;

290+

try {

291+

await result.provider?.embedQuery("hello");

292+

} catch (error) {

293+

caught = error as Error;

294+

}

295+296+

expect(caught?.message).toContain("GitHub Copilot embeddings HTTP 429");

297+

expect(caught?.message).toContain("embedding denied");

298+

expect(caught?.message).not.toContain("tail");

299+

expect(caught?.message.length).toBeLessThan(8_300);

300+

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

301+

expect(textSpy).not.toHaveBeenCalled();

302+

});

303+224304

it("honors remote overrides when creating the provider", async () => {

225305

resolveConfiguredSecretInputStringMock.mockResolvedValue({ value: "gh_remote_token" });

226306

mockDiscoveryResponse({