Repository navigation
fix(server): stop the macOS launch agent without bootout --wait - #3
Merged
Merged
Conversation
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.
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.
Problem
On macOS 15,
launchctl bootout --wait gui/<uid>/com.t3tools.t3code.serviceis a usage error: launchctl treats--waitas 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 followinglaunchctl bootstrapfailed with EIO (exit 5).t3 update,t3 service installandt3 service restartall failed and left the old service running;t3 service uninstallremoved the plist while the job stayed loaded.Upstream report: pingdotgg#11995 (fix PR pingdotgg#26088 is still open).
Fix
launchdManagernow runs a plainlaunchctl bootout <target>and then pollslaunchctl print <target>every 500 ms until the label is gone, within the existing 120 s stop timeout. Aprintthat fails to run or times out keeps the wait going, and abootoutthat returns EINPROGRESS (36) while the job drains through ExitTimeOut no longer letsbootstraprace it. The wait is a declarativewaitWhilefield on a command step, handled once inrunSteps. 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.mdrecords 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,bootstrapover a loaded label → 5, drainingbootout→ 36, unloadedbootout→ 3,printafter removal → 113. New tests cover reinstall over a loaded agent, uninstall, waiting out a drain, aprinttimeout continuing the wait, and the stop deadline keeping the plist.bootService.tsthe same tests fail: 10 darwin tests, including the four new ones.vp run check:changedpasses: format, lint, knip, graphql, typecheck, tests, react compiler.Model and harness: magpie/group/deepseek-flash via the sparrow harness.