From 30ca87094d55d1532a851534e282ced1e1c8e942 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 22 Jan 2026 06:34:41 +0000 Subject: [PATCH] fix: macOS auto bind loopback-first --- CHANGELOG.md | 1 + apps/macos/Sources/Clawdbot/GatewayEndpointStore.swift | 5 +---- apps/macos/Sources/ClawdbotMacCLI/ConnectCommand.swift | 2 +- .../Tests/ClawdbotIPCTests/GatewayEndpointStoreTests.swift | 6 +++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e14fb7fc7..e1520f2f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ Docs: https://docs.clawd.bot - OpenCode Zen: route models to the Zen API shape per family so proxy endpoints are used. (#1416) - Browser: suppress Chrome restore prompts for managed profiles. (#1419) Thanks @jamesgroat. - Models: inherit session model overrides in thread/topic sessions (Telegram topics, Slack/Discord threads). (#1376) +- macOS: keep local auto bind loopback-first; only use tailnet when bind=tailnet. - macOS: include Textual syntax highlighting resources in packaged app to prevent chat crashes. (#1362) - Cron: cap reminder context history to 10 messages and honor `contextMessages`. (#1103) Thanks @mkbehr. - Exec approvals: treat main as the default agent + migrate legacy default allowlists. (#1417) Thanks @czekaj. diff --git a/apps/macos/Sources/Clawdbot/GatewayEndpointStore.swift b/apps/macos/Sources/Clawdbot/GatewayEndpointStore.swift index 6a5f02ca0..418d0b810 100644 --- a/apps/macos/Sources/Clawdbot/GatewayEndpointStore.swift +++ b/apps/macos/Sources/Clawdbot/GatewayEndpointStore.swift @@ -482,7 +482,7 @@ actor GatewayEndpointStore { let bind = GatewayEndpointStore.resolveGatewayBindMode( root: root, env: ProcessInfo.processInfo.environment) - guard bind == "auto" else { return nil } + guard bind == "tailnet" else { return nil } let currentHost = currentURL.host?.lowercased() ?? "" guard currentHost == "127.0.0.1" || currentHost == "localhost" else { return nil } @@ -562,9 +562,6 @@ actor GatewayEndpointStore { case "tailnet": return tailscaleIP ?? "127.0.0.1" case "auto": - if let tailscaleIP, !tailscaleIP.isEmpty { - return tailscaleIP - } return "127.0.0.1" case "custom": return customBindHost ?? "127.0.0.1" diff --git a/apps/macos/Sources/ClawdbotMacCLI/ConnectCommand.swift b/apps/macos/Sources/ClawdbotMacCLI/ConnectCommand.swift index 91bac16cf..4df1c96a1 100644 --- a/apps/macos/Sources/ClawdbotMacCLI/ConnectCommand.swift +++ b/apps/macos/Sources/ClawdbotMacCLI/ConnectCommand.swift @@ -309,7 +309,7 @@ private func resolveLocalHost(bind: String?) -> String { let normalized = (bind ?? "").trimmingCharacters(in: .whitespacesAndNewlines).lowercased() let tailnetIP = detectTailnetIPv4() switch normalized { - case "tailnet", "auto": + case "tailnet": return tailnetIP ?? "127.0.0.1" default: return "127.0.0.1" diff --git a/apps/macos/Tests/ClawdbotIPCTests/GatewayEndpointStoreTests.swift b/apps/macos/Tests/ClawdbotIPCTests/GatewayEndpointStoreTests.swift index 11c9ec158..3513388a2 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/GatewayEndpointStoreTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/GatewayEndpointStoreTests.swift @@ -140,14 +140,14 @@ import Testing #expect(resolved.mode == .remote) } - @Test func resolveLocalGatewayHostPrefersTailnetForAuto() { + @Test func resolveLocalGatewayHostUsesLoopbackForAutoEvenWithTailnet() { let host = GatewayEndpointStore._testResolveLocalGatewayHost( bindMode: "auto", tailscaleIP: "100.64.1.2") - #expect(host == "100.64.1.2") + #expect(host == "127.0.0.1") } - @Test func resolveLocalGatewayHostFallsBackToLoopbackForAuto() { + @Test func resolveLocalGatewayHostUsesLoopbackForAutoWithoutTailnet() { let host = GatewayEndpointStore._testResolveLocalGatewayHost( bindMode: "auto", tailscaleIP: nil)