Conversation
…race When smart routing builds available_models, it uses either custom catalog slugs (bare hyphenated, e.g. gpt-5-6-luna) or cached discovery ids (system.ai.-prefixed, e.g. system.ai.gpt-5-6-luna) depending on whether the per-workspace catalog file is present. codex_model_id only translated the prefixed form, so users on the catalog path got the unresolvable bare slug while fallback users got the working dotted alias (gpt-5.6-luna). Make codex_model_id translate bare GPT slugs too so both dialects converge to the dotted alias the gateway resolves. Add a reproducer script and tests covering bare-slug translation and the full routing path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Some users on the same workspace and same ucode version get
gpt-5-6-luna(broken, gateway can't resolve) while others getgpt-5.6-luna(working). The difference is nondeterministic across users.Root cause
When smart routing builds
available_models, it uses one of two sources:gpt-5-6-lunasystem.ai.-prefixed ids, e.g.system.ai.gpt-5-6-lunaThe router side handles both dialects fine (
_normalize_route_modelcanonicalizes them). But after routing, the chosen model is passed throughcodex_model_idto produce the dotted alias the gateway resolves (gpt-5.6-luna).codex_model_idonly translatedsystem.ai./databricks-prefixed ids — bare slugs hitelse: return modeland passed through unchanged.So whether the catalog file was present at launch time decided whether the user got the working alias or the broken one. Which branch a user lands on varies with their local config state (configure history, managed settings rollout, catalog cleanup), making it look like a race.
Fix
One-line change in
codex_model_id(codex_routing.py:185):else: bare = tailinstead ofelse: return model. This makescodex_model_idtranslate bare GPT slugs too, so both dialects converge to the dotted alias.gpt-5.6-luna→gpt-5.6-luna)gpt-6-astra→gpt-6-astra)glm-5-2→glm-5-2)databricks-gpt-5-2-codex,databricks-gpt-5-4-nano)Testing
test_codex_model_id_translates_bare_hyphenated_gpt_slugs— unit test for bare slug translationtest_routing_with_bare_catalog_slugs_produces_dotted_alias— full routing path with bare catalog slugs (the reproducer)scripts/repro_routing_race.py— standalone script demonstrating both branches converge