fix: macOS auto bind loopback-first

This commit is contained in:
Peter Steinberger 2026-01-22 06:34:41 +00:00
parent 98ab2b4eae
commit 30ca87094d
4 changed files with 6 additions and 8 deletions

View File

@ -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) - 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. - 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) - 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) - 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. - 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. - Exec approvals: treat main as the default agent + migrate legacy default allowlists. (#1417) Thanks @czekaj.

View File

@ -482,7 +482,7 @@ actor GatewayEndpointStore {
let bind = GatewayEndpointStore.resolveGatewayBindMode( let bind = GatewayEndpointStore.resolveGatewayBindMode(
root: root, root: root,
env: ProcessInfo.processInfo.environment) env: ProcessInfo.processInfo.environment)
guard bind == "auto" else { return nil } guard bind == "tailnet" else { return nil }
let currentHost = currentURL.host?.lowercased() ?? "" let currentHost = currentURL.host?.lowercased() ?? ""
guard currentHost == "127.0.0.1" || currentHost == "localhost" else { return nil } guard currentHost == "127.0.0.1" || currentHost == "localhost" else { return nil }
@ -562,9 +562,6 @@ actor GatewayEndpointStore {
case "tailnet": case "tailnet":
return tailscaleIP ?? "127.0.0.1" return tailscaleIP ?? "127.0.0.1"
case "auto": case "auto":
if let tailscaleIP, !tailscaleIP.isEmpty {
return tailscaleIP
}
return "127.0.0.1" return "127.0.0.1"
case "custom": case "custom":
return customBindHost ?? "127.0.0.1" return customBindHost ?? "127.0.0.1"

View File

@ -309,7 +309,7 @@ private func resolveLocalHost(bind: String?) -> String {
let normalized = (bind ?? "").trimmingCharacters(in: .whitespacesAndNewlines).lowercased() let normalized = (bind ?? "").trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
let tailnetIP = detectTailnetIPv4() let tailnetIP = detectTailnetIPv4()
switch normalized { switch normalized {
case "tailnet", "auto": case "tailnet":
return tailnetIP ?? "127.0.0.1" return tailnetIP ?? "127.0.0.1"
default: default:
return "127.0.0.1" return "127.0.0.1"

View File

@ -140,14 +140,14 @@ import Testing
#expect(resolved.mode == .remote) #expect(resolved.mode == .remote)
} }
@Test func resolveLocalGatewayHostPrefersTailnetForAuto() { @Test func resolveLocalGatewayHostUsesLoopbackForAutoEvenWithTailnet() {
let host = GatewayEndpointStore._testResolveLocalGatewayHost( let host = GatewayEndpointStore._testResolveLocalGatewayHost(
bindMode: "auto", bindMode: "auto",
tailscaleIP: "100.64.1.2") 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( let host = GatewayEndpointStore._testResolveLocalGatewayHost(
bindMode: "auto", bindMode: "auto",
tailscaleIP: nil) tailscaleIP: nil)