Skip to content

fix(desktop): surface control panel on launch - #110

Merged
Brooooooklyn merged 1 commit into
mainfrom
fix/desktop-launch-visibility
Jul 31, 2026
Merged

Brooooooklyn merged 1 commit into
mainfrom
fix/desktop-launch-visibility

Conversation

@Brooooooklyn

@Brooooooklyn Brooooooklyn commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • open and foreground the Control Panel on process launch, Finder/Dock activation, and second-instance requests
  • carry a reopen request across graceful shutdown instead of losing it to the singleton lock
  • paint an accessible loading screen before the dashboard bundle/runtime connection is ready

Root cause

The app inferred “first launch” from a missing settings file and ignored macOS activate events when showInDock was 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:ts
  • targeted vp lint and vp fmt --check on changed files
  • packaged Electron smoke test with isolated user data: CoreGraphics confirmed the mlx-node Control Panel window onscreen on first launch and after reopening an existing singleton

Note

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), activate and second-instance always 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 via app.relaunch() instead of being lost to the singleton lock. window.ts consolidates show/restore/focus/app.focus({ steal: true }) in a shared reveal path 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 in main.tsx while 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.

@Brooooooklyn
Brooooooklyn marked this pull request as ready for review July 31, 2026 15:12
@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0d00e8d8-d590-4182-a27b-2ba9da5de6b6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Jul 31, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@Brooooooklyn
Brooooooklyn enabled auto-merge (squash) July 31, 2026 15:13
@Brooooooklyn
Brooooooklyn merged commit 5447ded into main Jul 31, 2026
7 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/desktop-launch-visibility branch July 31, 2026 15:48
robert-johansson pushed a commit to robert-johansson/mlx-node that referenced this pull request Aug 2, 2026
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]>
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