Skip to content

The agent that grows with you

fix(desktop): ignore messaging session completions

KoNit-Ke2138711d755
diff --git a/apps/desktop/src/store/session-states.ts b/apps/desktop/src/store/session-states.ts
index 95c9201a982..979f9149331 100644
--- a/apps/desktop/src/store/session-states.ts
+++ b/apps/desktop/src/store/session-states.ts
@@ -34,6 +34,7 @@ import {
import { resolveRememberedActivePane, workspaceScopeKey } from '@/components/pane-shell/workspace-scope'
import type { WorkspaceMode } from '@/contrib/types'
import { finalizeInterruptedMessages, sealOpenToolParts } from '@/lib/chat-messages'
+import { isMessagingSource } from '@/lib/session-source'
import { tileFocusStampOnFocusChange } from '@/lib/session-timer-since'
import { stableArray } from '@/lib/stable-array'
import { readJson, writeJson } from '@/lib/storage'
@@ -763,6 +764,16 @@ function handleTransition(previous: ClientSessionState | null, next: ClientSessi
/** Mark a completed turn unread unless the user is already looking at it. */
function lightUnreadCompletion(storedId: string, runtimeId?: string) {
+ const messagingRow = [...$sessions.get(), ...$cronSessions.get(), ...$messagingSessions.get()].find(session =>
+ sessionMatchesStoredId(session, storedId)
+ )
+
+ // Messaging conversations deliver their own completion to their originating
+ // platform. A Desktop observer is not an unread recipient of that delivery.
+ if (isMessagingSource(messagingRow?.source)) {
+ return
+ }
+
// FOCUSED, not selected: a session finishing in the tile the user is
// watching is already seen, and a tile is never the primary selection.
if (storedId === $focusedStoredSessionId.get()) {