mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 08:08:23 +00:00
Chat UI: accept canonical main session key alias
This commit is contained in:
committed by
mbelinky
parent
6e7f1a6a1b
commit
2c22b2c3c3
@@ -447,7 +447,10 @@ public final class OpenClawChatViewModel {
|
||||
// even when this view currently uses an alias key (for example "main").
|
||||
// Never drop events for our own pending run on key mismatch, or the UI can stay
|
||||
// stuck at "thinking" until the user reopens and forces a history reload.
|
||||
if let sessionKey = chat.sessionKey, sessionKey != self.sessionKey, !isOurRun {
|
||||
if let sessionKey = chat.sessionKey,
|
||||
!Self.matchesCurrentSessionKey(incoming: sessionKey, current: self.sessionKey),
|
||||
!isOurRun
|
||||
{
|
||||
return
|
||||
}
|
||||
if !isOurRun {
|
||||
@@ -481,6 +484,21 @@ public final class OpenClawChatViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
private static func matchesCurrentSessionKey(incoming: String, current: String) -> Bool {
|
||||
let incomingNormalized = incoming.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
|
||||
let currentNormalized = current.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
|
||||
if incomingNormalized == currentNormalized {
|
||||
return true
|
||||
}
|
||||
// Common alias pair in operator clients: UI uses "main" while gateway emits canonical.
|
||||
if (incomingNormalized == "agent:main:main" && currentNormalized == "main") ||
|
||||
(incomingNormalized == "main" && currentNormalized == "agent:main:main")
|
||||
{
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private func handleAgentEvent(_ evt: OpenClawAgentEventPayload) {
|
||||
if let sessionId, evt.runId != sessionId {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user