Skip to content

fix(macos): run the service from its own helper app so it is never the Driga app - #85

Merged
vishr merged 2 commits into
mainfrom
fix/service-helper-bundle
Oct 30, 2026
Merged

vishr merged 2 commits into
mainfrom
fix/service-helper-bundle

Conversation

@vishr

@vishr vishr commented Oct 30, 2026

Copy link
Copy Markdown
Member

What changed

The Driga service now runs from its own helper app inside the bundle: Driga.app/Contents/Helpers/Driga Service.app, with bundle ID run.driga.service and LSBackgroundOnly. It is no longer a second executable carrying the main app's identity. The launch agent, driga service install, upgrades, the build and signing scripts, release verification and GoReleaser are updated. Notifications are posted under the helper's identity, and clicking one opens the main app on its target.

Why

The service ran as Driga.app/Contents/MacOS/drigad with the app's bundle ID run.driga, so Launch Services treated it as the running Driga app. Spotlight, Finder and open -a Driga brought the windowless service forward instead of starting the app. An AppleEvent quit to run.driga quit the service. #82 set a prohibited activation policy, which held on first install but not after launchd restarted the service: lsappinfo reported type="Foreground" again, and Spotlight opened no window. A nested helper with its own identity is the standard macOS pattern and removes the ambiguity.

Risk and rollout

  • Notifications: macOS asks for notification permission once more, under "Driga Service". The docs say so.
  • Migration: driga service install and the app's upgrade rewrite the launch agent to the helper path, and the old Contents/MacOS/drigad is no longer shipped or run.
  • Signing: nested bundles are signed inside-out with the hardened runtime. verify-macos-app.py and verify-release-dist.sh check the helper's identity, plist keys and signature order. No notarization ran locally; the release workflow exercises it.
  • Nothing is written to agent settings, there is no new stored text, and no process signalling.

Contract changes

  • Bundle layout: Contents/MacOS/drigad is replaced by Contents/Helpers/Driga Service.app/Contents/MacOS/drigad (bundle ID run.driga.service). Anything that references the old path, such as custom launchd setups, must move.

Verified

  • Built the bundle locally and ran the helper's drigad with a temporary data dir. lsappinfo shows bundleID="run.driga.service" and type="BackgroundOnly", and System Events shows background only true, visible false. Notifications start with "native, not asked yet".
  • That run found a bug, fixed in this PR: AppKit returns NO when setting the policy an LSBackgroundOnly bundle already has, which disabled notifications. The check now reads the resulting activationPolicy.
  • go test passes for attention, service, scripts, self and cmd/driga. go test ./... fails only TestPermissionHookBuiltBinary (pre-existing on this Mac, fixed by fix(chat): register permission prompts before slow broker work #84 and the cleanup issue) and one TestCommandSandboxIntegration "scope changed" under full-suite load; this PR doesn't touch internal/command, and the test passes on rerun. GOOS=linux go build, GOOS=windows go vet.
  • Not verified here: real notarization, and open -a against an installed signed build. Both need the release pipeline and an install.
  • I have accepted the CLA, or will when the bot asks on my first pull request.

https://claude.ai/code/session_01T2vtcW6ihn1ywy9vxUq9a4

vishr added 2 commits October 30, 2026 09:55
…e Driga app

Package drigad in a nested background-only app with the run.driga.service
identity, matching release metadata, and Driga branding. Sign the helper
before the GUI bundle and validate both bundles in release archives.

Migrate launchd from the old same-bundle executable during service install,
GUI startup, and Homebrew upgrades. Preserve the installed service environment
during cask migration so custom data and configuration paths keep working.

Activate the main app on notification clicks and deliver the target through
the private stdin hand-off. Keep the GUI independent of the notification
callback deadline and query notification permission under the helper identity.
Document the new permission prompt and the manual Launch Services host check.

Validate with native, Linux, and Windows go vet; the requested package tests
in local time and UTC; helper, migration, signing, and notification regressions;
and Python compilation and shell syntax checks. No real notarization was run.

Claude-Session: https://claude.ai/code/session_01T2vtcW6ihn1ywy9vxUq9a4
Windows file systems have no execute permission bits, so the helper
plist test failed on the Windows CI job at the st_mode assertion.
@vishr
vishr merged commit 81cb086 into main Oct 30, 2026
8 checks passed
@vishr
vishr deleted the fix/service-helper-bundle branch October 30, 2026 19:35
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