Skip to content

fix(model-services): handle null payloads, surface partial failures, and bypass Codex /v1/models#153

Closed
asujithan wants to merge 2 commits into
mainfrom
asujithan/model-services-discovery
Closed

fix(model-services): handle null payloads, surface partial failures, and bypass Codex /v1/models#153
asujithan wants to merge 2 commits into
mainfrom
asujithan/model-services-discovery

Conversation

@asujithan

Copy link
Copy Markdown
Collaborator

Follow-up fixes on top of #151 UC model-services discovery path. All changes gated on UCODE_USE_MODEL_SERVICES / state["use_model_services"] unless noted.

Bug fixes

  • Null-payload crash — guard data.get("model_services") or [] in list_model_services; the API returns {"model_services": null} for empty metastores instead of [], which previously crashed with TypeError.
  • Silent pagination failures — propagate last_reason from list_model_services and discover_model_services even on partial success, so a 504 on page 2 surfaces during configure instead of being swallowed.
  • Codex /v1/models rejection — when on the model-services path, write ~/.ucode/codex-model-catalog.json and set model_catalog_json in ~/.codex/ucode.config.toml. Codex switches to StaticModelsManager and never calls the AI Gateway's /v1/models (which currently rejects system.ai.* ids). File is removed on toggle-off and on ucode revert.
    UX
  • ucode status displays Model discovery: model-services (system.ai.) vs ai-gateway (databricks-) (ungated, cosmetic).
  • ucode usage — simplify_model_name strips both databricks- and system.ai. prefixes so rows merge across modes (ungated, no-op for AI Gateway data).

Tests
Unit coverage for each fix above. Full suite: 748 passed, 32 deselected (e2e + write-restricted revert). Lint + format clean.

AarushiShah-db and others added 2 commits June 10, 2026 21:34
When UCODE_USE_MODEL_SERVICES is set, discover models via the Unity Catalog
model-services API and address them as system.ai.<model-name> instead of the
per-family AI Gateway listings. Base URLs are unchanged — only the model name
differs.

The flag is sticky: it's persisted into state at configure time so launches
honor it without re-exporting the env var (an explicit env var still wins).
Discovery uses a small page size with per-page retries because the metastore
listing is slow and frequently 504s, and filters to system.ai.* so model
services from other schemas don't leak into the family buckets.

Co-authored-by: Isaac
@asujithan asujithan closed this Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants