The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): judge a messaging completion by its runtime's own profile
yoniebansfb4a4e2ba599
diff --git a/apps/desktop/src/store/session-states.ts b/apps/desktop/src/store/session-states.tsindex 016ae32c712..c1e8c8094d7 100644--- a/apps/desktop/src/store/session-states.ts+++ b/apps/desktop/src/store/session-states.ts@@ -763,9 +763,22 @@ 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) {+ // The marker's profile bucket comes from the loaded row when there is one;+ // with no row, the socket-proven owner profile keeps a background profile's+ // finish out of the ACTIVE profile's bucket (#91710). The same owner decides+ // whether the completion is a messaging conversation's.+ const owner = runtimeId ? runtimeSessionOwner(runtimeId) : undefined++ const profileHint =+ typeof owner === 'string'+ ? owner+ : typeof owner?.profile === 'string' && owner.profile.trim()+ ? owner.profile+ : undefined+// 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() || isMessagingCompletion(storedId)) {+ if (storedId === $focusedStoredSessionId.get() || isMessagingCompletion(storedId, profileHint)) {return}@@ -777,20 +790,7 @@ function lightUnreadCompletion(storedId: string, runtimeId?: string) {if (Date.now() > lastReadAt) {// Flags the transient atom AND persists a marker, so the green dot- // survives an app restart (see session-unread.ts). The marker's profile- // bucket comes from the loaded row when there is one; with no row, the- // socket-proven owner profile keeps a background profile's finish out of- // the ACTIVE profile's bucket — the per-profile rail unread (#91710)- // would otherwise light the wrong square.- const owner = runtimeId ? runtimeSessionOwner(runtimeId) : undefined-- const profileHint =- typeof owner === 'string'- ? owner- : typeof owner?.profile === 'string' && owner.profile.trim()- ? owner.profile- : undefined-+ // survives an app restart (see session-unread.ts).markSessionUnreadFinished(storedId, profileHint)}}diff --git a/apps/desktop/src/store/session-unread.ts b/apps/desktop/src/store/session-unread.tsindex e5bd95125e7..a36147fe6ed 100644--- a/apps/desktop/src/store/session-unread.ts+++ b/apps/desktop/src/store/session-unread.ts@@ -208,8 +208,14 @@ function setMarkerBucket(profile: string, ids: readonly string[]): void {/** A messaging conversation delivers its completion to its own platform; a* Desktop observer is not an unread recipient of it. */-export function isMessagingCompletion(storedSessionId: string): boolean {- return isMessagingSource(resolveLoadedRow(storedSessionId)?.source)+export function isMessagingCompletion(storedSessionId: string, profile?: string): boolean {+ const row = profile+ ? rowsFor([$sessions.get(), $cronSessions.get(), $messagingSessions.get()]).find(+ r => sessionMatchesStoredId(r, storedSessionId) && profileKeyForRow(r) === normalizeProfileKey(profile)+ )+ : resolveLoadedRow(storedSessionId)++ return isMessagingSource(row?.source)}/** UNREAD WRITER — the live busy→idle edge (session-states.ts) and any surface