Skip to content

[Feature] Opt-in blocked model redirection at shared routing layer #2853

Description

@terrytan95

Area

Proxy and routing

What are you trying to accomplish?

Provide an opt-in / configurable safeguard (blockedModelRedirects) at the shared routing layer to prevent accidental consumption or background helper leakage when an operator explicitly disables a specific model (such as gpt-5.6-terra).

When configured, requests targeting a blocked model are automatically redirected to an operator-specified substitute model (e.g. gpt-5.6-terragpt-5.6-luna) across all entry paths (Responses, Chat completions, compaction, search, subagent fallback, combo/concrete routes, and account namespaces) with a distinct routeReason: "blocked-model-redirect".

Image

What prevents this today?

  1. disabledModels only hides models from catalog discovery and GUI/CLI pickers, but does not prevent clients from directly submitting that model ID.
  2. shadowCallIntercept is focused on helper-call replacements in the Responses handler, leaving Chat, compaction, and combo/concrete route paths unintercepted.
  3. Currently, there is no shared-layer configurable mechanism to safely redirect requests for intentionally disabled/blocked models to an approved replacement.

What should OpenCodex do?

  1. Support an optional blockedModelRedirects mapping in OcxConfig (e.g. blockedModelRedirects: { "gpt-5.6-terra": "gpt-5.6-luna" }).
  2. When configured, the shared routing layer (routeResult in src/router.ts) redirects incoming requests targeting any matching model to its replacement, assigning routeReason: "blocked-model-redirect" while preserving account namespaces and decision trace transparency.
  3. When blockedModelRedirects is omitted or unset (default), all models (including gpt-5.6-terra) route normally as first-class native models without any interception.

Example usage or interface

// config.json
{
  "blockedModelRedirects": {
    "gpt-5.6-terra": "gpt-5.6-luna"
  }
}
// When blockedModelRedirects is configured:
routeModel(config, "gpt-5.6-terra");
// -> { providerName: "openai", modelId: "gpt-5.6-luna", routeKind: "native", routeReason: "blocked-model-redirect" }

routeModel(config, "side/gpt-5.6-terra");
// -> { providerName: "openai", modelId: "gpt-5.6-luna", routeKind: "explicit-account", routeReason: "blocked-model-redirect", codexAccountId: "...", codexAccountNamespace: "side" }

// When blockedModelRedirects is unset (default):
routeModel(config, "gpt-5.6-terra");
// -> { providerName: "openai", modelId: "gpt-5.6-terra", routeKind: "native", routeReason: "native-family" }

Alternatives or workarounds

  • Relying only on disabledModels (leaves direct client submissions and helper paths unprotected).
  • Hardcoding a global unconditional rewrite (undesirable, as it breaks normal use for operators who want to use Terra).

Additional context

Opt-in redirection at the shared routing layer (src/router.ts + src/lib/shadow-call.ts) provides a clean, predictable safeguard without mutating global catalog definitions or breaking existing native model contracts.

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    account-poolOAuth, credentials, Codex pool, quota, failover, plansenhancementNew feature or requestlanded-via-maintainerOriginal PR closed after landing via a maintainer merge trainproxyHTTP proxy, routing, reverse-proxy / management auth

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions