Skip to content

Commit acd2d06

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.
1 parent 3c9503e commit acd2d06

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
@@ -1294,7 +1294,10 @@ def discover_model_services(
12941294
if candidates:
12951295
claude_models[family] = candidates[0]
12961296

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

13001303
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
@@ -269,6 +269,26 @@ def test_embedding_model_sharing_family_substring_excluded(self, monkeypatch):
269269
assert "system.ai.qwen35-122b-a10b" in oss
270270
assert "system.ai.qwen3-embedding-0-6b" not in oss
271271

272+
def test_gpt_oss_is_oss_not_codex(self, monkeypatch):
273+
# gpt-oss-* contains "gpt-" but is chat-completions-only, not an
274+
# openai-responses codex model. It must bucket into oss ONLY, never
275+
# codex (whose openai-responses route would 400 for it).
276+
payload = {
277+
"model_services": [
278+
_model_service("system.ai.gpt-5"),
279+
_model_service("system.ai.gpt-oss-120b"),
280+
]
281+
}
282+
monkeypatch.setattr(
283+
db_mod, "_http_get_json", lambda url, token, timeout=10: (payload, None)
284+
)
285+
286+
_, codex, _, oss, _ = db_mod.discover_model_services(WS, "token")
287+
288+
assert codex == ["system.ai.gpt-5"]
289+
assert "system.ai.gpt-oss-120b" in oss
290+
assert "system.ai.gpt-oss-120b" not in codex
291+
272292
def test_paginates_via_next_page_token(self, monkeypatch):
273293
pages = {
274294
None: {

0 commit comments

Comments
 (0)