Skip to content

fix(desktop): recreate window on second-instance relaunch#701

Merged
lefarcen merged 1 commit intomainfrom
fix/desktop-second-instance-window-recovery
Mar 31, 2026
Merged

fix(desktop): recreate window on second-instance relaunch#701
lefarcen merged 1 commit intomainfrom
fix/desktop-second-instance-window-recovery

Conversation

@mrcfps
Copy link
Copy Markdown
Contributor

@mrcfps mrcfps commented Mar 31, 2026

What

Recreate the desktop main window when a second app launch arrives after the original window has already been destroyed.

Why

Packaged Nexu can keep running as a background UIElement app with no remaining windows. In that state, clicking the app again triggers second-instance, but the existing handler only tried to focus an in-memory window reference and could not recover the UI.

How

  • add a second-instance fallback that calls createMainWindow() when mainWindow is missing or destroyed
  • keep the existing focus path for the normal already-open case
  • add a regression invariant test covering the no-window relaunch path

Affected areas

  • Desktop app (Electron shell)
  • Controller (backend / API)
  • Web dashboard (React UI)
  • OpenClaw runtime
  • Skills
  • Shared schemas / packages
  • Build / CI / Tooling

Checklist

  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes
  • pnpm generate-types run (if API routes/schemas changed)
  • No credentials or tokens in code or logs
  • No any types introduced (use unknown with narrowing)

Notes for reviewers

This only changes the second-instance recovery path. It does not change the packaged LSUIElement behavior.

@lefarcen lefarcen merged commit 479a2c7 into main Mar 31, 2026
12 checks passed
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.

2 participants