From b7ac403c81994952c61105204dc176cd424f488b Mon Sep 17 00:00:00 2001 From: Diego Rodrigues de Sa e Souza <8016841+diegosouzapw@users.noreply.github.com> Date: Sat, 13 Jun 2026 20:49:54 -0300 Subject: [PATCH] fix(intelligence): run Arena ELO sync from the live startup path (#3803) Initializes initArenaEloSync() from instrumentation-node.ts (the Next standalone startup hook) instead of the never-executed server-init.ts, so the Free Provider Rankings page (#3799) actually gets data. On by default; opt out with ARENA_ELO_SYNC_ENABLED=false. --- CHANGELOG.md | 2 +- src/instrumentation-node.ts | 18 +++++++++++++++--- tests/integration/integration-wiring.test.ts | 8 ++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 166ce8c171..40e1deeba6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,7 +53,7 @@ ### 📝 Maintenance -- **feat(intelligence): enable Arena ELO sync by default** — the Arena AI leaderboard ELO sync (`ARENA_ELO_SYNC_ENABLED`) that powers the new Free Provider Rankings page ([#3799](https://github.com/diegosouzapw/OmniRoute/pull/3799)) is now **on by default** (was opt-in). It fetches from `api.wulong.dev` on startup (non-blocking, never fatal) and refreshes daily; set `ARENA_ELO_SYNC_ENABLED=false` to opt out of the outbound sync. Without it the rankings page renders empty. (thanks @diegosouzapw) +- **feat(intelligence): enable Arena ELO sync by default + wire it into the live startup path** — the Arena AI leaderboard ELO sync (`ARENA_ELO_SYNC_ENABLED`) that powers the new Free Provider Rankings page ([#3799](https://github.com/diegosouzapw/OmniRoute/pull/3799)) is now **on by default** (was opt-in). It was also only initialized from `server-init.ts`, which the Next standalone runtime never executes (it boots through `instrumentation-node.ts`), so the sync never actually ran in production — it's now initialized from the live instrumentation path. Fetches from `api.wulong.dev` on startup (non-blocking, never fatal) and refreshes daily; set `ARENA_ELO_SYNC_ENABLED=false` to opt out of the outbound sync. (thanks @diegosouzapw) - **chore(quality): Quality Gates → 100%** — completes Fase 6A (systemic hardening: a `stale-allowlist` helper applied across ~10 gates, `docs/architecture/QUALITY_GATES.md`, and ratchet engine v2 with `--require-tighten` + per-metric `eps`) and the entire Fase 7 (20 security/dead-code/mutation/tooling gates), with the Fase 8 plan documented. ([#3757](https://github.com/diegosouzapw/OmniRoute/pull/3757)) - **docs: close the remaining documentation gaps** for proxy operations, skills internals, the memory engine, RTK customization, and compression extensibility (post-#3438 audit, 5 areas in one PR). ([#3453](https://github.com/diegosouzapw/OmniRoute/pull/3453) — thanks @oyi77) - **chore(quality): re-baseline `providerRegistry.ts` file-size** (4692→4703) after #3768's Ollama Cloud `kimi-k2.7-code` capability fix grew the file past the frozen baseline, turning the release's own Fast Quality Gates red. No source file is touched. ([#3770](https://github.com/diegosouzapw/OmniRoute/pull/3770)) diff --git a/src/instrumentation-node.ts b/src/instrumentation-node.ts index 0af866d350..5da9772e10 100755 --- a/src/instrumentation-node.ts +++ b/src/instrumentation-node.ts @@ -258,13 +258,25 @@ export async function registerNodejs(): Promise { } try { - const { autoRefreshDaemon } = await import( - "@omniroute/open-sse/services/autoRefreshDaemon" - ); + const { autoRefreshDaemon } = await import("@omniroute/open-sse/services/autoRefreshDaemon"); autoRefreshDaemon.start(); } catch (err: unknown) { const msg = err instanceof Error ? err.message : String(err); console.warn("[STARTUP] Auto-refresh daemon failed to start (non-fatal):", msg); } + + // Arena ELO sync: model intelligence from the Arena AI leaderboard, powering the + // Free Provider Rankings page. On by default (opt out with ARENA_ELO_SYNC_ENABLED=false). + // Non-blocking — the initial sync is fire-and-forget and never fatal. + if (process.env.ARENA_ELO_SYNC_ENABLED !== "false") { + try { + const { initArenaEloSync } = await import("@/lib/arenaEloSync"); + await initArenaEloSync(); + console.log("[STARTUP] Arena ELO sync initialized"); + } catch (err: unknown) { + const msg = err instanceof Error ? err.message : String(err); + console.warn("[STARTUP] Arena ELO sync failed to start (non-fatal):", msg); + } + } } } diff --git a/tests/integration/integration-wiring.test.ts b/tests/integration/integration-wiring.test.ts index 6597b16616..ca0300e259 100644 --- a/tests/integration/integration-wiring.test.ts +++ b/tests/integration/integration-wiring.test.ts @@ -84,6 +84,14 @@ describe("Pipeline Wiring — instrumentation-node.ts", () => { assert.ok(src, "src/instrumentation-node.ts should exist"); assert.match(src, /seedDefaultModelAliases/); }); + + it("should initialize Arena ELO sync on the live startup path (on by default, opt-out)", () => { + // The Next standalone runtime boots through instrumentation-node, NOT server-init.ts. + // The Arena ELO sync (which feeds the Free Provider Rankings page) must be wired here, + // or it never runs in production regardless of ARENA_ELO_SYNC_ENABLED. + assert.match(src, /initArenaEloSync/); + assert.match(src, /ARENA_ELO_SYNC_ENABLED !== "false"/); + }); }); describe("Pipeline Wiring — sse chat handler", () => {