Skip to content

Commit ec40e8c

Browse files
committed
fix: exclude gpt-oss from codex bucket in model-services discovery
gpt-oss-* contains 'gpt-' so it matched the codex bucket, but it's a chat-completions-only OSS model (served via /ai-gateway/mlflow/v1), not an openai-responses model. Broadening _OSS_MODEL_FAMILIES to include gpt-oss put it in BOTH codex_models and oss_models, so it was offered under Pi's databricks-openai provider too — where the openai-responses route 400s for it. Exclude gpt-oss from the codex bucket so it's OSS-only. (cherry picked from commit acd2d06)
1 parent b3024f5 commit ec40e8c

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

src/ucode/databricks.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,10 @@ def discover_model_services(
13371337
if candidates:
13381338
claude_models[family] = candidates[0]
13391339

1340-
codex_models = [m for m in ids if "gpt-" in m]
1340+
# `gpt-oss-*` also contains "gpt-" but is a chat-completions-only OSS model
1341+
# (served via /ai-gateway/mlflow/v1), NOT an openai-responses codex model —
1342+
# exclude it here so it isn't offered under the codex provider (which 400s).
1343+
codex_models = [m for m in ids if "gpt-" in m and "gpt-oss" not in m]
13411344
gemini_models = sorted([m for m in ids if "gemini-" in m], key=model_version_sort_key)
13421345

13431346
oss_models = [m for m in ids if _is_oss_chat_model(m)]

tests/test_databricks.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,26 @@ def test_embedding_model_sharing_family_substring_excluded(self, monkeypatch):
286286
assert "system.ai.qwen35-122b-a10b" in oss
287287
assert "system.ai.qwen3-embedding-0-6b" not in oss
288288

289+
def test_gpt_oss_is_oss_not_codex(self, monkeypatch):
290+
# gpt-oss-* contains "gpt-" but is chat-completions-only, not an
291+
# openai-responses codex model. It must bucket into oss ONLY, never
292+
# codex (whose openai-responses route would 400 for it).
293+
payload = {
294+
"model_services": [
295+
_model_service("system.ai.gpt-5"),
296+
_model_service("system.ai.gpt-oss-120b"),
297+
]
298+
}
299+
monkeypatch.setattr(
300+
db_mod, "_http_get_json", lambda url, token, timeout=10: (payload, None)
301+
)
302+
303+
_, codex, _, oss, _ = db_mod.discover_model_services(WS, "token")
304+
305+
assert codex == ["system.ai.gpt-5"]
306+
assert "system.ai.gpt-oss-120b" in oss
307+
assert "system.ai.gpt-oss-120b" not in codex
308+
289309
def test_paginates_via_next_page_token(self, monkeypatch):
290310
pages = {
291311
None: {

0 commit comments

Comments
 (0)