I'm looking for a supported way to launch a signed AppKit application for user interaction from a local Python supervisor, while retaining reliable supervision of the exact launched instance.
Environment
Apple M3 MacBook Air, macOS 14.5, build 23F79.
arm64 app built with Command Line Tools clang and the macOS 14.5 SDK, targeting macOS 14.0.
AppKit/Foundation with embedded CPython 3.12.
Apple Development signing, hardened runtime and strict signature checks passed.
Current launch and activation sequence
The supervisor directly launches the bundle executable with Popen: a fixed argument, empty environment, new process session, disconnected stdin, and an anonymous stdout pipe carrying fixed, nonsecret startup markers. There is no LaunchServices foreground handoff.
On its main thread, the app initializes NSApplication, confirms Regular activation policy, calls finishLaunching and activateIgnoringOtherApps:YES, then waits for isActive. Event-retrieval waits are capped at 20 ms; event dispatch itself may take longer. Existing timeout supervision remains active.
Our activation guard is two seconds from the readiness routine's start, subject to the remaining native timer. A separate overall test budget is 300 seconds from operator readiness, before preflight.
Observed result
The latest test exited with code 1 after approximately 2.57 seconds. The validated markers were:
absence.begin → absence.absent → fields.begin → ui.begin
→ app.shared.begin → app.shared.ready
→ policy.before → policy.already_regular → policy.postcondition
→ launch.finish.begin → launch.finish.ready
→ activation.requested → activation.wait.begin
→ stop.activation.timeoutThe final recorded state was:
main=1 app=1 active=0 policy=0 window=0 visible=-1 key=-1The app stopped before constructing the dialog. Adding event processing did not resolve activation. We have not established why activation failed or which events were delivered. The two-second deadline is our guard, not an asserted macOS activation guarantee.
Questions
What supported launch and activation approach should this supervisor use for a foreground, interactive AppKit app?
Can this direct-executable design be corrected narrowly, or should launching move to LaunchServices with a different communication and supervision arrangement?
With the recommended approach, how should the supervisor identify the exact launched instance, receive startup status, enforce bounded termination, and establish that the process has exited before cleanup?
We reviewed a simple foreground-launch substitution, but it did not preserve our existing marker pipe and authoritative exit/reap evidence. That is a limitation of our proposed adaptation, not a claim that Apple's APIs cannot support these outcomes.
The essential requirements are exact-instance identification, nonsecret status reporting, bounded termination and verified cleanup. An anonymous pipe and direct-child waiting are current implementation choices, not requirements in themselves.