Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

fix(endpoint): recover loaded forwarders during postinstall

shukieshah2fb71be2a6e4
diff --git a/packaging/macos/scripts/postinstall b/packaging/macos/scripts/postinstall
index 7329d953..49a7ad6c 100755
--- a/packaging/macos/scripts/postinstall
+++ b/packaging/macos/scripts/postinstall
@@ -50,6 +50,16 @@ restore_existing_forwarder() {
return 0
fi
+ out="$(launchctl bootout "$target" 2>&1)" || {
+ echo "Warning: launchctl bootout retry failed for $label: $out" >&2
+ }
+ out="$(launchctl bootstrap system "$plist_path" 2>&1)" || {
+ echo "Warning: launchctl bootstrap after bootout failed for $label: $out" >&2
+ }
+ if forwarder_running "$label"; then
+ return 0
+ fi
+
out="$(launchctl kickstart -k "$target" 2>&1)" || {
echo "Warning: launchctl kickstart retry failed for $label: $out" >&2
}
diff --git a/packaging/macos/test-endpoint-scripts.sh b/packaging/macos/test-endpoint-scripts.sh
index 0add24ca..6236f3a9 100644
--- a/packaging/macos/test-endpoint-scripts.sh
+++ b/packaging/macos/test-endpoint-scripts.sh
@@ -37,6 +37,10 @@ if ! grep -q 'launchctl kickstart -k' "$ROOT_DIR/packaging/macos/scripts/postins
echo "postinstall should kickstart already-loaded forwarders" >&2
exit 1
fi
+if ! grep -q 'launchctl bootout "$target"' "$ROOT_DIR/packaging/macos/scripts/postinstall"; then
+ echo "postinstall should recover loaded-but-stuck forwarders with bootout" >&2
+ exit 1
+fi
if ! grep -q 'could not restore existing forwarder' "$ROOT_DIR/packaging/macos/scripts/postinstall"; then
echo "postinstall should fail loudly when an existing forwarder cannot be restored" >&2
exit 1