Skip to content

fix(dashboard,desktop): align non-macOS titlebar and prevent silent single-instance downgrade - #447

Merged
Brooooooklyn merged 1 commit into
mainfrom
fix/windows-titlebar-and-upgrade-handoff
Nov 30, 2026
Merged

Brooooooklyn merged 1 commit into
mainfrom
fix/windows-titlebar-and-upgrade-handoff

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Contributor

Summary

Fixes two Windows desktop polish and upgrade issues in one PR:

1. Non-macOS titlebar alignment (packages/dashboard/ui)

  • Root cause: windowChromeOptions() only enables titleBarStyle: 'hiddenInset' on darwin (Windows/Linux use the native OS title bar), but TitleBar unconditionally rendered the 74 px .lights spacer and -webkit-app-region: drag on every OS, pushing the sidebar toggle button 80 px right.
  • Fix:
    • Added packages/dashboard/ui/src/lib/platform.ts (isMacPlatform / hasInsetTrafficLights, zero regexes, HappyDOM-deterministic).
    • TitleBar renders .lights, data-inset-lights, and ⌘ only when inset traffic lights are active; on Windows/Linux it omits .lights, shows Ctrl K, and uses padding-inline: 12px so the 16 px PanelLeft icon sits at [18px, 34px] (center 26px) — pixel-aligned with sidebar icons in expanded, rail, and narrow modes.
    • Scoped -webkit-app-region: drag and WindowDragStrip's 78px left inset to [data-inset-lights] while keeping .dragStrip mounted so onboarding.tsx's grid-rows-[40px_minmax(0,1fr)_auto] layout stays intact.

2. Windows upgrade & single-instance silent downgrade (packages/desktop)

  • Root cause: An older portable build (v0.0.24, mlx-node.exe in Downloads) stayed running in the tray holding %APPDATA%\mlx-node\lockfile. Installing v0.0.26 (Portato.exe) only checked $INSTDIR\Portato.exe, missed the running legacy copy, and on launch Portato.exe lost requestSingleInstanceLock(), focused 0.0.24, and silently exited.
  • Fix:
    • Windows NSIS installer (packages/desktop/scripts/windows-nsis.ts):
      • Added install-only StopOtherStandaloneApp before StopRunningApp install, using session-scoped PS_CHECK_OTHER_STANDALONE_SCRIPT (excludes $INSTDIR and *\WindowsApps\*, verifies sibling resources\app\package.json, 900 chars < 924 NSIS limit).
      • Skipped in /S silent mode; in interactive mode prompts with MB_RETRYCANCEL to quit the other copy cleanly from the system tray (no force-kill of external copies). Uninstall remains strictly $INSTDIR-only.
    • Electron single-instance handoff (packages/desktop/src/main/single-instance.ts, index.ts, launch-visibility.ts, broker.ts):
      • Passes SingleInstancePayload (protocol: 1) to requestSingleInstanceLock() and writes a per-owner instance-<pid>-<startedAt>.json in userData (kept on disk until app.releaseSingleInstanceLock() in will-quit/relaunch, then only its own unique file is unlinked).
      • On lock loss with no live post-fix owner: retries requestSingleInstanceLock once; if still held by a pre-fix (<= 0.0.26) copy, isolates userData to a temp dir before whenReady(), enriches with detectLegacyRunningVersion from ~/.mlx-node/ledger, and displays a clear warning instead of silently exiting.
      • On second-instance from a different executable: validates asynchronously off the main thread (realpath, 64 KiB bounded package.json manifest read, 1.5 s deadline, single-flight + pendingHandoffProbes wired to exitBlocked), derives version strictly from on-disk package.json, declines competing handoff if macOS Squirrel already has a staged update (updates.status() === 'ready'), prompts with safe defaultId: 0 (Keep current) showing Location, re-validates exact target identity (execPath, version, size, mtimeMs) before quit, and hands off via app.relaunch({ execPath, args: [] }).

Scope Notes

  • OS code-signature subprocess verification (Authenticode / codesign) and custom post-exit relauncher helpers are intentionally out of scope so unsigned local/CI builds and Linux .deb stay supported via Electron's standard app.relaunch({ execPath }).

Test Plan

  • tsc -b (full workspace) — pass
  • vp build packages/dashboard/ui --config packages/dashboard/ui/vite.config.ts — pass
  • vp lint packages/desktop packages/dashboard — 0 warnings, 0 errors (913 files)
  • vp fmt --check on all 16 modified/added files — pass
  • vp test across 11 suites (243/243 passed):
    • packages/dashboard/__test__/{title-bar,shell,middle-text,no-regex,onboarding}.test.ts
    • packages/desktop/__test__/{windows-nsis,single-instance,launch-visibility,app-name,broker,quit}.test.ts (including live Windows PowerShell 5.1 verification of the embedded StopOtherStandaloneApp command)

@coderabbitai

coderabbitai Bot commented Nov 30, 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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1c96837d-db9b-44b4-99b0-bda7843c6f05

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T08:07:38.339335Z d885206 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Brooooooklyn
Brooooooklyn merged commit fc4b9fe into main Nov 30, 2026
21 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/windows-titlebar-and-upgrade-handoff branch November 30, 2026 08:55
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