Skip to content

fix(launch): restore interactive model picker when tier models are configured#1638

Merged
jundot merged 4 commits into
jundot:mainfrom
fparrav:fix/model-picker-tier-override
Jun 4, 2026
Merged

fix(launch): restore interactive model picker when tier models are configured#1638
jundot merged 4 commits into
jundot:mainfrom
fparrav:fix/model-picker-tier-override

Conversation

@fparrav

@fparrav fparrav commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Two related bugs in omlx launch claude when opus_model, sonnet_model, or haiku_model are configured in settings.json:

  1. Picker never shown: claude_has_tier_models caused the interactive model picker to be skipped entirely — omlx launch claude auto-selected a tier model without prompting the user.

  2. Selection ignored: Even after restoring the picker (workaround), the model chosen interactively was silently overridden by settings-based tier models when building IntegrationContext, so Claude Code launched with a different model than the one selected.

Root cause

In launch_command (cli.py):

  • The block if not model and claude_has_tier_models: model = sonnet_model or ... prevented the picker block (if not model: ... integration.select_model(...)) from ever being reached.
  • After the picker, IntegrationContext was built with opus_model/sonnet_model/haiku_model from settings, which claude.py then used for ANTHROPIC_DEFAULT_*_MODEL env vars, overriding ctx.model.

Fix

  1. Remove the auto-selection from tier models: if --model is not passed, always go through the picker.
  2. After interactive selection (no --model, no explicit --opus/--sonnet/--haiku flags), clear settings-based tier models so the chosen model is used for all Claude Code tiers.

Behavior after fix:

How you launch Result
omlx launch claude Picker shown → selected model used for all tiers
omlx launch claude --model X Uses X directly, no picker
omlx launch claude --sonnet X --haiku Y Explicit tier flags respected as before

Settings-based tier models still work correctly when the user explicitly passes --opus/--sonnet/--haiku flags.

fparrav added 4 commits June 1, 2026 14:28
omlx/__init__.py was eagerly importing the full MLX stack (scheduler,
engine_core, mlx_lm) at module load time. This caused a crash when
scipy/sklearn were compiled against NumPy 1.x but NumPy 2.x was
installed, because the import chain reached scipy before any MLX code
was actually needed.

Commands like `omlx launch claude` that never touch the scheduler or
engine would crash at startup before executing a single line of
their own logic.

Replace eager imports with a PEP 562 module-level __getattr__ that
defers loading until a symbol is first accessed. The public API
(__all__) is unchanged.
… passed

Two related bugs in `omlx launch claude`:

1. When opus/sonnet/haiku tier models were configured in settings.json,
   `claude_has_tier_models` caused the picker to be skipped entirely and
   a tier model to be auto-selected, even on bare `omlx launch claude`.

2. Even after restoring the picker, the model selected interactively was
   overridden by settings-based tier models when building IntegrationContext,
   causing Claude Code to launch with a different model than the one chosen.

Fix: remove the auto-selection from tier models when no `--model` flag is
passed. When the user picks a model interactively (no --model, no explicit
--opus/--sonnet/--haiku flags), clear settings-based tier models so the
chosen model is used for all Claude Code tiers.

Explicit `--model`, `--opus`, `--sonnet`, `--haiku` flags continue to work
as before.
When --opus/--sonnet/--haiku flags are passed explicitly, derive the model
from them directly without entering the interactive picker. Only bare
`omlx launch claude` (no --model, no explicit tier flags) goes through
the picker and clears saved tier settings.

Also fixes two failing CI tests:
- Renamed test to reflect new behavior: picker is shown when no flags
  given, saved tier models are cleared after selection
- Fixed mock setup (missing /health response + wrong models format)
@jundot

jundot commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Thanks, this looks good to me. I found one small lint-only cleanup after review, so I'm going to merge this and fold that into a maintainer follow-up on main.

@jundot jundot merged commit 5d43b18 into jundot:main Jun 4, 2026
4 checks passed
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