Skip to content

fix(darwin): admit running apps when Launch Services omits the start time - #36

Merged
caelaxie merged 3 commits into
mainfrom
caelaxie/admit-undated-apps
Sep 23, 2026
Merged

caelaxie merged 3 commits into
mainfrom
caelaxie/admit-undated-apps

Conversation

@caelaxie

@caelaxie caelaxie commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Why

macOS app lookup required NSRunningApplication.launchDate. Launch Services leaves that date nil for live apps it did not start, including dev Electron, Ollama, Finder, and some Python processes. Name, bundle id, and pid: queries then returned app_not_found even though the process was running. Refreshing the app list could not help, because the same check ran every time.

Scope

  • runningAppDescriptor uses app.launchDate ?? kernelProcessStartDate(pid:). Apps that already have a Launch Services date keep it, and the kernel call runs only when that date is missing.
  • A process with neither clock is still omitted.
  • listApps and appByPid share that function. Regular-app filtering and one-row-per-bundle-id dedupe are unchanged.

Verification

  • swift test --package-path native/macos — 56 tests passed.
  • On this Mac, 49 regular apps were running. 37 had a Launch Services date. The other 12 had a kernel start time, including Finder, Ollama (com.electron.ollama), Electron (com.github.Electron, pid 47709), and several org.python.python processes. The installed helper was not replaced, so this desktop check used the same clock the new function reads.

…time

NSRunningApplication.launchDate is nil for live apps the Mac did not launch
through Launch Services. listApps and pid lookup treated that as app_not_found.
Keep the Launch Services date when it exists, and use the kernel start time
otherwise, so process identity stays stable for the life of the pid.
…s it

The ?? at the call site skips proc_pidinfo for apps that already have a
launch date. The one-line combiner and the tests that pinned it are gone.
macos-15-intel compiles the universal release helper inside the packaging
beforeAll. On Node 24 that build finished, then Vitest stopped the hook at
300s before pnpm pack. Ten minutes covers the pack step that follows.
@caelaxie
caelaxie merged commit 7f363a5 into main Sep 23, 2026
9 checks passed
@caelaxie
caelaxie deleted the caelaxie/admit-undated-apps branch September 23, 2026 10:02
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