惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tailwind CSS Blog
MyScale Blog
MyScale Blog
博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
雷峰网
雷峰网
罗磊的独立博客
小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Cloudflare Blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
博客园 - 司徒正美
Last Week in AI
Last Week in AI
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
量子位
宝玉的分享
宝玉的分享

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(macos): repair stale gateway tls pins (#75038) · open...
ngutman · 2026-04-30 · via Recent Commits to openclaw:main

@@ -10,6 +10,7 @@ final class MacNodeModeCoordinator {

1010

private var task: Task<Void, Never>?

1111

private let runtime = MacNodeRuntime()

1212

private let session = GatewayNodeSession()

13+

private var autoRepairedTLSFingerprintsByStoreKey: [String: String] = [:]

13141415

func start() {

1516

guard self.task == nil else { return }

@@ -58,8 +59,10 @@ final class MacNodeModeCoordinator {

5859

try? await Task.sleep(nanoseconds: 200_000_000)

5960

}

606162+

var attemptedURL: URL?

6163

do {

6264

let config = try await GatewayEndpointStore.shared.requireConfig()

65+

attemptedURL = config.url

6366

let caps = self.currentCaps()

6467

let commands = self.currentCommands(caps: caps)

6568

let permissions = await self.currentPermissions()

@@ -109,6 +112,10 @@ final class MacNodeModeCoordinator {

109112

retryDelay = 1_000_000_000

110113

try? await Task.sleep(nanoseconds: 1_000_000_000)

111114

} catch {

115+

if await self.autoRepairStaleTLSPinIfNeeded(error: error, url: attemptedURL) {

116+

retryDelay = 1_000_000_000

117+

continue

118+

}

112119

self.logger.error("mac node gateway connect failed: \(error.localizedDescription, privacy: .public)")

113120

try? await Task.sleep(nanoseconds: min(retryDelay, 10_000_000_000))

114121

retryDelay = min(retryDelay * 2, 10_000_000_000)

@@ -188,11 +195,49 @@ final class MacNodeModeCoordinator {

188195

Self.resolvedCommands(caps: caps)

189196

}

190197198+

nonisolated static func tlsPinStoreKey(for url: URL) -> String {

199+

let host = url.host?.trimmingCharacters(in: .whitespacesAndNewlines).nonEmpty ?? "gateway"

200+

let port = url.port ?? 443

201+

return "\(host):\(port)"

202+

}

203+204+

nonisolated static func shouldAutoRepairStaleTLSPin(url: URL, failure: GatewayTLSValidationFailure) -> Bool {

205+

guard failure.kind == .pinMismatch else { return false }

206+

guard url.scheme?.lowercased() == "wss" else { return false }

207+

guard failure.storeKey == nil || failure.storeKey == self.tlsPinStoreKey(for: url) else { return false }

208+

guard let host = url.host?.trimmingCharacters(in: .whitespacesAndNewlines).lowercased(), !host.isEmpty

209+

else { return false }

210+211+

if LoopbackHost.isLoopback(host) {

212+

return failure.systemTrustOk

213+

}

214+215+

// Tailscale Serve uses publicly trusted, rotating certificates for *.ts.net names.

216+

// A stale legacy leaf pin should not leave the companion app half-connected forever.

217+

if host == "ts.net" || host.hasSuffix(".ts.net") {

218+

return failure.systemTrustOk

219+

}

220+221+

return false

222+

}

223+224+

private func autoRepairStaleTLSPinIfNeeded(error: Error, url: URL?) async -> Bool {

225+

guard let tlsError = error as? GatewayTLSValidationError, let url else { return false }

226+

guard Self.shouldAutoRepairStaleTLSPin(url: url, failure: tlsError.failure) else { return false }

227+

let storeKey = tlsError.failure.storeKey ?? Self.tlsPinStoreKey(for: url)

228+

guard let observedFingerprint = tlsError.failure.observedFingerprint else { return false }

229+

guard self.autoRepairedTLSFingerprintsByStoreKey[storeKey] != observedFingerprint else { return false }

230+231+

guard GatewayTLSStore.replaceFingerprint(observedFingerprint, stableID: storeKey) else { return false }

232+

self.autoRepairedTLSFingerprintsByStoreKey[storeKey] = observedFingerprint

233+

self.logger.info("replaced stale gateway TLS pin storeKey=\(storeKey, privacy: .public)")

234+

await self.session.disconnect()

235+

return true

236+

}

237+191238

private func buildSessionBox(url: URL) -> WebSocketSessionBox? {

192239

guard url.scheme?.lowercased() == "wss" else { return nil }

193-

let host = url.host ?? "gateway"

194-

let port = url.port ?? 443

195-

let stableID = "\(host):\(port)"

240+

let stableID = Self.tlsPinStoreKey(for: url)

196241

let stored = GatewayTLSStore.loadFingerprint(stableID: stableID)

197242

let params = GatewayTLSParams(

198243

required: true,