Skip to content

codex-auto-review is incorrectly routed to defaultProvider, breaking escalated command approvals #637

Closed as not planned

Description

@str0203

Summary

When Codex requests its hidden internal approval model codex-auto-review, OpenCodex does not recognize it as an OpenAI/Codex model. If defaultProvider is set to a non-OpenAI provider, the router falls through and forwards the model ID unchanged to that provider.

This breaks every operation that requires escalated approval. The approval review fails before the requested command is spawned.

Environment

  • OpenCodex: 2.7.42
  • Codex runtime: 0.146.0-alpha.3.1
  • Platform: macOS
  • Canonical openai forward provider: enabled
  • defaultProvider: a non-OpenAI provider (reproduced with DeepSeek)
  • Codex openai_base_url: OpenCodex local proxy

No credentials or account identifiers are included in this report.

Minimal configuration shape

{
  "providers": {
    "openai": {
      "adapter": "openai-responses",
      "authMode": "forward",
      "codexAccountMode": "pool"
    },
    "deepseek": {
      "adapter": "openai-chat",
      "defaultModel": "deepseek-v4-flash"
    }
  },
  "defaultProvider": "deepseek"
}

Steps to reproduce

  1. Configure the canonical openai forward provider and a non-OpenAI provider.
  2. Set the non-OpenAI provider as defaultProvider.
  3. Route Codex through the OpenCodex proxy.
  4. Trigger an operation that requires automatic approval review, for example an escalated command that writes Git metadata.
  5. Codex sends a request whose model is codex-auto-review.

Actual behavior

OpenCodex routes the request to defaultProvider and preserves the model name:

provider=deepseek
requestedModel=codex-auto-review
model=codex-auto-review
status=400

The upstream provider rejects the unknown model. In this reproduction the sanitized error was:

The supported API model names are deepseek-v4-pro or deepseek-v4-flash,
but you passed codex-auto-review.

The automatic approval review then fails, so the original command is rejected before execution.

Root cause

In src/router.ts, isBareOpenAiFamilyModel() only recognizes bare IDs beginning with gpt-, o1-, o3-, or o4-.

codex-auto-review:

  • has no explicit provider namespace;
  • is not recognized as an OpenAI-family model;
  • normally does not match a configured provider model/default;
  • therefore reaches the generic defaultProvider fallback.

This makes an internal Codex control-plane model depend on the user's ordinary default model provider.

Expected behavior

codex-auto-review should never be routed through the generic defaultProvider fallback.

When the canonical OpenAI/Codex forward provider is enabled, it should be routed there. If that provider is unavailable, OpenCodex should fail closed with a clear routing error instead of forwarding the internal model ID to an unrelated provider.

Suggested fix

Add an explicit internal-model route before the generic provider/default fallback, for example with an exact allowlist:

const CODEX_INTERNAL_OPENAI_MODELS = new Set(["codex-auto-review"]);

Then resolve those IDs through the canonical OpenAI/Codex provider, using the same disabled/missing-provider behavior as bare OpenAI-family models.

An exact allowlist is preferable to a broad codex-* prefix because third-party providers may legitimately expose similarly named models.

Suggested regression tests

  1. defaultProvider=deepseek + enabled canonical openai: codex-auto-review routes to openai.
  2. Canonical openai missing or disabled: routing fails closed with NoEnabledOpenAiProviderError.
  3. Unknown non-internal model IDs still use the configured defaultProvider.
  4. Normal DeepSeek model routing remains unchanged.

Impact

This is not limited to Git. Any command requiring automatic approval review can become impossible to execute, even after the user explicitly approves it, because the reviewer request itself fails before the approval decision is produced.

Activity

  1. github-actions commented on Jul 28, 2026

    @github-actions
    Contributor

    Issue closed: use an issue template

    Thanks for taking the time to submit this issue. It was closed automatically because it was not opened with a recognized issue template (Bug report, Feature request, Documentation, or Provider compatibility). Freeform and API-opened issues cannot skip this check.

    • This looks like a bug report but it does not use the Bug report template headings (for example Description/Log entry instead of Summary).

    Please edit the issue to add:

    • Use the Bug report template, or edit this issue to include: Client or integration, Summary, Reproduction, Version, and Operating system.
    • Retitling with [Bug]: and applying the bug label alone is not enough without those section headings filled in.

    See the Contributing guide for details.

    Once the report passes the automated checks, it will be reopened automatically unless a maintainer has changed its state.

  2. github-actions commented on Jul 28, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: English.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions