Fleet versions
- Discovered: Latest (observed on current FMA catalog with VS Code 1.111.0+)
- Reproduced: Latest
Web browser and operating system: macOS (Self Service / Fleet Desktop)
💥 Actual behavior
After updating VS Code via Self Service, the app launches automatically — even when the user didn't have it open. The install script's quit_and_track_application function detects VS Code as "running" due to persistent background helper processes (Code Helper, Code Helper (Renderer), Code Helper (GPU), Code Helper (Plugin)), marks APP_WAS_RUNNING=1, and relaunches the app after the file copy.
🛠️ To fix
Add a custom install script for VS Code (like Chrome, Slack, and Zoom already have at ee/maintained-apps/inputs/homebrew/scripts/) that verifies the app has visible windows via System Events before marking it for relaunch. This avoids changing the shared template that works correctly for all other apps.
The custom script should add a window count check after the osascript "is running" check:
osascript -e 'tell application "System Events"
set appRunning to (bundle identifier of processes) contains "com.microsoft.VSCode"
if not appRunning then return 0
return count of windows of (first process whose bundle identifier is "com.microsoft.VSCode")
end tell'
If window count is 0, skip quit and relaunch.
🧑💻 Steps to reproduce
These steps:
- Ensure VS Code is installed on a macOS host but closed (no visible windows)
- Check Self Service for a VS Code update
- Close VS Code if open, then start the update in Self Service
- After the update completes, VS Code launches automatically
🕯️ More info (optional)
Root cause: osascript -e "application id \"com.microsoft.VSCode\" is running" returns true when VS Code's Electron helper processes are active without a visible window. This is VS Code-specific — other apps don't have persistent background helpers that register as the parent app "running."
Reported by @headmin, confirmed by @allenhouchins (script output shows VS Code detected as running when it wasn't). osquery apps table on the affected host shows 4 helper sub-apps with recent last_opened_time values under com.microsoft.VSCode.helper bundle ID.
Fleet versions
Web browser and operating system: macOS (Self Service / Fleet Desktop)
💥 Actual behavior
After updating VS Code via Self Service, the app launches automatically — even when the user didn't have it open. The install script's
quit_and_track_applicationfunction detects VS Code as "running" due to persistent background helper processes (Code Helper, Code Helper (Renderer), Code Helper (GPU), Code Helper (Plugin)), marksAPP_WAS_RUNNING=1, and relaunches the app after the file copy.🛠️ To fix
Add a custom install script for VS Code (like Chrome, Slack, and Zoom already have at
ee/maintained-apps/inputs/homebrew/scripts/) that verifies the app has visible windows via System Events before marking it for relaunch. This avoids changing the shared template that works correctly for all other apps.The custom script should add a window count check after the
osascript "is running"check:If window count is 0, skip quit and relaunch.
🧑💻 Steps to reproduce
These steps:
🕯️ More info (optional)
Root cause:
osascript -e "application id \"com.microsoft.VSCode\" is running"returns true when VS Code's Electron helper processes are active without a visible window. This is VS Code-specific — other apps don't have persistent background helpers that register as the parent app "running."Reported by @headmin, confirmed by @allenhouchins (script output shows VS Code detected as running when it wasn't). osquery
appstable on the affected host shows 4 helper sub-apps with recentlast_opened_timevalues undercom.microsoft.VSCode.helperbundle ID.