fix: parse sdk retry wait env strictly · openclaw/openclaw@f90e266
steipete
·
2026-05-29
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1111,6 +1111,27 @@ describe("buildGuardedModelFetch", () => {
|
1111 | 1111 | expect(response.headers.get("x-should-retry")).toBeNull(); |
1112 | 1112 | }); |
1113 | 1113 | |
| 1114 | +it.each(["0x10", "1e3"])( |
| 1115 | +"ignores non-decimal OPENCLAW_SDK_RETRY_MAX_WAIT_SECONDS values: %s", |
| 1116 | +async (value) => { |
| 1117 | +process.env.OPENCLAW_SDK_RETRY_MAX_WAIT_SECONDS = value; |
| 1118 | +fetchWithSsrFGuardMock.mockResolvedValue({ |
| 1119 | +response: new Response(null, { |
| 1120 | +status: 429, |
| 1121 | +headers: { "retry-after": "30" }, |
| 1122 | +}), |
| 1123 | +finalUrl: "https://api.anthropic.com/v1/messages", |
| 1124 | +release: vi.fn(async () => undefined), |
| 1125 | +}); |
| 1126 | +const response = await buildGuardedModelFetch(anthropicModel)( |
| 1127 | +"https://api.anthropic.com/v1/messages", |
| 1128 | +{ method: "POST" }, |
| 1129 | +); |
| 1130 | + |
| 1131 | +expect(response.headers.get("x-should-retry")).toBeNull(); |
| 1132 | +}, |
| 1133 | +); |
| 1134 | + |
1114 | 1135 | it("injects x-should-retry:false for terminal 429 responses without retry-after", async () => { |
1115 | 1136 | fetchWithSsrFGuardMock.mockResolvedValue({ |
1116 | 1137 | response: new Response("Sorry, you've exceeded your weekly rate limit.", { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。