From 40c8e4832a72bb22c10f24bbdb5bf178115efb28 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 9 Dec 2025 03:58:28 +0100 Subject: [PATCH] WebChat: make tunnel restart handler hop to MainActor --- apps/macos/Sources/Clawdis/WebChatWindow.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/macos/Sources/Clawdis/WebChatWindow.swift b/apps/macos/Sources/Clawdis/WebChatWindow.swift index b6e4d405f..a46a5c9b1 100644 --- a/apps/macos/Sources/Clawdis/WebChatWindow.swift +++ b/apps/macos/Sources/Clawdis/WebChatWindow.swift @@ -134,11 +134,10 @@ final class WebChatWindowController: NSWindowController, WKNavigationDelegate { // Auto-restart on unexpected termination while window lives tunnel.process.terminationHandler = { [weak self] _ in - guard let self else { return } - guard self.tunnelRestartEnabled else { return } - webChatLogger.error("webchat tunnel terminated; restarting") Task { @MainActor [weak self] in guard let self else { return } + guard self.tunnelRestartEnabled else { return } + webChatLogger.error("webchat tunnel terminated; restarting") do { // Recreate the tunnel silently so the window keeps working without user intervention. let base = try await self.startOrRestartTunnel()