Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix(macos): move the host to the new version after an app upgrade

leepokai9074da3e30a7
diff --git a/apps/macos/App/HostController.swift b/apps/macos/App/HostController.swift
index 7ec1045e..585a5071 100644
--- a/apps/macos/App/HostController.swift
+++ b/apps/macos/App/HostController.swift
@@ -64,6 +64,8 @@ final class HostController {
private var deferred: Set<String> = []
private var streamTask: Task<Void, Never>?
+ /// Set once the service was moved onto this app's host because it ran another version.
+ private var replacedStaleHost = false
init(account: AccountSession) {
#if DEBUG
@@ -493,6 +495,14 @@ final class HostController {
guard let token = readToken(), let health = await HostHealth.fetch(Self.baseURL), let id = health.computerId else {
return false
}
+ // An upgrade (Homebrew, a new DMG) replaced the app while the old host kept running.
+ if Self.devPort == nil, !replacedStaleHost, let running = health.version,
+ running != Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String {
+ log.info("Host \(running, privacy: .public) differs from the app's; reinstalling the service")
+ replacedStaleHost = true
+ install()
+ return false
+ }
if local?.id == id, localToken == token, store != nil { return true }
guard let hello = try? await HostClient(baseURL: Self.baseURL, token: token).hello(),
hello.computerId == id, let signKey = hello.signKey else { return false }