▍ humdrum codex / ticktock v0.0.2
license AGPL-3.0

fix(deploy): enable agent before bootstrap + load -w fallback to survive launchctl I/O-error race

bd44e804b100c1595b491c95514e08a7a24884c5
Kevin Kortum <kevinkortum@me.com> · 2026-07-08 13:28

parent 8a235ef5

1 files changed

deploy/install-autotrack.sh +10 −1
@@ -26,7 +26,16 @@ sed -e "s#@TT@#${TT}#g" -e "s#@HOME@#${HOME}#g" \
   "$REPO/deploy/autotrack.plist.template" > "$PLIST"
 
 launchctl bootout "gui/$(id -u)/${LABEL}" 2>/dev/null || true
-launchctl bootstrap "gui/$(id -u)" "$PLIST"
+
+# `enable` clears the disabled/override state that otherwise makes bootstrap
+# fail with "Bootstrap failed: 5: Input/output error" right after a bootout.
+launchctl enable "gui/$(id -u)/${LABEL}" 2>/dev/null || true
+
+# bootstrap can still return "Input/output error" transiently after a bootout;
+# don't let set -e abort here — fall through to the load -w fallback and the
+# state check below, which recover rather than leaving no daemon in place.
+launchctl bootstrap "gui/$(id -u)" "$PLIST" 2>/dev/null \
+  || launchctl load -w "$PLIST" 2>/dev/null || true
 
 # bootout/bootstrap can race: bootout can return before the old job is fully
 # torn down, making bootstrap report success while the new job never reaches