Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

1.1 KB
Raw Blame
import test from "node:test";
import assert from "node:assert/strict";

const { buildRecoveryHint } = await import("../../open-sse/services/combo/pinRecovery.ts");

test(
  "#9303: buildRecoveryHint('all_targets_skipped') must return an actionable " +
    "hint, not the generic 'transient, just retry' default",
  () => {
    const hint = buildRecoveryHint("all_targets_skipped");

    assert.notEqual(
      hint.action,
      "retry",
      "the pre-dispatch full-exhaustion terminal reason must not be classified as a " +
        "generically 'retry'-able transient failure — the reporter's log shows the " +
        "identical exhaustion recurring across ~9 consecutive requests with no recovery"
    );
    assert.doesNotMatch(
      hint.next_step,
      /failed transiently/i,
      "must not tell the client this was transient when the whole target pool was " +
        "pre-filtered/quota-exhausted before a single dispatch attempt was made"
    );
    assert.match(
      hint.next_step,
      /quota|availability|provider/s,
      "the hint must point at the provider quota/availability as the actionable next step"
    );
  }
);