fix(service): kickstart newly bootstrapped LaunchAgents - #1480
Merged
Teingi merged 1 commit intoSep 7, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue or RFC does this PR close?
Closes #1479.
Rationale for this change
The macOS service adapter currently relies on
launchctl bootstrapto both register and immediately start a LaunchAgent. Registration can succeed without a process becoming active, so installs and explicit restarts intermittently wait for the HTTP endpoint until they time out. This has reproduced in several native macOS workflow runs, including #1459.What changes are included in this PR?
launchctl kickstartafter bootstrapping a new or replaced LaunchAgent.kickstart -kbehavior for a loaded but inactive job.The plist's
RunAtLoadandKeepAlivesettings remain responsible for login startup and recovery. This change makes an explicit install/start request deterministic and surfaces a launchd start error immediately.Are there any user-facing changes?
On macOS,
powercontext service installand explicit service restart now reliably start the personal Server immediately after registration. There are no public API, configuration, or persisted-format changes.How was this change tested?
uv run pytest -q tests/test_service.py -k launchd— 23 passed, 1 skippeduv run pytest -q tests/test_service.py tests/test_service_bootstrap.py -k 'not unsafe_retry_state'— 96 passed, 5 skippeduv run prek run -agit diff --checkThe repository's native-service workflow will exercise the complete install, stop, restart, and uninstall lifecycle on a real macOS LaunchAgent.
AI usage statement
OpenAI Codex was used to inspect the failing CI artifacts and historical runs, identify the launchd lifecycle race, implement the change, and run the listed validation. The resulting diff and test evidence were reviewed before submission.