mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
fix(antigravity): retry transient upstream failures
Retry short-lived 5xx/capacity errors (500/502/503/504 + message patterns) with bounded backoff capped at 15s; honor Retry-After/reset hints and skip when wait is too long. Keep 400 non-retryable. Enable the retry hook for 500 alongside existing 429/503. Deduplicate sanitized Antigravity tool names before emitting the single functionDeclarations group to avoid upstream "Tool names must be unique" rejections. Add Headroom size diagnostics and phantom-savings warning when reported token delta does not shrink the outbound payload. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
decolua
co-authored by
Cursor
parent
2deacf69b1
commit
639f1204d0
@@ -85,6 +85,16 @@ describe("BaseExecutor.execute — network error retry/fallback", () => {
|
||||
});
|
||||
|
||||
describe("BaseExecutor.execute — computeRetryDelay hook veto", () => {
|
||||
it("only invokes computeRetryDelay when status has retry config", async () => {
|
||||
const ex = makeExec({ baseUrl: "https://x/api", retry: { 503: { attempts: 1, delayMs: 0 } } });
|
||||
ex.computeRetryDelay = vi.fn().mockResolvedValue(0);
|
||||
fetchMock.mockResolvedValueOnce(res(500));
|
||||
const out = await ex.execute({ model: "m", body: {}, stream: false, credentials: creds });
|
||||
expect(out.response.status).toBe(500);
|
||||
expect(ex.computeRetryDelay).not.toHaveBeenCalled();
|
||||
expect(fetchMock).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("hook returning false skips retry (uses fallback path)", async () => {
|
||||
const ex = makeExec({ baseUrl: "https://x/api", retry: { 429: { attempts: 5, delayMs: 0 } } });
|
||||
ex.computeRetryDelay = vi.fn().mockResolvedValue(false);
|
||||
|
||||
Reference in New Issue
Block a user