Repository navigation
refactor(profiles): three-scope template contract + drop is_builtin emission - #1399
Merged
Merged
Conversation
Adds the universal/per-model field split and built-in preset templates shipped on first run. UNIVERSAL_PROFILE_FIELDS gates which keys a global template may carry; per-model profiles continue to accept the full sampling surface. New default_global_profile.json seeds the preset catalog when the user has no templates of their own. Server-side foundation for the design's three-scope profile model (preset / global / model) the Swift app now binds to.
Server-side slice. Drops the 4 hard-coded preset templates the ModelSettingsManager shipped on first run and lets clients source their catalog from `omlx/admin/static/omlx_preset.json` (the bundle that's already refreshable from omlx.ai). The 4 builtin entries were never on omlx.ai's side, so both HTML and the upcoming Swift app converge on the bundle's 10-entry catalog with no drift. - Delete `omlx/template/default_global_profile.json` and the `_get_builtin_templates()` machinery in `ModelSettingsManager`. - Drop the rename/save/delete rejection branches that special-cased builtin names — `/api/profile-templates` now serves user templates only. `is_builtin` stays on the response schema (always false) so back-compat with older HTML/Swift clients is intact; a follow-up removes it once both clients no longer key on the field. - Sync `model_profiles.py` to drop `load_default_global_templates()` — it's dead code once the builtin source is gone. - Tests: drop the qwen3.6 builtin assertions; keep CRUD + persistence coverage. Carved out of the Swift app PR (jundot#1371) for focused review per maintainer ask — the Swift-side preset bundle client lives there.
`ModelSettingsManager` previously stamped `is_builtin: false` on every template payload — belt-and-suspenders left over from when server-side builtins existed. With those retired (prior commit), the flag is dead weight: HTML doesn't read it, and the Swift app gates on `templateScope` (defaults to `.global` when the field is absent) so older clients keep working unchanged. Schema-compat note: the field stays decodable on the client side as `Optional<Bool>` — we're just dropping the emission. Older clients that still expect the key continue to work because their decoders treat it as optional. Carved out of the Swift app PR (jundot#1371). The Swift-side stale-reference patches and packaging/build.py cleanup that were also in the original commit stay in jundot#1371 since they touch Swift sources.
Owner
|
Thanks for slicing the server-side prep out. The universal vs per-model field split lines up cleanly with the three-scope model, and dropping the informationless Merging now. |
4 tasks done
panwudi
added a commit
to panwudi/flyto-mlx
that referenced
this pull request
May 27, 2026
Catch-up sync. Highlights: - boundary-store cleanup race fix (jundot#1423) — eliminates the test_cleanup_all_drains_queue flake we have been carrying. - per-engine MLX threads / streams (jundot#1304) — multiple models stepping scheduler.step() concurrently no longer cross-contaminate streams. - VLM lazy state materialized on loader thread; skip MTPModule attach when checkpoint lacks mtp.* weights. - Dead TieredCacheManager removed; profiles three-scope template refactor (jundot#1399). 4567 pass / 3 known env-override fails / 36 skip. Zero regression. User delegated review. --- Catch-up 同步. 主要内容: - boundary-store 清理 race 修复 (jundot#1423) - 消掉一直拖着的 test_cleanup_all_drains_queue flake. - 每引擎 MLX 线程 / 流 (jundot#1304) - 多模型并发 scheduler.step() 不再 cross-contaminate. - VLM 在 loader 线程实例化 lazy 状态; checkpoint 无 mtp.* 权重时 跳过 MTPModule attach. - 删 dead TieredCacheManager; profiles three-scope template 重构 (jundot#1399). 4567 pass / 3 known env-override fails / 36 skip. 零回归. 用户委托 review.
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.
Summary
Prep PR carved out of #1371 per maintainer review. Tightens the server-side
template/profile API into a shape both HTML and the upcoming Swift app can
bind to cleanly, with one user-visible contract shift (drops
is_builtinfrom
/api/profile-templatespayloads).Reviewable as a standalone server change — no Swift code, no client
required to demonstrate correctness.
What this changes on main
omlx/model_settings.py(+13/-2)UNIVERSAL_PROFILE_FIELDS— the keys a global (cross-model) templateis allowed to carry. Per-model profiles continue to accept the full
sampling surface; globals are now constrained to the universal subset so
the three scopes (preset / global / model) compose without leaking
model-specific fields up the chain.
get_template(name)returns{}for missing/empty templates instead ofNone. Callers that previously had to special-caseNonecan now usethe result directly.
/api/profile-templatespayloads no longer stampis_builtin: falseonevery entry. The flag carried no information once the catalog became
user-templates-only; HTML doesn't read it, and consumers can treat
templates as not-builtin by construction.
tests/test_model_settings_profiles.py(+35/-2)Covers the new universal-field gating, the
{}return contract, and theshape of
/api/profile-templateswithoutis_builtin.Behavior shifts to flag
get_template(name)returns{}notNonefor unknown templates.HTML admin and any external
/api/profile-templates/{name}consumersshould be checked against this — internal callers were audited.
/api/profile-templatespayloads dropis_builtin. HTML doesn'treference the flag; older external clients that hard-required the key
would break, though I'm not aware of any.
How this preps #1371
The Swift app's profiles UI binds a three-scope model (preset chips
shipped via
omlx/admin/static/omlx_preset.json+ per-server globaltemplate + per-model profile). The server side of that contract — what
the global template is allowed to carry, what the API surface returns —
lives here so it can be reviewed and merged independently of the ~4k-line
Swift rewrite. Once this lands, #1371 only carries the Swift client
bindings on top.
Test plan