Found in audit of main @ 06326e5. Three platform problems in bcc_core.pyrestart_claude_desktop() (~L1826–1905).
1. Linux — harmful and wrong target (worst of the three). _restart_claude_desktop_linux() runs pkill claude — no -x, so it substring-matches and can kill the user's running Claude Code CLI processes (active sessions, agents) and anything else with "claude" in the name. It then launches claude detached — which on Linux is the Claude Code CLI, not Claude Desktop; spawning it headless/detached does nothing useful. There is no official Claude Desktop for Linux.
Fix: at minimum use pkill -x against an actual desktop binary name and launch the real desktop entry point if one is configured; realistically, hide/disable the Restart button on Linux (gate _offer_restart_button() on platform) until there is a real target.
2. macOS — kill/relaunch race. pkill -x Claude is fire-and-forget and open -a Claude runs immediately after. If the old instance hasn't exited yet, open can re-activate the dying instance (config never reloaded) or the relaunch lands mid-teardown. Fix: after pkill, poll for process exit (e.g. pgrep -x Claude up to ~5 s) before open -a Claude. Run off the UI thread if the wait is added (button handler currently calls it synchronously — MainWindow._restart_claude_desktop).
3. Windows — relaunch fails for MSIX/Store installs.
Relaunch uses the Start-menu shortcut %APPDATA%\Microsoft\Windows\Start Menu\Programs\Claude.lnk. For an MSIX/Store install (which BCC now explicitly detects — see detect_msix_claude) that shortcut doesn't exist, so taskkill succeeds and the relaunch fails: BCC kills Claude and can't bring it back. Fix: check the shortcut exists before killing; if absent, try explorer.exe shell:AppsFolder\<PackageFamilyName>!App for the detected MSIX package, or refuse with a clear message instead of killing first.
Acceptance
Linux: Restart button never appears (or a correct implementation is proven); no pkill pattern that can match claude CLI processes remains.
macOS: restart waits for the old process to exit before relaunching (bounded); UI stays responsive.
Windows: when the shortcut is missing, Claude is not killed; either the MSIX launch path is used or the user gets an actionable error.
Unit tests for the decision logic (platform gating, shortcut-existence check) — process-level effects can stay untested.
**Found in audit of `main` @ 06326e5.** Three platform problems in `bcc_core.py` `restart_claude_desktop()` (~L1826–1905).
**1. Linux — harmful and wrong target (worst of the three).**
`_restart_claude_desktop_linux()` runs `pkill claude` — no `-x`, so it substring-matches and can kill the user's running **Claude Code CLI** processes (active sessions, agents) and anything else with "claude" in the name. It then launches `claude` detached — which on Linux is the Claude Code CLI, not Claude Desktop; spawning it headless/detached does nothing useful. There is no official Claude Desktop for Linux.
Fix: at minimum use `pkill -x` against an actual desktop binary name and launch the real desktop entry point if one is configured; realistically, hide/disable the Restart button on Linux (gate `_offer_restart_button()` on platform) until there is a real target.
**2. macOS — kill/relaunch race.**
`pkill -x Claude` is fire-and-forget and `open -a Claude` runs immediately after. If the old instance hasn't exited yet, `open` can re-activate the dying instance (config never reloaded) or the relaunch lands mid-teardown. Fix: after pkill, poll for process exit (e.g. `pgrep -x Claude` up to ~5 s) before `open -a Claude`. Run off the UI thread if the wait is added (button handler currently calls it synchronously — `MainWindow._restart_claude_desktop`).
**3. Windows — relaunch fails for MSIX/Store installs.**
Relaunch uses the Start-menu shortcut `%APPDATA%\Microsoft\Windows\Start Menu\Programs\Claude.lnk`. For an MSIX/Store install (which BCC now explicitly detects — see `detect_msix_claude`) that shortcut doesn't exist, so `taskkill` succeeds and the relaunch fails: BCC kills Claude and can't bring it back. Fix: check the shortcut exists **before** killing; if absent, try `explorer.exe shell:AppsFolder\<PackageFamilyName>!App` for the detected MSIX package, or refuse with a clear message instead of killing first.
**Acceptance**
- Linux: Restart button never appears (or a correct implementation is proven); no `pkill` pattern that can match `claude` CLI processes remains.
- macOS: restart waits for the old process to exit before relaunching (bounded); UI stays responsive.
- Windows: when the shortcut is missing, Claude is **not** killed; either the MSIX launch path is used or the user gets an actionable error.
- Unit tests for the decision logic (platform gating, shortcut-existence check) — process-level effects can stay untested.
the_og
added the P1 label 2026-07-12 12:44:12 -04:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Found in audit of
main@06326e5. Three platform problems inbcc_core.pyrestart_claude_desktop()(~L1826–1905).1. Linux — harmful and wrong target (worst of the three).
_restart_claude_desktop_linux()runspkill claude— no-x, so it substring-matches and can kill the user's running Claude Code CLI processes (active sessions, agents) and anything else with "claude" in the name. It then launchesclaudedetached — which on Linux is the Claude Code CLI, not Claude Desktop; spawning it headless/detached does nothing useful. There is no official Claude Desktop for Linux.Fix: at minimum use
pkill -xagainst an actual desktop binary name and launch the real desktop entry point if one is configured; realistically, hide/disable the Restart button on Linux (gate_offer_restart_button()on platform) until there is a real target.2. macOS — kill/relaunch race.
pkill -x Claudeis fire-and-forget andopen -a Clauderuns immediately after. If the old instance hasn't exited yet,opencan re-activate the dying instance (config never reloaded) or the relaunch lands mid-teardown. Fix: after pkill, poll for process exit (e.g.pgrep -x Claudeup to ~5 s) beforeopen -a Claude. Run off the UI thread if the wait is added (button handler currently calls it synchronously —MainWindow._restart_claude_desktop).3. Windows — relaunch fails for MSIX/Store installs.
Relaunch uses the Start-menu shortcut
%APPDATA%\Microsoft\Windows\Start Menu\Programs\Claude.lnk. For an MSIX/Store install (which BCC now explicitly detects — seedetect_msix_claude) that shortcut doesn't exist, sotaskkillsucceeds and the relaunch fails: BCC kills Claude and can't bring it back. Fix: check the shortcut exists before killing; if absent, tryexplorer.exe shell:AppsFolder\<PackageFamilyName>!Appfor the detected MSIX package, or refuse with a clear message instead of killing first.Acceptance
pkillpattern that can matchclaudeCLI processes remains.