[Feature]: Codiv (api.codiv.ai) as a JEV-compatible decision provider with pacing, retry and fallback

Abierto
#7,083 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
22/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript
Área
api, backend

Línea de trabajo

Start with the jev-decision call in src/combos/jev.ts (around lines 743-800), then src/lib/provider-outbound.ts, which currently bypasses requestPacing, retryOn429 and the provider headers. src/lib/upstream-retry.ts (around line 435) shows why 529 is not retried. Done means the opt-in pacing, header forwarding and retry apply to decision traffic, and an ordered decisionProviders list falls back in order, with unchanged behaviour when these settings are unset. The issue leaves the design open, so confirm the scope with maintainers first.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement needs-design proxy
Area

Proxy and routing

What are you trying to accomplish?

Codiv exposes a JEV/TypeSafe-compatible System One decision API (POST /v1/systemone, model openjev-0.1). We want to use it through OpenCodex in two ways:

  1. as a decision provider for jev combos, and as a fallback for the TypeSafe jev provider: if TypeSafe errors or times out, Codiv makes the decision;
  2. as a shared, rate-limited path for our own services that call Choice/Noul directly, so that several clients sharing one Codiv key stay under its limit.
What prevents this today?

We checked 2.81.0:

  • jev-decision is only called internally by the jev combo strategy (src/combos/jev.ts ~743-800). There is no client-facing System One route, only /api/combos/decision-test and /api/combos/decision-discovery.
  • jev-decision requests go through providerOutboundPost (src/lib/provider-outbound.ts). That path bypasses requestPacing and retryOn429, and does not forward the provider's configured headers; the User-Agent defaults to opencodex.
  • A combo has one decision provider. There is no ordered fallback chain between decision backends.
  • 529 (overloaded) is not retried (src/lib/upstream-retry.ts ~435).
What should OpenCodex do?

All opt-in, current behaviour unchanged when unset:

  1. Apply requestPacing (requestsPerMinute, maxConcurrentRequests) and retryOn429 with Retry-After support to jev-decision traffic, and allow 529 to be treated as retryable for such providers.
  2. Forward the provider's headers on decision requests. Codiv requires a User-Agent header; without it Cloudflare returns 403/1010.
  3. Allow an ordered list of decision backends, each with its own model, e.g. jev (TypeSafe) followed by codiv (openjev-0.1), with the existing fail-open behaviour after the last one.
  4. Optional: a data-plane passthrough route (e.g. /v1/systemone) authenticated with a data key, so external clients share the same pacing and fallback.
Example usage or interface
"providers": {
  "codiv": {
    "adapter": "jev-decision",
    "baseUrl": "https://api.codiv.ai/v1/systemone",
    "apiKey": "${CODIV_API_KEY}",
    "headers": { "User-Agent": "my-client/1.0" },          // proposal: forwarded
    "requestPacing": { "enabled": true, "requestsPerMinute": 250, "maxConcurrentRequests": 8 },  // proposal: applied
    "retryOn429": { "enabled": true, "maxAttempts": 3, "intervalMs": 5000, "maxIntervalMs": 30000 }
  }
},
"combos": { "jev-auto": {
  "strategy": "jev",
  "decisionProviders": [                                   // proposal
    { "provider": "jev" },
    { "provider": "codiv", "model": "openjev-0.1" }
  ],
  "targets": [ … ]
}}
Alternatives or workarounds
  • Point the single jev provider at Codiv instead of TypeSafe. This loses TypeSafe and still has no pacing or retry.
  • Rate-limit in each client separately. This does not coordinate clients that share one key.
Additional context

Codiv's limit is per key (1200 rpm). With several services on one key we already see 429s at about 300 rpm, which is why central pacing matters.

Related: #6268 (self-hosted JEV-compatible decision endpoints), #6384 (configurable decision endpoints), #6665 (demand-level routing for JEV combos).

Checks
  • I searched existing issues and documentation.
  • This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
  • I removed secrets and personal data.
Lenguaje dominante
TypeScript
Estrellas
16.9k
Forks
1.3k
Merge medio
1 d 4 h
PR fusionados (30 d)
814

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de lidge-jun/opencodex

Todos los issues de lidge-jun/opencodex

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.