From 8431874b154e541295b74464dc12be603e930866 Mon Sep 17 00:00:00 2001 From: Tu Nombre Real Date: Mon, 22 Dec 2025 01:38:23 +0100 Subject: [PATCH] fix(macOS): remove redundant kickstart -k causing gateway restart loop The launchd bootstrap already starts the gateway job. The subsequent kickstart -k was killing it immediately after startup, and combined with KeepAlive=true, this caused a port-conflict restart loop where launchd would try to restart while the old instance was still shutting down. Symptoms: 'Bootstrap failed: 5: Input/output error' and repeated 'Gateway failed to start: another gateway instance is already listening' messages in the log. --- apps/macos/Sources/Clawdis/GatewayLaunchAgentManager.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/macos/Sources/Clawdis/GatewayLaunchAgentManager.swift b/apps/macos/Sources/Clawdis/GatewayLaunchAgentManager.swift index 4a222b3f2..4de7a9f01 100644 --- a/apps/macos/Sources/Clawdis/GatewayLaunchAgentManager.swift +++ b/apps/macos/Sources/Clawdis/GatewayLaunchAgentManager.swift @@ -36,7 +36,9 @@ enum GatewayLaunchAgentManager { ? "Failed to bootstrap gateway launchd job" : bootstrap.output.trimmingCharacters(in: .whitespacesAndNewlines) } - _ = await self.runLaunchctl(["kickstart", "-k", "gui/\(getuid())/\(gatewayLaunchdLabel)"]) + // Note: removed redundant `kickstart -k` that caused race condition. + // bootstrap already starts the job; kickstart -k would kill it immediately + // and with KeepAlive=true, cause a restart loop with port conflicts. return nil }