Skip to content

MPS: launch on a servable default model, and honor --model under --provider - #380

Open
masonc08 wants to merge 1 commit into
masonc08/pin-anthropic-mps-targetsfrom
masonc08/mps-default-launch-model
Open

MPS: launch on a servable default model, and honor --model under --provider#380
masonc08 wants to merge 1 commit into
masonc08/pin-anthropic-mps-targetsfrom
masonc08/mps-default-launch-model

Conversation

@masonc08

Copy link
Copy Markdown
Collaborator

Problem

ucode claude --provider <mps> always started on Claude Code's built-in "family default" (opus). When a Model Provider Service declares no opus target, the gateway 403s that default — so a bare launch failed for any service that only offers sonnet/haiku (e.g. an API-key Anthropic MPS scoped to sonnet+haiku). --model couldn't rescue it either: --model + --provider was rejected outright with "Use either --model or --provider, not both."

Stacked on #376 (which pins the declared per-family targets); this makes the launch model land on one of them.

Change

Under a provider:

  • Auto-pick the best servable tier. With no --model, choose the most capable tier the service actually declares (opus > sonnet > haiku) and pin it via ANTHROPIC_MODEL, so the session starts on a servable model instead of dead-ending on opus. When the service does offer opus, pin nothing — Claude Code's own default already works, and this avoids the duplicate /model picker row ANTHROPIC_MODEL produces.
  • Honor --model (guard removed). A family alias (opus/sonnet/haiku) resolves to that tier's declared target (clear error if the service doesn't offer it); any other value is trusted as a raw target id. Routed via route_root_model, not custom_model, so it doesn't clobber the per-family pins from Pin declared Anthropic MPS targets by family, like Bedrock #376.
  • Relayed services: model selection is server-side, so --model is ignored with a warning.

The launch banner now also prints the chosen Model: under a provider.

Known gap (deferred)

For an opus-less Bedrock service the region-prefixed slug can be rejected by ANTHROPIC_MODEL's client-side check. That case was already broken (bare launch 403s on opus), and opus-having Bedrock services are unaffected (they return None and behave as today). The follow-up fix is to pin the servable target into the opus family slot instead — that channel is passed through unchecked.

Testing

  • Unit: resolve_provider_launch_model (7 cases: opus-present no-op, sonnet/haiku fallback, alias→target, unavailable-tier error, raw-id passthrough); CLI provider-launch (alias pin, auto-default, opus-present no-op, unavailable-tier error, relayed-ignored).
  • Suites green: test_databricks.py (248), test_cli.py (218), test_agent_claude.py + test_agents_init.py (188). ruff clean.
  • End-to-end against an API-key Anthropic MPS (canonical target names): recommended sanity check — bare launch starts on sonnet with no 403; --model haiku starts on haiku; --model opus errors clearly.

This pull request and its description were written by Isaac.

@masonc08
masonc08 requested a review from rohita5l August 24, 2026 22:39
…--model pick one

`ucode claude --provider <mps>` always started on Claude Code's built-in
"family default" (opus). When the Model Provider Service declares no opus
target the gateway 403s that default, so a bare launch failed for any service
that only offers sonnet/haiku. `--model` couldn't rescue it either: `--model` +
`--provider` was rejected outright.

Now, under a provider:
- with no --model, pick the most capable tier the service actually declares
  (opus > sonnet > haiku) and pin it via ANTHROPIC_MODEL, so the session starts
  on a servable model instead of dead-ending on opus. When the service does
  offer opus, pin nothing -- Claude Code's own default already works, and this
  avoids the duplicate /model picker row ANTHROPIC_MODEL causes.
- --model is honored (guard removed): a family alias (opus/sonnet/haiku)
  resolves to that tier's declared target (clear error if the service doesn't
  offer it), any other value is trusted as a raw target id. Routed via
  route_root_model, not custom_model, so it doesn't clobber the per-family pins.
- a relayed (subscription) service selects the model server-side, so --model is
  ignored with a warning.

Known gap, deferred: for an opus-less Bedrock service the region-prefixed slug
can be rejected by ANTHROPIC_MODEL's client-side check. That case was already
broken (bare launch 403s), and opus-having Bedrock services are unaffected; the
follow-up is to pin the servable target into the opus family slot instead.

Co-authored-by: Isaac <no-reply@databricks.com>
@masonc08
masonc08 force-pushed the masonc08/mps-default-launch-model branch from d4ff231 to f98b473 Compare August 25, 2026 01:32
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.

1 participant