When an App Intent lives in the host app and runs the app intent “in the background” on macOS, it still launches the app and puts it in the Dock.

Technically that makes sense, because that’s just how Mac apps behave when launched. But it doesn’t really feel like background execution to me.

This can’t really be how it’s supposed to work, right?

My app gets launched just from opening a shortcut that uses one of my app’s actions, because Shortcuts runs an entity query to validate the selected entity. That feels like something that should happen quietly in the background, without surfacing the app in the Dock.

Even just opening a shortcut to edit it ends up launching my app, which seems off.

What am I doing wrong? 🤔

Now Shortcuts is no longer launching my app and I didn't change a line of code. It happened consistently ~25 times before and now it doesn't.

So... Is it a bug in Shortcuts? Is it a bug in my app caused by a race condition? 🤷‍♂️

I'll need to dig deeper.

My current theory is that it's either Shortcuts acting up or me setting an Activation Policy at an unfortunate time.

@simonbs My Maps Shortcuts that I have used for years have broken on iOS 26.4.
@edmn @simonbs Had to chop out a feature of my calendar shortcuts that gets the map url from a calendar entry as it recently started hanging. Anything to do with maps/locations and their URLs has been a total shit show for several years now.

@simonbs Things randomly not working or mysteriously hanging are key features of shortcuts.

If a day goes by without me having to debug one of my shortcuts - then it's a good day.

@simonbs not always true, its got to depend on some setting probably Activation Policy. I know because I wasted a good hour last night before realizing that the reason my Shortcut wasn't working was because the system launched a version of the app behind my back.

@paul Interesting! No combination of `supportedModes ` and `openAppWhenRun` seem to prevent my app from running on macOS.

Maybe setting a Activation Policy will do but then I’ll need to detect if the app is run from a shortcut or not and set an appropriate activation policy.

@simonbs FWIW this was Cocoa app…
@paul @simonbs There is definitely a special launch mode for background intents that hides the app on Mac. Drafts has many openAppWhenRun=false/supportedModes=[.background] intents that work that way and Drafts show up in Activity Monitor but not the Dock if it wasn’t already running.
@paul @simonbs Also AppKit. So maybe something in the SwiftUI lifecycle?
@agiletortoise @paul @simonbs Yes, in my experience with my AppKit app, if it gets launched in the background triggered by an intent, AppKit sets an activation policy if .prohibited. If it later gets foregrounded, then it switches the policy to .regular.