Repository navigation
fix(desktop): surface control panel on launch - #110
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_fdad81f5-a2c9-44fa-882c-1aa083a5a75c) |
Merge-forward of mirror/upstream (237ab8a, tag v0.0.10). 10 upstream commits: mlx-node#108/mlx-node#109 template-authoritative chat + continuation cache reuse, mlx-node#110 desktop control panel, mlx-node#111 gemma4 long-context decode, mlx-node#113 quantized inference fast paths. NOT a low-risk bump. crates/mlx-sys/src/lib.rs (+93), mlx_na_int8.cpp (+162), mlx_paged_*.cpp/.h (~550), and mlx_paged_stubs_linux.cpp (+24, our platform) all move; build.mjs rebuilds mlx-sys as a cargo dependency, so this reaches the binary GenMLX loads. 7 conflicts, then 38 rustc errors from API ripples that auto-merged cleanly into regions our fork also touches. Three ripple classes: mlx-node#113 Embedding refactor — project_logits_from_hidden and the forward/prefill family now take `embedding: &Embedding` instead of a raw weight + optional transposed twin. Adopted wholesale. inject_image_placeholders — now returns Result<Vec<u32>>; fork VLM call sites needed `?` (16 of the 38 errors, and NO resolver reported this class). ChatStreamChunk — gained three required fields; fork-added literals filled by mirroring the dense sibling's own values rather than blind-defaulting. THE TRANSPOSED EMBEDDING WEIGHT WAS NEVER OURS. It was flagged mid-merge as a lost fork perf patch; provenance says otherwise. The merge base already carried it (69 dense / 42 MoE occurrences), traced to upstream's own mlx-node#24, and upstream removed it in mlx-node#113. Our fork merely FOLLOWED that convention at call sites we added. Preserving it would have been a regression, not a rescue: Embedding documents `get_weight()` as a tripwire — "production inference must never call get_weight() on a packed embedding because that constructs a full [vocab, hidden] dequantization graph" — and mlx-node#113's `as_linear` routes packed checkpoints through mlx_quantized_matmul(transpose=true) so the dense table is never materialized. FORK PATCHES VERIFIED INTACT: genmlx-d3yn (one generation stream per model) — byte-exact. Stream::new sites 4/4 dense and 2/2 MoE vs HEAD; generation_stream refs 90/90 and 80/80. This is the patch most at risk of silent loss, and note it CANNOT be validated here: the leak is Metal-only (Stream::new collapses to the default stream without Metal), which is why it never reproduced on Thor. A green battery on a CUDA box proves nothing about it. mlx-cft4 (merged_qkvz in MoE weight loading) — was HALF-LOST and is restored. Upstream demoted apply_weights_moe_inner to a #[cfg(test)] wrapper and moved production loading into apply_weights_moe_inner_with_residency, which had no merged_qkvz param; our parameter survived only on the test-only wrapper while its consuming logic rode into the production body. Re-plumbed (:522, consumed :765). Left unfixed this would have silently corrupted MoE expert weight loading — no test would have caught it. genmlx-uhtp (mlx_report_error on paged-attn catch sites) — intact, rebased onto upstream's renamed context label. mlx gitlink UNCHANGED (fef8890f both sides — no nax replay needed). Superset invariant re-verified on freshly fetched refs after finding the first check ran against a stale up/main: `git cherry -v origin/main fef8890f up/main` -> 0 '+'. cargo check -p mlx-core --release: 0 errors. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Summary
Root cause
The app inferred “first launch” from a missing settings file and ignored macOS
activateevents whenshowInDockwas false. A prior build could create settings before the real install, and LaunchServices reactivates an existing accessory app instead of spawning a second Electron instance. That left a live process with neither a Control Panel nor a reliable way to surface it. Reopens during graceful shutdown could also be swallowed by the singleton lock.Validation
yarn test packages/desktop/__test__/launch-visibility.test.ts packages/desktop/__test__/window-policy.test.ts packages/desktop/__test__/settings.test.ts packages/dashboard/__test__/boot-screen.test.ts(44 tests)yarn build:tsvp lintandvp fmt --checkon changed filesmlx-node Control Panelwindow onscreen on first launch and after reopening an existing singletonNote
Medium Risk
Changes macOS Electron lifecycle (activate, singleton, relaunch) and default window-on-launch behavior, but logic is isolated and covered by new unit tests.
Overview
Fixes cases where mlx-node stayed running with no visible Control Panel after launch, Finder/Dock open, or a second-instance attempt.
Desktop launch handling is centralized in
createLaunchVisibility: every process start is treated as an open request (no more inferring “first launch” from a missing settings file),activateandsecond-instancealways route through it (including when the Dock icon is hidden), early activations before async bootstrap are queued, and reopen intent during graceful shutdown is preserved viaapp.relaunch()instead of being lost to the singleton lock.window.tsconsolidates show/restore/focus/app.focus({ steal: true })in a sharedrevealpath for first paint and later activations.The dashboard adds an accessible boot screen in
index.html(inline styles + “Starting mlx-node…” before JS runs) and matches that placeholder inmain.tsxwhile waiting for the runtime port, avoiding a flash to an unstyled connecting message. New tests cover launch visibility and the boot screen.Reviewed by Cursor Bugbot for commit a363a09. Bugbot is set up for automated code reviews on this repo. Configure here.