Files
OmniRoute/tests/unit/noauth-imported-models-3200.test.ts
Diego Rodrigues de Sa e Souza b6975537c1 fix(providers): remove the chipotle/pepper provider (#13131) (#13913)
* fix(providers): remove the chipotle/pepper provider (#13131)

amelia.chipotle.com (the reverse-engineered Amelia chat-widget backend
chipotle/pepper-1 talked to) now returns 404 on every route, including
root, from its Azure Application Gateway — confirmed live 2026-09-15.
This regressed from a WS handshake timeout (#4037, June 2026) to a
fully decommissioned host, so the upstream protocol cannot be fixed.
Owner decided to retire the provider entirely (Option B), following
the phind/kluster quiet-removal precedent: no REMOVED_PROVIDERS.md
entry (reserved for operator takedowns), just a one-line note under
FREE_TIERS.md "Removed / no free tier".

Removed every surface: executor, registry entry, executors/index.ts
and providers/index.ts wiring, noauth provider catalog entry,
ProviderIcon generic-fallback set, the autoCombo exclusion-list
comment, the chipotle_error code from the sanitizer allowlist,
PROVIDER_REFERENCE.md (regenerated), and every doc/test reference.

Regression test: tests/unit/issue-13131-chipotle-provider-removed.test.ts
asserts the provider is fully gone from the executor registry, the
provider REGISTRY and the noauth catalog, and that the executor module
no longer resolves — not a live-network repro (flaky/third-party).

Several existing tests used "chipotle" only as a generic noAuth-provider
example (proxy scoping, error classification, onboarding, fallback
text) with no chipotle-specific behavior under test; those were
re-pointed at another still-existing noAuth provider
(cloudflare-playground / duckduckgo-web) rather than weakened.

* test(providers): document the agnes-cn/chipotle count coincidence (#13131)

provider-node-reserved-prefix.test.ts's REGISTRY id+alias walk was
already red on the base tip (414 vs. expected 412) from agnes-cn
(#13399, +id/+alias). Removing chipotle's REGISTRY id/alias in this
PR nets it back to 412, making the test pass again without a numeric
edit — record why in a comment so it doesn't read as an untracked
coincidence later.
2026-09-17 13:22:09 -03:00

113 lines
4.6 KiB
TypeScript

// Regression test for #3200 — imported/custom models on noAuth providers were missing
// from GET /api/v1/models (and therefore from the Playground model dropdown), while
// BUILT-IN and CUSTOM models on regular auth providers showed up fine.
//
// Root cause: the custom-models loop in catalog.ts gated every model through
// hasEligibleConnectionForModel(getConnectionsForProvider(...)). noAuth providers
// (e.g. duckduckgo-web / alias "ddgw") have NO DB connection rows, so getConnectionsForProvider
// returns [] and hasEligibleConnectionForModel([]) === false → the model was dropped.
// Built-in models survived because they go through providerSupportsModel(), which has a
// noAuth bypass (#2798). This test asserts an IMPORTED model on a noAuth provider appears.
import test from "node:test";
import assert from "node:assert/strict";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
const TEST_DATA_DIR = fs.mkdtempSync(path.join(os.tmpdir(), "omniroute-noauth-imported-"));
process.env.DATA_DIR = TEST_DATA_DIR;
process.env.API_KEY_SECRET = process.env.API_KEY_SECRET || "catalog-test-secret";
const core = await import("../../src/lib/db/core.ts");
const modelsDb = await import("../../src/lib/db/models.ts");
const apiKeysDb = await import("../../src/lib/db/apiKeys.ts");
const settingsDb = await import("../../src/lib/db/settings.ts");
const v1ModelsCatalog = await import("../../src/app/api/v1/models/catalog.ts");
async function resetStorage() {
core.resetDbInstance();
apiKeysDb.resetApiKeyState();
fs.rmSync(TEST_DATA_DIR, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
fs.mkdirSync(TEST_DATA_DIR, { recursive: true });
}
test.beforeEach(async () => {
await resetStorage();
});
test.after(async () => {
core.resetDbInstance();
apiKeysDb.resetApiKeyState();
fs.rmSync(TEST_DATA_DIR, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
});
test("#3200 imported model on a noAuth provider (duckduckgo-web) appears in /api/v1/models", async () => {
// duckduckgo-web is a noAuth provider (alias "ddgw") — it never creates a DB connection row.
// Import a model that is NOT a built-in duckduckgo-web model, so its presence is solely due
// to the custom/imported path (the path the bug breaks).
await modelsDb.addCustomModel(
"duckduckgo-web",
"my-imported-model-3200",
"My Imported Model",
"imported"
);
const response = await v1ModelsCatalog.getUnifiedModelsResponse(
new Request("http://localhost/api/v1/models")
);
const body = (await response.json()) as { data: Array<{ id: string }> };
const ids = new Set(body.data.map((m) => m.id));
assert.equal(response.status, 200);
assert.ok(
ids.has("ddgw/my-imported-model-3200"),
"imported model on noAuth provider must appear under its alias prefix"
);
});
test("#3200 custom/imported models on auth providers still appear (no regression)", async () => {
// kiro is an auth provider; with a manual custom model added, the alias-prefixed id
// must still be present (the active-connection eligibility path is unchanged).
// No connection seeded here — kiro custom models require an eligible connection, so
// this guards that the fix does NOT make auth-provider custom models appear without one.
await modelsDb.addCustomModel("kiro", "custom-kiro-3200", "Custom Kiro");
const response = await v1ModelsCatalog.getUnifiedModelsResponse(
new Request("http://localhost/api/v1/models")
);
const body = (await response.json()) as { data: Array<{ id: string }> };
const ids = new Set(body.data.map((m) => m.id));
assert.equal(response.status, 200);
// Auth provider with NO active connection → custom model must NOT leak in.
assert.equal(
ids.has("kiro/custom-kiro-3200"),
false,
"auth-provider custom model must stay gated behind an eligible connection"
);
});
test("#3200 imported models on noAuth providers are hidden when the provider is disabled", async () => {
await settingsDb.updateSettings({ blockedProviders: ["duckduckgo-web"] });
await modelsDb.addCustomModel(
"duckduckgo-web",
"my-imported-model-disabled",
"Hidden Imported Model",
"imported"
);
const response = await v1ModelsCatalog.getUnifiedModelsResponse(
new Request("http://localhost/api/v1/models")
);
const body = (await response.json()) as { data: Array<{ id: string }> };
const ids = new Set(body.data.map((m) => m.id));
assert.equal(response.status, 200);
assert.equal(
ids.has("ddgw/my-imported-model-disabled"),
false,
"imported noAuth provider models must stay hidden while the provider is disabled"
);
});