Skip to content

fix: open the app from Spotlight while the service runs, and count disk cleanup as reclaimable - #82

Merged
vishr merged 1 commit into
mainfrom
fix/service-background-app
Oct 30, 2026
Merged

vishr merged 1 commit into
mainfrom
fix/service-background-app

Conversation

@vishr

@vishr vishr commented Oct 30, 2026

Copy link
Copy Markdown
Member

What changed

Two fixes from using v2026.10.22-alpha. Opening Driga from Spotlight, Finder or open -a now starts the app instead of focusing the windowless service. The header's Reclaimable tile now shows the disk a cleanup would free, measured in the background, instead of always 0.

Why

  • Spotlight: drigad runs from inside Driga.app with its bundle identity, for notifications. lsappinfo listed it as type="Foreground", and System Events as visible, so Launch Services activated it instead of launching the app. Its setActivationPolicy: call ran off the main thread and asked for Accessory. It now asks for Prohibited (background-only) on the main thread. Routing notifications through the GUI was rejected: the service must notify while the app is closed.
  • Reclaimable: the tile summed orphan process memory, the same number as Leftover. It now sums size_bytes of ready cleanup candidates. Sizes were only measured on demand (--sizes), so the app measures ready candidates off the request path: two walks at a time, the existing 30 s cap, refreshed about every 10 minutes. It shows unknown until measured.

Risk and rollout

  • No migration, and nothing written to agent settings.
  • New background disk walks, limited to ready candidates with bounded concurrency and the existing per-walk cap. Report-only and refused candidates are never walked.
  • A header saved by an earlier build keeps its old reclaim widget until the header is reset.

Contract changes

  • The shipped header's reclaim widget is now cleanup sum:size_bytes where status = ready, instead of summary sum:reclaim_bytes. summary.reclaim_bytes itself is unchanged.

Verified

  • Built the bundle on macOS 27.0.1 and ran its drigad with a temporary data dir: lsappinfo reports type="BackgroundOnly", and System Events reports background only true, visible false. Notification status reports native, not yet asked.
  • Against real data through driga dev serve, Reclaimable was unknown at 10 s and 183,810,516 bytes at 20 s. That matches driga cleanup list --kind scratch --sizes for the 12 ready candidates exactly.
  • go test ./... passes except TestPermissionHookBuiltBinary (fails on main on this Mac) and one TestExternalPeersListenerSelf timeout. That test is in a package this PR doesn't touch, and it passed on two reruns. GOOS=linux go build ./... and GOOS=windows go vet ./... pass.
  • UI: lint, 210 unit tests, bun run design-check 1,212 browser tests.
  • I have accepted the CLA, or will when the bot asks on my first pull request.

https://claude.ai/code/session_01T2vtcW6ihn1ywy9vxUq9a4

…sk cleanup as reclaimable

Opening Driga from Spotlight, Finder or `open -a` showed no window. The
service runs from inside Driga.app with the app's bundle identity so it
can post notifications, and it registered with Launch Services as a
visible foreground app. Launch Services then activated the windowless
service instead of starting the app. The service now sets the prohibited
(background-only) activation policy on the main thread, so it never
counts as the running app; notifications keep working.

The header's Reclaimable tile always read 0. It summed the memory of
leftover process trees, the same number Leftover shows, while Chat
reported disk a cleanup would free. Reclaimable now sums the size of
cleanup candidates that are ready to remove. Sizes were only measured on
demand, so the app measures ready candidates in the background, two at a
time with the existing 30 s cap, refreshing about every 10 minutes. The
tile shows unknown, not 0, until every ready candidate is measured.

Claude-Session: https://claude.ai/code/session_01T2vtcW6ihn1ywy9vxUq9a4
@vishr
vishr merged commit 55fe80f into main Oct 30, 2026
7 checks passed
@vishr
vishr deleted the fix/service-background-app branch October 30, 2026 15:46
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