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
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
fix: OAuth batch test crash + Test All button on provider pages (v2.8.8)
diegosouzapw4003c38fd12d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 7992aa32c6..99b402dc8e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,6 +4,20 @@---+## [2.8.8] — 2026-03-20++> Sprint: Fix OAuth batch test crash, add "Test All" button to individual provider pages.++### Bug Fixes++- **OAuth batch test crash** (ERR_CONNECTION_REFUSED): Replaced sequential for-loop with 5-connection concurrency limit + 30s per-connection timeout via `Promise.race()` + `Promise.allSettled()`. Prevents server crash when testing large OAuth provider groups (~30+ connections).++### Features++- **"Test All" button on provider pages**: Individual provider pages (e.g., `/providers/codex`) now show a "Test All" button in the Connections header when there are 2+ connections. Uses `POST /api/providers/test-batch` with `{mode: "provider", providerId}`. Results displayed in a modal with pass/fail summary and per-connection diagnosis.++---+## [2.8.7] — 2026-03-20> Sprint: Merge PR #495 (Bottleneck 429 drop), fix #496 (custom embedding providers), triage features.diff --git a/docs/openapi.yaml b/docs/openapi.yamlindex 2790b17a25..14e28dbf5a 100644--- a/docs/openapi.yaml+++ b/docs/openapi.yaml@@ -1,7 +1,7 @@openapi: 3.1.0info:title: OmniRoute API- version: 2.8.7+ version: 2.8.8description: |OmniRoute is a local-first AI API proxy router. It provides an OpenAI-compatibleendpoint that routes requests to multiple AI providers with load balancing,diff --git a/package-lock.json b/package-lock.jsonindex eb665feefb..e39b528dc8 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,12 +1,12 @@{"name": "omniroute",- "version": "2.8.7",+ "version": "2.8.8","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "omniroute",- "version": "2.8.7",+ "version": "2.8.8","hasInstallScript": true,"license": "MIT","workspaces": [diff --git a/package.json b/package.jsonindex 2f809f0d16..81864bbd65 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "omniroute",- "version": "2.8.7",+ "version": "2.8.8","description": "Smart AI Router with auto fallback — route to FREE & cheap models, zero downtime. Works with Cursor, Cline, Claude Desktop, Codex, and any OpenAI-compatible tool.","type": "module","bin": {diff --git a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx b/src/app/(dashboard)/dashboard/providers/[id]/page.tsxindex 4d8fcf55e9..6493aed334 100644--- a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx+++ b/src/app/(dashboard)/dashboard/providers/[id]/page.tsx@@ -128,6 +128,8 @@ export default function ProviderDetailPage() {const [showEditNodeModal, setShowEditNodeModal] = useState(false);const [selectedConnection, setSelectedConnection] = useState(null);const [retestingId, setRetestingId] = useState(null);+ const [batchTesting, setBatchTesting] = useState(false);+ const [batchTestResults, setBatchTestResults] = useState<any>(null);const [modelAliases, setModelAliases] = useState({});const [headerImgError, setHeaderImgError] = useState(false);const { copied, copy } = useCopyToClipboard();@@ -506,6 +508,52 @@ export default function ProviderDetailPage() {}};+ // Batch test all connections for this provider+ const handleBatchTestAll = async () => {+ if (batchTesting || connections.length === 0) return;+ setBatchTesting(true);+ setBatchTestResults(null);+ const controller = new AbortController();+ const timeoutId = setTimeout(() => controller.abort(), 120_000); // 2min max+ try {+ const res = await fetch("/api/providers/test-batch", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ mode: "provider", providerId }),+ signal: controller.signal,+ });+ let data: any;+ try {+ data = await res.json();+ } catch {+ data = { error: t("providerTestFailed"), results: [], summary: null };+ }+ setBatchTestResults({+ ...data,+ error: data.error+ ? typeof data.error === "object"+ ? data.error.message || data.error.error || JSON.stringify(data.error)+ : String(data.error)+ : null,+ });+ if (data?.summary) {+ const { passed, failed, total } = data.summary;+ if (failed === 0) notify.success(t("allTestsPassed", { total }));+ else notify.warning(t("testSummary", { passed, failed, total }));+ }+ // Refresh connections to update statuses+ await fetchConnections();+ } catch (error: any) {+ const isAbort = error?.name === "AbortError";+ const msg = isAbort ? t("providerTestTimeout") : t("providerTestFailed");+ setBatchTestResults({ error: msg, results: [], summary: null });+ notify.error(msg);+ } finally {+ clearTimeout(timeoutId);+ setBatchTesting(false);+ }+ };+// T12: Manual token refreshconst [refreshingId, setRefreshingId] = useState<string | null>(null);const handleRefreshToken = async (connectionId: string) => {@@ -1160,6 +1208,24 @@ export default function ProviderDetailPage() {: t("providerProxy")}</button></div>+ {connections.length > 1 && (+ <button+ onClick={handleBatchTestAll}+ disabled={batchTesting || !!retestingId}+ className={`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors ${+ batchTesting+ ? "bg-primary/20 border-primary/40 text-primary animate-pulse"+ : "bg-bg-subtle border-border text-text-muted hover:text-text-primary hover:border-primary/40"+ }`}+ title={t("testAll")}+ aria-label={t("testAll")}+ >+ <span className="material-symbols-outlined text-[14px]">+ {batchTesting ? "sync" : "play_arrow"}+ </span>+ {batchTesting ? t("testing") : t("testAll")}+ </button>+ )}{!isCompatible ? (<Buttonsize="sm"@@ -1356,6 +1422,96 @@ export default function ProviderDetailPage() {isAnthropic={isAnthropicCompatible}/>)}+ {/* Batch Test Results Modal */}+ {batchTestResults && (+ <div+ className="fixed inset-0 z-50 flex items-start justify-center pt-[10vh]"+ onClick={() => setBatchTestResults(null)}+ >+ <div className="absolute inset-0 bg-black/60 backdrop-blur-sm" />+ <div+ className="relative bg-bg-primary border border-border rounded-xl w-full max-w-[600px] max-h-[80vh] overflow-y-auto shadow-2xl"+ onClick={(e) => e.stopPropagation()}+ >+ <div className="sticky top-0 z-10 flex items-center justify-between px-5 py-3 border-b border-border bg-bg-primary/95 backdrop-blur-sm rounded-t-xl">+ <h3 className="font-semibold">{t("testResults")}</h3>+ <button+ onClick={() => setBatchTestResults(null)}+ className="p-1 rounded-lg hover:bg-bg-subtle text-text-muted hover:text-text-primary transition-colors"+ aria-label="Close"+ >+ <span className="material-symbols-outlined text-lg">close</span>+ </button>+ </div>+ <div className="p-5">+ {batchTestResults.error &&+ (!batchTestResults.results || batchTestResults.results.length === 0) ? (+ <div className="text-center py-6">+ <span className="material-symbols-outlined text-red-500 text-[32px] mb-2 block">+ error+ </span>+ <p className="text-sm text-red-400">{String(batchTestResults.error)}</p>+ </div>+ ) : (+ <div className="flex flex-col gap-3">+ {batchTestResults.summary && (+ <div className="flex items-center gap-3 text-xs mb-1">+ <span className="text-text-muted">{providerInfo?.name || providerId}</span>+ <span className="px-2 py-0.5 rounded bg-emerald-500/15 text-emerald-400 font-medium">+ {t("passedCount", { count: batchTestResults.summary.passed })}+ </span>+ {batchTestResults.summary.failed > 0 && (+ <span className="px-2 py-0.5 rounded bg-red-500/15 text-red-400 font-medium">+ {t("failedCount", { count: batchTestResults.summary.failed })}+ </span>+ )}+ <span className="text-text-muted ml-auto">+ {t("testedCount", { count: batchTestResults.summary.total })}+ </span>+ </div>+ )}+ {(batchTestResults.results || []).map((r: any, i: number) => (+ <div+ key={r.connectionId || i}+ className="flex items-center gap-2 text-xs px-3 py-2 rounded-lg bg-black/[0.03] dark:bg-white/[0.03]"+ >+ <span+ className={`material-symbols-outlined text-[16px] ${+ r.valid ? "text-emerald-500" : "text-red-500"+ }`}+ >+ {r.valid ? "check_circle" : "error"}+ </span>+ <div className="flex-1 min-w-0">+ <span className="font-medium">{r.connectionName}</span>+ </div>+ {r.latencyMs !== undefined && (+ <span className="text-text-muted font-mono tabular-nums">+ {t("millisecondsAbbr", { value: r.latencyMs })}+ </span>+ )}+ <span+ className={`text-[10px] uppercase font-bold px-1.5 py-0.5 rounded ${+ r.valid+ ? "bg-emerald-500/15 text-emerald-400"+ : "bg-red-500/15 text-red-400"+ }`}+ >+ {r.valid ? t("okShort") : r.diagnosis?.type || t("errorShort")}+ </span>+ </div>+ ))}+ {(!batchTestResults.results || batchTestResults.results.length === 0) && (+ <div className="text-center py-4 text-text-muted text-sm">+ {t("noActiveConnectionsInGroup")}+ </div>+ )}+ </div>+ )}+ </div>+ </div>+ </div>+ )}{/* Proxy Config Modal */}{proxyTarget && (<ProxyConfigModaldiff --git a/src/app/api/providers/test-batch/route.ts b/src/app/api/providers/test-batch/route.tsindex 9140f3d5bd..982e8c74dc 100644--- a/src/app/api/providers/test-batch/route.ts+++ b/src/app/api/providers/test-batch/route.ts@@ -90,13 +90,23 @@ export async function POST(request) {});}- // Test each connection sequentially via direct function call (no HTTP self-call)- const results = [];+ // Test each connection with timeout and concurrency limits (prevents server crash on large groups)+ const PER_CONNECTION_TIMEOUT = 30_000; // 30s per connection+ const CONCURRENCY = 5; // max parallel tests- for (const conn of connectionsToTest) {+ const testOne = async (conn) => {try {- const data = await testSingleConnection(conn.id);- results.push({+ const result = await Promise.race([+ testSingleConnection(conn.id),+ new Promise((_, reject) =>+ setTimeout(+ () => reject(new Error("Connection test timed out after 30s")),+ PER_CONNECTION_TIMEOUT+ )+ ),+ ]);+ const data = result as any;+ return {provider: conn.provider,connectionId: conn.id,connectionName: conn.name || conn.email || conn.provider,@@ -107,9 +117,9 @@ export async function POST(request) {diagnosis: data.diagnosis || null,statusCode: data.statusCode || null,testedAt: data.testedAt || new Date().toISOString(),- });+ };} catch (error) {- results.push({+ return {provider: conn.provider,connectionId: conn.id,connectionName: conn.name || conn.email || conn.provider,@@ -120,7 +130,37 @@ export async function POST(request) {diagnosis: { type: "network_error", source: "local", code: null, message: error.message },statusCode: null,testedAt: new Date().toISOString(),- });+ };+ }+ };++ // Execute with concurrency limit+ const results = [];+ for (let i = 0; i < connectionsToTest.length; i += CONCURRENCY) {+ const batch = connectionsToTest.slice(i, i + CONCURRENCY);+ const batchResults = await Promise.allSettled(batch.map(testOne));+ for (const r of batchResults) {+ results.push(+ r.status === "fulfilled"+ ? r.value+ : {+ provider: "unknown",+ connectionId: "unknown",+ connectionName: "unknown",+ authType: "unknown",+ valid: false,+ latencyMs: 0,+ error: r.reason?.message || "Test failed",+ diagnosis: {+ type: "network_error",+ source: "local",+ code: null,+ message: r.reason?.message || "Test failed",+ },+ statusCode: null,+ testedAt: new Date().toISOString(),+ }+ );}}