Skip to content

Route Codex smart routing over the catalog Codex loads - #1180

Draft
xsh310 wants to merge 1 commit into
databricks:mainfrom
xsh310:codex-session-catalog
Draft

xsh310 wants to merge 1 commit into
databricks:mainfrom
xsh310:codex-session-catalog

Conversation

@xsh310

@xsh310 xsh310 commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Smart routed Codex sessions now build the router menu from the same catalog file Codex loads, so the router can only pick models Codex can start.

Problem

Without a managed config, launch_codex offered the router every cached system.ai GPT and OSS service (codex_models + oss_models, 29 names on a staging workspace). Codex's own list is its bundled catalog plus /codex/v1/models, which covered 10 of them on an older Codex. A pick outside that list, such as gpt-6-luna, made spawn_agent fail with Unknown model.

Change

  • _launch_smart_routing resolves one catalog file: the configured model_catalog_json when there is one, otherwise a catalog ug writes from discovery.
  • Discovery calls /codex/v1/models with parent schema system.ai, which returns every system.ai model Codex can use, GPT included. The names go through prepare_codex_catalog, the same builder managed lists use, so GPT models keep Codex's bundled metadata and native aliases. The per model "missing metadata" warnings stay off for discovered names, since they are not admin choices.
  • launch_codex takes catalog_path, passes it to Codex, and reads the router menu from it. The cached codex_models/oss_models fallback is removed.
  • When discovery fails (for example codex/v1/models is not enabled for this workspace) or returns nothing, the session launches without a catalog and without routing.
  • Routed launches still do not apply a model provider or model location (unchanged).

Testing

  • Unit suite (uv run pytest): 4809 passed. tests/test_skills.py::test_orchestrator_injects_the_installed_agent_instructions also fails on main on my machine and was deselected.
  • ruff check, ruff format --check, and ty check pass.
  • Live check against a staging workspace with Codex 0.162.1: discovery listed 23 system.ai models, the start model stayed gpt-6.1-sol, the router picked system.ai.gpt-6-luna, and the spawn name gpt-6-luna is in the written catalog.

This pull request and its description were written by Isaac.

Without a managed config, the Codex router menu came from every cached
system.ai GPT and OSS service, while Codex could only start models in its
own catalog. Router picks such as gpt-6-luna then failed spawn_agent with
"Unknown model".

Routed launches now use one catalog file for both. A configured
model_catalog_json is used as before. Otherwise ug discovers the system.ai
models Codex can use from /codex/v1/models, builds the catalog with
prepare_codex_catalog like a managed list, and passes it to Codex. When
discovery fails, the session has no catalog and no routing.

Co-authored-by: Isaac <no-reply@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant