databricks: bucket UC model-services by supported_api_types#205
Draft
MarkAngler wants to merge 1 commit into
Draft
databricks: bucket UC model-services by supported_api_types#205MarkAngler wants to merge 1 commit into
MarkAngler wants to merge 1 commit into
Conversation
Model discovery bucketed `system.ai.*` ids into claude/codex/gemini/oss by
matching substrings in the model name. Names don't say which API dialect a
model speaks, so the guess misfired three ways:
- `gpt-oss-120b`/`gpt-oss-20b` matched `"gpt-" in id` and were bucketed as
OpenAI Responses models. They only speak `mlflow/v1/chat/completions`, so pi
registered them under `databricks-openai` pointing at /ai-gateway/codex/v1 —
a route that rejects them. Claude's web_search MCP aimed at the same route.
- `claude-fable-5` matched none of `claude-{opus,sonnet,haiku}-` and vanished.
- `claude_models` is a `{family: id}` map, so only the newest model per family
reached agents that render a full model list. A workspace serving 11 Claude
models showed pi 3.
Every model-service entry already carries `supported_api_types`; the listing
fetched it and threw it away. Bucket by that instead, with precedence — a
Claude model also advertises mlflow chat-completions and would otherwise land
in two buckets. Workspaces whose payload predates the field fall back to the
name rules, with the codex rule tightened to require a version digit after
`gpt-` so gpt-oss is excluded there too.
Also:
- Sort every bucket with `model_version_sort_key`, replacing a lexicographic
reverse sort that ranked `opus-4-8` above `opus-4-10`, and leaving
`codex_models[0]` as the newest rather than the alphabetically first.
- Return `claude_ids` (every Anthropic-dialect id) alongside the family map;
persist it as `claude_model_ids` and register it in pi's models.json.
opencode deliberately keeps reading the family map — it takes `anthropic[0]`
as its default, which widening would silently move onto claude-fable-5.
- `check_gateway_endpoint("codex")` now delegates to `codex.default_model`.
A non-empty list wasn't enough: codex drops ids that don't parse as
`gpt-<version>`, so a gpt-oss-only workspace reported codex available and
then failed at launch with "No models available for codex".
State keys are additive; no STATE_VERSION bump (a mismatch discards every
workspace's state, including managed_configs and provider_services).
Refs databricks#204
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 10, 2026
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.
Part of #204.
Problem
Model discovery bucketed
system.ai.*ids into claude/codex/gemini/oss by matching substrings in the model name. Names don't say which API dialect a model speaks, so the guess misfired three ways on a real workspace:gpt-oss-120b/gpt-oss-20bmatched"gpt-" in idand were bucketed as OpenAI Responses models. They only speakmlflow/v1/chat/completions, so pi registered them underdatabricks-openaipointing at/ai-gateway/codex/v1— a route that rejects them.claude-fable-5matched none ofclaude-{opus,sonnet,haiku}-and was dropped entirely.claude_modelsis a{family: id}map, so only the newest model per family reached agents that render a full model list (pi showed 3 of 11 Claude models).Two collateral bugs fell out of the same root cause:
ucode codexreported itself available and then failed at launch (check_gateway_endpointtested the list,codex.default_modelfiltered it to empty), and Claude'sweb_searchMCP aimedgpt-oss-120bat the Responses route.Fix
Every UC model-service entry already carries a
supported_api_typesfield that the listing fetched and discarded. Bucket by that instead, with explicit precedence (a Claude model also advertises mlflow chat-completions and would otherwise land in two buckets). Workspaces whose payload predates the field fall back to the name rules, with the codex rule tightened to require a version digit aftergpt-so gpt-oss is excluded there too.Also:
model_version_sort_key, replacing a lexicographic reverse sort that rankedopus-4-8aboveopus-4-10, and keepingcodex_models[0]as the newest rather than the alphabetically first.claude_model_ids) alongside the family map, and register it in pi'smodels.jsonso all Claude models the workspace serves are selectable. opencode deliberately keeps reading the family map (it takesanthropic[0]as its default; widening would silently move that default).check_gateway_endpoint("codex")delegates tocodex.default_modelso a workspace with no Responses model reports codex unavailable at configure time instead of failing at launch.State keys are additive; no
STATE_VERSIONbump.Note for reviewers
The docstring at
databricks.pyclaimed "the model-services API does not expose per-model API dialects" — this is false on current API versions (supported_api_typesis present), and the fix depends on that. If any supported workspace/API version omits the field, the name-rule fallback covers it.🤖 Generated with Claude Code