Files
OmniRoute/tests/unit/errorClassifier-noauth-403-6315.test.ts
Tushar Agarwal 1089c24bc8 Remove/mimocode sunset provider (#10186)
* remove: drop sunset MiMoCode provider from model catalog

* remove: drop sunset MiMoCode provider from model catalog (shared.ts)

Remove unused imports, types, and comments from shared.ts.

* remove: MiMoCode provider (Xiaomi sunset) — executor, registry, no-auth config, icon, tests

* refactor(providers): finish MiMoCode removal — sweep remaining no-auth references

Drop the leftover mimocode entries from the no-auth provider controls, the
translate-path snapshot, the eslint suppressions, and the #3061 auth-loop
test. Re-point the fingerprint-pin (#6696) and proxy-noauth (#6272) tests at
opencode, which exercises the same fingerprint path, so the removal does not
break runtime behavior.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

* docs(providers): reconcile provider/executor counts after MiMoCode sunset

The base's parallel doc-count sync (#10433) pinned 340 providers / 101
executors. With mimocode removed, live code has 339 providers and 100
executors; refresh the user-facing counts (package.json description,
llm.txt, README/AGENTS, i18n llm.txt, provider reference, diagrams) so the
check-docs-counts STRICT gate stays green.

Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>

* test(providers): fix orphaned mimocode references after MiMoCode sunset

The sunset removed mimocode/mcode from the free-onboarding candidates and
from FINGERPRINT_PROVIDERS, but two tests still referenced them:

- free-provider-onboarding-setup: the mimocode->theoldllm substitution
  introduced duplicate 'opencode' rows (impossible given the request-set
  dedupe) and the wrong display name; align expectations with the actual
  {opencode, theoldllm} dedupe behavior and 'The Old LLM (Free)' name.
- combo-system-prompt-templates-5501: resolveTargetFingerprint tested with
  provider 'mcode', which is no longer a fingerprint provider; point it at
  the remaining fingerprint provider 'opencode'.

Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>

---------

Co-authored-by: diegosouzapw <diegosouzapw@users.noreply.github.com>
Co-authored-by: Tushar49 <Tushar49@users.noreply.github.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: adevwithpurpose <adevwithpurpose@users.noreply.github.com>
Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>
2026-08-18 10:49:24 -03:00

52 lines
2.1 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import {
classifyProviderError,
PROVIDER_ERROR_TYPES,
} from "../../open-sse/services/errorClassifier.ts";
// #6315 / #6345 — a single generic upstream 403 on a no-credential ("authType:
// none") provider was permanently banning the whole
// connection (classified as FORBIDDEN, a terminal type). These providers are
// free/stateless — there is no real account/credential to revoke, so a bare
// 403 should be RECOVERABLE (null) and handled by the existing connection
// cooldown/retry layer, same as apikey providers already are.
test("#6345: theoldllm 'Request blocked'/access_denied 403 -> recoverable (null), not FORBIDDEN", () => {
const body = { error: "Request blocked", type: "access_denied" };
assert.equal(classifyProviderError(403, body, "theoldllm"), null);
});
test("control: apikey-provider bare 403 still recoverable (null) — no regression", () => {
assert.equal(classifyProviderError(403, "forbidden", "openai"), null);
});
test("#8813: chatgpt-web SENTINEL_BLOCKED 403 with 'Sentinel/Turnstile required' → FORBIDDEN (terminal)", () => {
// The executor returns error code "SENTINEL_BLOCKED" in the JSON body.
// This is a TERMINAL state — retrying the same blocked session will keep 403ing.
// Must be classified as FORBIDDEN so the circuit breaker marks the connection
// as banned and combo routing falls back to other providers.
const body = JSON.stringify({
error: {
message:
"ChatGPT blocked the request (Sentinel/Turnstile required). Try again later or open chatgpt.com in a browser to refresh state.",
type: "upstream_error",
code: "SENTINEL_BLOCKED",
},
});
assert.equal(
classifyProviderError(403, body, "chatgpt-web"),
PROVIDER_ERROR_TYPES.FORBIDDEN
);
});
test("#8813: chatgpt-web SENTINEL_BLOCKED 403 with raw 'Sentinel blocked' text → FORBIDDEN (terminal)", () => {
// Edge case: when the raw text includes "Sentinel" and 403, classify as terminal.
assert.equal(
classifyProviderError(403, "Sentinel blocked the request", "chatgpt-web"),
PROVIDER_ERROR_TYPES.FORBIDDEN
);
});