fix(macos): await-safe session key selection

This commit is contained in:
Peter Steinberger
2025-12-30 11:07:34 +01:00
parent f86772f26c
commit 0d95d63258

View File

@@ -291,9 +291,13 @@ actor TalkModeRuntime {
await self.reloadConfig()
guard self.isCurrent(gen) else { return }
let prompt = self.buildPrompt(transcript: transcript)
let sessionKey =
await MainActor.run { WebChatManager.shared.activeSessionKey } ??
await GatewayConnection.shared.mainSessionKey()
let activeSessionKey = await MainActor.run { WebChatManager.shared.activeSessionKey }
let sessionKey: String
if let activeSessionKey {
sessionKey = activeSessionKey
} else {
sessionKey = await GatewayConnection.shared.mainSessionKey()
}
let runId = UUID().uuidString
let startedAt = Date().timeIntervalSince1970
self.logger.info(