Skip to content

Codex MultiRouter spawn_agent only exposes five model candidates; DeepSeek hidden unless promoted #1

Description

@BigStrongSun

Problem

In CCSwitchMulti/Codex MultiRouter, the full generated Codex model catalog can contain OpenAI, Qwen, DeepSeek, and Spark models, but Codex spawn_agent only shows five model candidates in the tool description. When deepseek-v4-flash and deepseek-v4-pro are ordered after the first five picker-visible catalog entries, they are not visible to the main agent as available sub-agent model overrides.

This reproduces even when the underlying CCSwitchMulti configuration is otherwise the same across machines. The important symptom is discoverability: DeepSeek may work when explicitly requested by slug, but it is missing from the visible spawn_agent candidate list.

Root cause found

Upstream Codex limits the spawn_agent tool description to five picker-visible models:

  • codex-rs/core/src/tools/handlers/multi_agents_spec.rs
  • MAX_MODEL_OVERRIDES_IN_SPAWN_AGENT_DESCRIPTION: usize = 5
  • spawn_agent_models_description() filters show_in_picker and then calls .take(5)

This appears to be a prompt/tool-description limit rather than a runtime execution limit. The model argument is a free string, and runtime validation resolves against the full available model list in multi_agents_common.rs. Explicit model: "deepseek-v4-flash" has been tested and can spawn successfully when the model exists in the catalog.

Why this matters for CCSwitchMulti

CCSwitchMulti can write all routed models into Codex's catalog, but if Codex Desktop/app-server only describes the first five picker-visible models to the main agent, models after the first five become effectively undiscoverable for spawn_agent use.

Provider id naming is not the core issue here. The key question is what Codex sees in the generated catalog order and whether the requested model is visible in the five-model spawn_agent description window.

Investigation items

  • Verify whether the five-model description limit can be exceeded from outside Codex by changing catalog shape, picker visibility, config fields, app-server cache, or Desktop model metadata.
  • If not, treat the upstream five-model window as a hard external display contract.
  • Ensure CCSwitchMulti/MultiRouter lets users choose which models are promoted into that five-model spawn_agent candidate window.

Implemented direction in local branch

Local branch feat/codex-local-model-routing adds CCSwitchMulti-side support for:

  • settings_config.modelCatalog.spawnAgentModels
  • A Codex provider model-mapping UI selector for up to five sub-agent candidate models
  • Catalog generation that promotes the selected models to the front while preserving the full catalog
  • Fallback ordering that promotes representative Qwen/DeepSeek/Spark models when no explicit selection exists

Invariants:

  • Full model catalog is preserved.
  • Unknown selected model ids are ignored.
  • Only catalog order changes; route rules, OAuth, speed tiers, history buckets, and stats attribution must not change.

Validation already run locally

  • cargo fmt --manifest-path src-tauri/Cargo.toml
  • cargo test --manifest-path src-tauri/Cargo.toml codex_model_catalog_uses_user_spawn_agent_model_priority --lib
  • cargo test --manifest-path src-tauri/Cargo.toml codex_model_catalog_prioritizes_cross_provider_models_for_spawn_agent_description --lib
  • cargo test --manifest-path src-tauri/Cargo.toml codex_config::tests --lib
  • cargo test --manifest-path src-tauri/Cargo.toml spawn_agent_priority_diagnostics --lib
  • cargo check --manifest-path src-tauri/Cargo.toml --lib
  • cargo check --manifest-path src-tauri/Cargo.toml
  • pnpm run typecheck
  • pnpm run build:renderer

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions