Skip to content

fix(service): kickstart newly bootstrapped LaunchAgents - #1480

Merged
Teingi merged 1 commit into
oceanbase:masterfrom
knqiufan:codex/fix-macos-launchagent-start
Sep 7, 2026
Merged

fix(service): kickstart newly bootstrapped LaunchAgents#1480
Teingi merged 1 commit into
oceanbase:masterfrom
knqiufan:codex/fix-macos-launchagent-start

Conversation

@knqiufan

@knqiufan knqiufan commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

Closes #1479.

Rationale for this change

The macOS service adapter currently relies on launchctl bootstrap to 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?

  • Explicitly call launchctl kickstart after bootstrapping a new or replaced LaunchAgent.
  • Preserve the existing kickstart -k behavior for a loaded but inactive job.
  • Add a regression test that verifies a newly bootstrapped job is immediately kickstarted.

The plist's RunAtLoad and KeepAlive settings 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 install and 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 skipped
  • uv run pytest -q tests/test_service.py tests/test_service_bootstrap.py -k 'not unsafe_retry_state' — 96 passed, 5 skipped
  • uv run prek run -a
  • git diff --check

The 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.

@Teingi Teingi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Teingi
Teingi merged commit aa75916 into oceanbase:master Sep 7, 2026
17 checks passed
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.

bug(service): kickstart newly bootstrapped LaunchAgents

2 participants