fix(launch): restore interactive model picker when tier models are configured#1638
Merged
Merged
Conversation
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)
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. |
6 tasks
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.
Problem
Two related bugs in
omlx launch claudewhenopus_model,sonnet_model, orhaiku_modelare configured insettings.json:Picker never shown:
claude_has_tier_modelscaused the interactive model picker to be skipped entirely —omlx launch claudeauto-selected a tier model without prompting the user.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):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.IntegrationContextwas built withopus_model/sonnet_model/haiku_modelfrom settings, whichclaude.pythen used forANTHROPIC_DEFAULT_*_MODELenv vars, overridingctx.model.Fix
--modelis not passed, always go through the picker.--model, no explicit--opus/--sonnet/--haikuflags), clear settings-based tier models so the chosen model is used for all Claude Code tiers.Behavior after fix:
omlx launch claudeomlx launch claude --model Xomlx launch claude --sonnet X --haiku YSettings-based tier models still work correctly when the user explicitly passes
--opus/--sonnet/--haikuflags.