ci: harden live release validation lane · openclaw/openclaw@5757d1b
steipete
·
2026-04-27
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6,6 +6,17 @@ const KIMI_SEARCH_KEY =
|
6 | 6 | process.env.KIMI_API_KEY?.trim() || process.env.MOONSHOT_API_KEY?.trim() || ""; |
7 | 7 | const describeLive = isLiveTestEnabled() && KIMI_SEARCH_KEY.length > 0 ? describe : describe.skip; |
8 | 8 | |
| 9 | +function isTransientKimiSearchError(error: unknown): boolean { |
| 10 | +if (!(error instanceof Error)) { |
| 11 | +return false; |
| 12 | +} |
| 13 | +if (error.name === "AbortError") { |
| 14 | +return true; |
| 15 | +} |
| 16 | +const message = error.message.toLowerCase(); |
| 17 | +return message.includes("timeout") || message.includes("aborted"); |
| 18 | +} |
| 19 | + |
9 | 20 | describeLive("moonshot plugin live", () => { |
10 | 21 | it("runs Kimi web search through the provider tool", async () => { |
11 | 22 | const provider = createKimiWebSearchProvider(); |
@@ -14,7 +25,23 @@ describeLive("moonshot plugin live", () => {
|
14 | 25 | searchConfig: { kimi: { apiKey: KIMI_SEARCH_KEY }, cacheTtlMinutes: 0, timeoutSeconds: 90 }, |
15 | 26 | } as never); |
16 | 27 | |
17 | | -const result = await tool?.execute({ query: "OpenClaw GitHub", count: 1 }); |
| 28 | +let result: Awaited<ReturnType<NonNullable<typeof tool>["execute"]>> | undefined; |
| 29 | +let lastError: unknown; |
| 30 | +for (let attempt = 0; attempt < 2; attempt += 1) { |
| 31 | +try { |
| 32 | +result = await tool?.execute({ query: "OpenClaw GitHub", count: 1 }); |
| 33 | +lastError = undefined; |
| 34 | +break; |
| 35 | +} catch (error) { |
| 36 | +lastError = error; |
| 37 | +if (!isTransientKimiSearchError(error) || attempt === 1) { |
| 38 | +throw error; |
| 39 | +} |
| 40 | +} |
| 41 | +} |
| 42 | +if (lastError) { |
| 43 | +throw lastError; |
| 44 | +} |
18 | 45 | |
19 | 46 | expect(result?.provider).toBe("kimi"); |
20 | 47 | expect(typeof result?.content).toBe("string"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。