Skip to content

[Bug] Discovered native models lose upstream picker priority when subagent models are featured (no hardcoded model lists) #7776

Closed

Description

@lyjj0912

Client or integration

Codex App

Area

Catalog / models

Summary

OpenCodex discovers new native OpenAI models successfully, but the upstream model-picker priority is overwritten with the same large fallback rank assigned to older unfeatured native models whenever subagentModels contains featured models. The new entry is therefore buried in the Codex model picker despite being enabled and present in the live proxy catalog. The same behavior persists with no modelPickerOrder configured.

Expected: Automatically discovered native models retain their upstream ordering relative to other unfeatured models, while explicitly featured/subagent choices remain ahead of them. New model IDs must appear and sort correctly without adding ID-specific constants, hardcoded name lists, manual catalog pins, or a per-release modelPickerOrder update.

Reproduction

Observed on 2026-10-27 KST:

  1. Run OpenCodex 2.92.0 with an enabled native openai provider and four entries in subagentModels.
  2. Make sure no custom picker order is configured: ocx models order reset; verify ocx models order status reports Saved mode: default. Confirm modelPickerOrder and modelPickerOrderMode are absent from the persisted configuration.
  3. Refresh the provider's model catalog with ocx sync.
  4. Inspect the new native model descriptor in ~/.opencodex/discovered-native-models.json. The observed gpt-6.1-terra descriptor has row.priority: 3.
  5. Inspect the published ~/.codex/opencodex-catalog.json and ~/.codex/models_cache.json: gpt-6.1-terra has priority: 104 in both, with visibility: list.
  6. Query the live OpenCodex /v1/models endpoint: the model is present. Repeat ocx sync: the rank remains 104.
  7. Open the Codex App model picker, refreshing stale app-server processes separately when necessary. The priority-sorted picker has the new native model in the generic late band.

Likely cause: src/codex/catalog/build-entries.ts in mergeCatalogEntriesFromObservedState:

const nativePriority = (slug: string, fallback: unknown): number => {
  const base = baseline.get(slug)
    ?? (typeof fallback === "number" ? fallback : 9);
  if (rank.has(slug)) return rank.get(slug)!;
  return featured.length > 0 ? Math.max(base, featured.length + 100) : base;
};

With featured.length === 4, an upstream native priority of 3 becomes 104. Several unrelated native models collapse to the same band, losing their meaningful source ordering. A one-off modelPickerOrder listing the new ID moves it to the front but is not an acceptable general solution.

Regression / acceptance criteria

  • Dynamically preserve source order/priority metadata for non-featured native models, using stable generic fallback behavior when the upstream field is absent; never require model-specific registration to fix rank.
  • Preserve explicit operator selections: featured subagent models remain preferred. Do not regress spawn_agent's model eligibility and supported-choice contract; if appropriate, separate display priority from spawn priority.
  • Do not hardcode gpt-6.1-terra or any future model ID in ranking logic, static lists, generated pins, or default config.
  • Keep live /v1/models, published Codex catalog, and model cache consistent. Report stale Codex app-server state distinctly from ranking correctness.
  • Add regression tests for synthetic unknown native IDs (with and without upstream priority), existing native models, four featured models, no custom order, repeated sync, and upstream reorder.

Related issues: #6257 (automatic native discovery design), #3630 (periodic catalog refresh), #1046 (stale app-server), and #7366 (spawn_agent unfeatured fill). This bug is specifically about ranking after successful model discovery.

Version

@bitkyc08/opencodex 2.92.0.

Operating system

macOS on Apple Silicon (OS release number not captured during reproduction).

Provider and model

Native OpenAI / gpt-6.1-terra (example exposing the general problem; the expected fix must be model-agnostic).

Logs or error output

No model-fetch or publication error. All the relevant calls complete successfully. Observed values:

ocx models order status: Saved mode: default
discovered-native-models.json: gpt-6.1-terra -> row.priority: 3
opencodex-catalog.json:       gpt-6.1-terra -> priority: 104, visibility: list
models_cache.json:            gpt-6.1-terra -> priority: 104, visibility: list
GET /v1/models:               gpt-6.1-terra present

Screenshots and supporting files

Reproduction details and source function above; no screenshots or private logs attached.

Redacted configuration

Illustrative minimal shape only; all credentials, account identifiers, and host-specific paths omitted:

{
  "providers": {
    "openai": { "adapter": "openai-responses", "codexAccountMode": "pool" }
  },
  "subagentModels": ["<featured-native-A>", "<featured-native-B>", "<featured-native-C>", "<featured-routed-D>"]
}

modelPickerOrder and modelPickerOrderMode are not defined.

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. github-actions commented on Oct 26, 2026

    @github-actions
    Contributor

    Issue reopened

    The report now contains the information required by the automated check. Thanks for updating it.

  2. added
    bug
    catalog
    on Oct 27, 2026
  3. added a commit that references this issue on Oct 28, 2026
    338bcf5
  4. lidge-jun commented on Oct 28, 2026

    @lidge-jun
    Owner

    Fixed by #7839, merged to dev as 338bcf5. With featured subagent models, unfeatured native models now publish featured.length + 100 + their upstream source priority (current discovered descriptor, then the pristine catalog backup, then the retained per-model value, then the upstream snapshot, then 9), so new models keep their upstream order behind the featured block. The live Codex /v1/models list, the published catalog and models_cache use the same resolver, repeated syncs do not compound, and no model id is hardcoded. An already-running Codex app-server may need its usual refresh to pick up the new catalog.

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

    bugcatalog

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions