Skip to content

Azure custom provider: model refresh logs "missing field models" on every exec, and features.remote_models=false does not suppress it #22205

Open

Description

@voytas75

Version

codex-cli 0.130.0

Config

Using an Azure custom provider in ~/.codex/config.toml:

model = "gpt-5.4"
model_provider = "azure"

[model_providers.azure]
name = "Azure"
base_url = "https://<redacted>.openai.azure.com/openai"
env_key = "AZURE_OPENAI_API_KEY"
wire_api = "responses"
query_params = { "api-version" = "2025-04-01-preview" }

Repro

SCRATCH=$(mktemp -d)
cd "$SCRATCH"
git init -q
printf 'test\n' > README.md

codex exec --sandbox read-only -p gpt-54-medium --ephemeral "Reply with exactly: SMOKE_OK" --skip-git-repo-check

Also reproducible with:

codex --config features.remote_models=false exec --sandbox read-only -p gpt-54-medium --ephemeral "Reply with exactly: SMOKE_OK" --skip-git-repo-check

Actual behavior

Every run logs this error before the command completes successfully:

ERROR codex_models_manager::manager: failed to refresh available models: stream disconnected before completion: failed to decode models response: missing field `models`; body: {
  "data": [
    ...
  ],
  "object": "list"
}

The run itself succeeds and returns the expected result:

SMOKE_OK

Expected behavior

One of these should happen:

  1. Azure model refresh should accept the OpenAI-style /models response shape:

    { "data": [...], "object": "list" }
  2. If remote model fetching is unsupported for this Azure path, Codex should skip this refresh cleanly instead of logging an error every run.

  3. features.remote_models=false should suppress this refresh path if that is the intended control.

Notes

This looks related to Azure / remote model fetching behavior in #9536.

The confusing part as a user is:

  • codex exec works
  • but model refresh logs a hard error every run
  • and features.remote_models=false does not prevent it

Activity

  1. changed the title [-]Azure custom provider: model refresh logs 'missing field ' on every exec, and features.remote_models=false does not suppress it[/-] [+]Azure custom provider: model refresh logs "missing field `models`" on every exec, and features.remote_models=false does not suppress it[/+] on May 11, 2026
  2. added
    bug
    CLI
    azure
    custom-model
    exec
    config
    on May 11, 2026
  3. removed
    CLI
    config
    on May 11, 2026
  4. r266-tech commented on Jul 16, 2026

    @r266-tech

    Additional log evidence from 2026-07-16: eight scheduled-run logs contained 28 instances of the same missing field models refresh-error signature. The abbreviated response body had the top-level shape {"data":[...],"object":"list","success":true}. In one sampled run, the error preceded thread.started, after which prompt processing continued. The log producer's Codex version was not recorded, so this does not establish a current-version runtime reproduction.

    Separately, static inspection of current main at f64233d shows a parser shape consistent with that error: codex-rs/codex-api/src/endpoint/models.rs deserializes directly into ModelsResponse, while the derived Deserialize definition in codex-rs/protocol/src/openai_models.rs shows only models: Vec<ModelInfo> and no wrapper aliases. This is not a controlled reproduction from a current-main build; any parser change would still need to validate that data entries match Codex's catalog schema.

  5. linear commented on Aug 28, 2026

    @linear

    from conormeng:

    We’re seeing the same catalog-refresh error with another custom provider on Codex CLI 0.150.0-alpha.8.

    August 27 logs contain 30 distinct occurrences after deduplicating overlapping snapshots. GET /models returns HTTP 200 with {"data":[…],"object":"list"}, followed by:

    failed to refresh available models: stream disconnected before completion:
    failed to decode models response: missing field `models`
    

    This happens during background refresh, model listing, and thread resume. We haven’t established that these errors interrupt inference or cause missing final answers.

    Is this the right issue to track the broader custom-provider compatibility problem? It would also help to distinguish catalog parsing failures from actual stream disconnections in the error message.

    Detailed logs are available internally for engineering follow-up.

  6. jacobhausler commented on Aug 29, 2026

    @jacobhausler

    Confirmed on Codex CLI 0.150.1 with a non-Azure custom OpenAI-compatible provider.

    GET /v1/models returned HTTP 200 with the standard top-level shape:

    {"object":"list","data":[{"id":"example-model","object":"model","owned_by":"example"}]}

    Codex then logged the same error:

    failed to decode models response: missing field `models`
    

    The inference workload continued successfully, so this remains non-fatal in this reproduction. The signature has recurred across separate runs rather than being a one-off transport failure.

    The official API reference specifies object: "list" plus a data array for the list-models response: https://developers.openai.com/api/reference/resources/models/methods/list

    This appears to broaden the issue from Azure to OpenAI-compatible providers generally. A narrow regression test in the models endpoint decoder would deserialize the documented data shape into the existing internal collection while preserving any currently accepted models fixture shape. I would avoid requiring providers to add a non-standard duplicate models field as the primary workaround.

  7. senaiverse commented on Sep 14, 2026

    @senaiverse

    Sharing what worked for me in case anyone else is trying to use Codex Remote Control with Azure OpenAI.

    My setup:

    • Codex CLI "0.154.0"
    • Ubuntu on WSL2
    • Azure OpenAI as the model provider
    • Android phone for Remote Control

    What happened

    Remote Control itself would start on WSL2, but pairing my Android phone kept timing out.

    What finally worked was simple: I temporarily made Codex require a normal ChatGPT/OpenAI login, paired my phone while that login was active, then switched Codex back to my Azure setup afterward.

    The pairing stayed saved.

    I then fully stopped Remote Control, closed the Android app, started Remote Control again from WSL2, and reopened the app.

    The machine went from offline to online automatically, my previous session/history loaded again, and I did not have to pair the phone a second time.

    Azure was still my model provider.

    Exact steps

    In my Codex config, I temporarily changed:

    require_openai_auth = false

    to:

    require_openai_auth = true

    Then I:

    1. Logged Codex into my ChatGPT/OpenAI account.
    2. Started Remote Control.
    3. Paired my Android phone.
    4. Confirmed that Remote Control was working.
    5. Changed the setting back to:

    require_openai_auth = false

    1. Restarted Remote Control.

    After that, Remote Control continued working with Azure OpenAI as my model provider.

    I also verified that this survives a full restart, so it wasn't just an existing in-memory connection.

    One important distinction: this doesn't fix the separate Azure "/models" response-format issue discussed in this thread. It only solved the Remote Control pairing/enrollment problem in my setup.

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

    azurebugcustom-modelexec

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions