fix: harden restart_claude_desktop — Linux refusal, macOS quit-wait, Windows MSIX guard (#33) #43

Merged
the_og merged 1 commits from fix/33-restart-hardening into main 2026-07-12 13:00:30 -04:00
Owner

Closes #33.

  • Linux / unsupported platforms: restart_claude_desktop() now refuses outright. The old path ran pkill claude (substring match — could kill running Claude Code CLI sessions) and then spawned the CLI detached, which is not a desktop app. New restart_supported() gates the GUI button so it never appears on Linux.
  • macOS: after pkill -x Claude, poll pgrep for actual process exit (≤5 s) before open -a Claudeopen against a dying instance can just re-activate it and the config is only re-read on a true relaunch. Because this can now block, the GUI runs it via a new RestartWorker QThread (button shows "Restarting…").
  • Windows: verify the Start-menu Claude.lnk exists before taskkill — an MSIX/Store install (which BCC now detects, #29) has no shortcut there, and the old order killed Claude with no way to relaunch it.

Existing restart tests updated to the new semantics; 6 new tests (platform gating, refuse-before-kill, quit-wait timeout and success paths). 172 tests pass; ruff clean.

🤖 Generated with Claude Code

Closes #33. - **Linux / unsupported platforms**: `restart_claude_desktop()` now refuses outright. The old path ran `pkill claude` (substring match — could kill running Claude Code CLI sessions) and then spawned the CLI detached, which is not a desktop app. New `restart_supported()` gates the GUI button so it never appears on Linux. - **macOS**: after `pkill -x Claude`, poll `pgrep` for actual process exit (≤5 s) before `open -a Claude` — `open` against a dying instance can just re-activate it and the config is only re-read on a true relaunch. Because this can now block, the GUI runs it via a new `RestartWorker` QThread (button shows "Restarting…"). - **Windows**: verify the Start-menu `Claude.lnk` exists **before** `taskkill` — an MSIX/Store install (which BCC now detects, #29) has no shortcut there, and the old order killed Claude with no way to relaunch it. Existing restart tests updated to the new semantics; 6 new tests (platform gating, refuse-before-kill, quit-wait timeout and success paths). 172 tests pass; ruff clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
the_og added 1 commit 2026-07-12 12:59:39 -04:00
fix: harden restart_claude_desktop across platforms (#33)
CI / Lint (ruff) (pull_request) Successful in 7s
CI / Tests (py3.10) (pull_request) Successful in 9s
CI / Tests (py3.12) (pull_request) Successful in 10s
c493aa0c84
- Linux (and any non-desktop platform): refuse instead of 'pkill claude',
  which substring-matched running Claude Code CLI sessions and relaunched
  the CLI, not a desktop app. New restart_supported() gates the button.
- macOS: wait (<=5s) for the old instance to exit before 'open -a Claude'
  so the relaunch can't re-activate the dying process. Runs off the UI
  thread via a RestartWorker.
- Windows: verify the Start-menu shortcut exists BEFORE taskkill, so an
  MSIX/Store install is never killed without a relaunch path.

Closes #33

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
the_og merged commit 6dacc26057 into main 2026-07-12 13:00:30 -04:00
the_og deleted branch fix/33-restart-hardening 2026-07-12 13:00:30 -04:00
Sign in to join this conversation.