Repository navigation
ug claude can't find any LLMs when model services live outside system.ai #569
Description
Note: I wrote this with AI but I read through it and everything looks clear. TL/DR if you disable access to system catalog llms (many clients do this) and enable them as model services, ug/ucode won't be able to find them and fail on startup
Summary
ug claude reports "AI Gateway returned no Claude model ids" and "No coding agents are available on this workspace" even when the workspace has Claude model services available. In my Hershey sandbox I have three Claude model services (il-claude-haiku-4-5, il-claude-opus-5, il-claude-sonnet-5) and none of them are discovered.
Root cause
Model-services discovery is hardcoded to the system.ai schema in two places, so any Claude model service living in a different UC catalog/schema is invisible. My three models live in il_model_service.default, not system.ai.
The two hardcoded constants in src/ucode/databricks.py:
_MODEL_SERVICE_REQUIRED_PREFIX = "system.ai."(client-side name filter)_MODEL_SERVICE_PARENT_SCHEMA = "schemas/system.ai"(server-side query scope)
Both locks apply:
list_model_services()sendsparent=schemas/system.ai, so the API only returns services insystem.ai. Theil_model_service.defaultservices never come back.- Even if they did,
_model_service_id()drops any name that doesn't start withsystem.ai..
Family bucketing itself is fine (il-claude-opus-5 contains claude-opus-), the ids just never reach it.
Why the fallback doesn't cover it
For Claude, when model-services comes back empty, cli.py falls back to discover_claude_models(), which hits the AI Gateway's Anthropic foundation-models endpoint. This workspace has no foundation models, so that returns nothing too. Both paths assume the models are either in system.ai or exposed as foundation-model endpoints. These are neither, they are UC model services in a custom catalog.
Worth noting: model_service_exists() already scopes to arbitrary schemas via parent=schemas/{catalog}.{schema}, so the codebase already knows model services can live outside system.ai. The main discovery walk just doesn't.
Steps to reproduce
- Create Claude model services in a catalog/schema other than
system.ai(mine are inil_model_service.default). - Have no foundation-model endpoints in the workspace.
- Run
ug claude. - Auth and gateway connect succeed, then:
ERROR No coding agents are available on this workspace/Claude models ...: AI Gateway returned no Claude model ids.
Suggested fix
A few options, trading speed vs completeness:
- Broaden the walk and relax the
system.ai.prefix requirement, bucketing purely by theclaude-<family>-substring. Most robust, but an unscoped metastore walk can be slow on busy workspaces (the existing code comment notes ~50s). - Make the catalog/schema configurable (e.g. an env var like
UCODE_MODEL_SERVICE_SCHEMA). Cheapest, keeps the fast single-page query. system.aifirst, then widen: keep the fastsystem.aiquery, and only if it (and the foundation-model fallback) come up empty, do the broader walk. Keeps the common fast path and self-heals for custom-catalog workspaces.
Option 3 seems like the best balance.
Environment
- CLI:
ug/ucode - Workspace: Azure Databricks (Hershey sandbox)
- Repo at commit
03aefdc
Activity
[-]ug claude finds no Claude models when model services live outside system.ai[/-][+]ug claude can't find any LLMs when model services live outside system.ai[/+]Discover model services outside the system.ai schema