Skip to content

fix: verify launchd server startup after install - #58

Closed
git-ksk wants to merge 1 commit into
CursorTouch:mainfrom
git-ksk:fix/launchd-startup-acceptance
Closed

fix: verify launchd server startup after install#58
git-ksk wants to merge 1 commit into
CursorTouch:mainfrom
git-ksk:fix/launchd-startup-acceptance

Conversation

@git-ksk

@git-ksk git-ksk commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Briefly verify a freshly bootstrapped launch agent instead of treating launchctl bootstrap success as server startup success.
  • Check launchd state before probing the configured TCP endpoint.
  • Fail fast on immediate exit status or terminating signal and point directly to server.error.log.
  • Keep verification bounded to 1 second; a still-running process is accepted without a long install-time wait.

Reproduction

A temporary LaunchAgent whose program exits immediately with status 78 reproduces the false positive: launchctl bootstrap returns 0, while launchctl print shortly afterward reports state = not running and last exit code = 78: EX_CONFIG.

A signal-terminated job is reported separately by launchd as last terminating signal = Terminated: 15, so startup acceptance needs to handle both forms.

Root cause

install previously checked only the return code from launchctl bootstrap. Bootstrap confirms that launchd accepted the job definition; it does not guarantee that the server process remained alive or reached its listen endpoint.

Validation

  • focused launchd tests: 7 passed
  • full suite: 326 passed
  • physical acceptance with isolated temporary LaunchAgents rejects both EX_CONFIG 78 and SIGTERM 15
  • the production com.macos-mcp.server LaunchAgent was not modified during failure-path acceptance
  • git diff --check: clean
  • no added line exceeds the repository's 100-character limit
  • ruff check .: 461 findings vs 462 on upstream/main (no new findings)
  • ruff format --check .: same 26 pre-existing unformatted files as upstream/main; the new test file is formatted

Non-changes

@git-ksk
git-ksk force-pushed the fix/launchd-startup-acceptance branch from c5e7ea7 to 4443190 Compare August 25, 2026 13:29
@git-ksk
git-ksk force-pushed the fix/launchd-startup-acceptance branch from 4443190 to acb3566 Compare August 25, 2026 13:32
@git-ksk

git-ksk commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Closing temporarily for a final pre-PR repository-guideline review. The branch is preserved; this will only be reopened after the final scope/style/test review is complete.

@git-ksk git-ksk closed this Aug 25, 2026
@git-ksk

git-ksk commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #63. The fork branch was amended after the contribution-guideline audit, and GitHub does not allow reopening this PR after that force-push.

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