Skip to content

fix(server): stop the macOS launch agent without bootout --wait - #3

Merged
657kbps merged 1 commit into
customizedfrom
fix/macos-launchd-bootout-wait
Nov 22, 2026
Merged

657kbps merged 1 commit into
customizedfrom
fix/macos-launchd-bootout-wait

Conversation

@657kbps

@657kbps 657kbps commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Problem

On macOS 15, launchctl bootout --wait gui/<uid>/com.t3tools.t3code.service is a usage error: launchctl treats --wait as a target and exits 64 without stopping the job. The launchd stop step is optional, so the failure was only logged, the old job kept the label, and the following launchctl bootstrap failed with EIO (exit 5). t3 update, t3 service install and t3 service restart all failed and left the old service running; t3 service uninstall removed the plist while the job stayed loaded.

Upstream report: pingdotgg#11995 (fix PR pingdotgg#26088 is still open).

Fix

launchdManager now runs a plain launchctl bootout <target> and then polls launchctl print <target> every 500 ms until the label is gone, within the existing 120 s stop timeout. A print that fails to run or times out keeps the wait going, and a bootout that returns EINPROGRESS (36) while the job drains through ExitTimeOut no longer lets bootstrap race it. The wait is a declarative waitWhile field on a command step, handled once in runSteps. The launchd stop and deactivate steps are no longer optional, so an agent still loaded at the deadline fails the command instead of bootstrapping over it or deleting its plist.

docs/operations/fork-changes.md records this as a temporary fork fix: when upstream's fix lands, a sync takes upstream's code instead of ours.

Verification

  • vp test run apps/server/src/cloud/bootService.test.ts — 66 passed. The launchd harness now models macOS 15 launchctl: --wait → 64, bootstrap over a loaded label → 5, draining bootout → 36, unloaded bootout → 3, print after removal → 113. New tests cover reinstall over a loaded agent, uninstall, waiting out a drain, a print timeout continuing the wait, and the stop deadline keeping the plist.
  • Against the pre-fix bootService.ts the same tests fail: 10 darwin tests, including the four new ones.
  • vp run check:changed passes: format, lint, knip, graphql, typecheck, tests, react compiler.
  • No Mac was available here, so the exit codes in the harness come from the report and launchctl's known behaviour. The change still needs one run on a real macOS host.

Model and harness: magpie/group/deepseek-flash via the sparrow harness.

macOS 15 rejects `launchctl bootout --wait` with a usage error, and the optional stop step ignored it, so the old job kept the label and the following bootstrap failed with EIO (exit 5). t3 update, t3 service install and t3 service restart all failed and left the old service running.

Boot the agent out with a plain `launchctl bootout`, then poll `launchctl print` until the label is gone within the stop timeout. That covers both a job draining through ExitTimeOut and macOS versions without the flag. The launchd test harness now models launchctl's exit codes (64, 5, 36, 3, 113).

Recorded in docs/operations/fork-changes.md: take upstream's fix once it lands.
@657kbps
657kbps merged commit 85c0052 into customized Nov 22, 2026
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