The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway,desktop): the live session poll names each session's source, so a messaging settle never lights unread before its row loads
yoniebansad7c5a1d88c1
diff --git a/apps/desktop/src/app/contrib/hooks/use-background-sync.ts b/apps/desktop/src/app/contrib/hooks/use-background-sync.tsindex 1a771eb6f6f..a33523c6061 100644--- a/apps/desktop/src/app/contrib/hooks/use-background-sync.ts+++ b/apps/desktop/src/app/contrib/hooks/use-background-sync.ts@@ -49,6 +49,7 @@ import {setSessionStalled} from '@/store/session-states'import { loadArchivedSessions } from '@/store/sidebar-archive'+import { noteLiveSessionSource } from '@/store/session-unread'import {clearActiveSessionTodos,clearSessionTodos,@@ -789,6 +790,7 @@ export function rehydrateLiveSessionStatuses(}seen.add(runtimeSessionId)+ noteLiveSessionSource(storedSessionId, session.source)if (working) {workingStoredIds.add(storedSessionId)diff --git a/apps/desktop/src/store/session-unread.ts b/apps/desktop/src/store/session-unread.tsindex 93af13851c0..69847fec27e 100644--- a/apps/desktop/src/store/session-unread.ts+++ b/apps/desktop/src/store/session-unread.ts@@ -324,10 +324,23 @@ function resolveOwnedRow(storedSessionId: string, profile?: string): SessionInfo: resolveLoadedRow(storedSessionId)}+/** Sources the live poll reported, by stored id: a messaging turn can settle before its row loads. */+const liveSources = new Map<string, string>()++/** `session.active_list` named `storedSessionId`'s source. */+export function noteLiveSessionSource(storedSessionId: string, source: null | string | undefined) {+ if (source) {+ liveSources.set(storedSessionId, source)+ trimOldest(liveSources)+ }+}+/** A messaging conversation delivers its completion to its own platform; a* Desktop observer is not an unread recipient of it at the busy-to-idle edge. */export function isMessagingCompletion(storedSessionId: string, profile?: string): boolean {- return isMessagingSource(resolveOwnedRow(storedSessionId, profile)?.source)+ const row = resolveOwnedRow(storedSessionId, profile)++ return isMessagingSource(row ? row.source : liveSources.get(storedSessionId))}/** UNREAD WRITER — the live busy→idle edge (session-states.ts) and any surfacediff --git a/apps/shared/src/gateway-contract.generated.ts b/apps/shared/src/gateway-contract.generated.tsindex 2a5860f0078..c09bab44355 100644--- a/apps/shared/src/gateway-contract.generated.ts+++ b/apps/shared/src/gateway-contract.generated.ts@@ -3280,6 +3280,7 @@ export interface SessionActiveItem {model: stringpreview: stringsession_key: string+ source?: string | nullstarted_at: numberstatus: LiveSessionStatustitle: stringdiff --git a/apps/shared/src/gateway-contract.openrpc.json b/apps/shared/src/gateway-contract.openrpc.jsonindex 9a4b8967c74..5c84266469e 100644--- a/apps/shared/src/gateway-contract.openrpc.json+++ b/apps/shared/src/gateway-contract.openrpc.json@@ -34675,6 +34675,18 @@"title": "Session Key","type": "string"},+ "source": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Source"+ },"started_at": {"title": "Started At","type": "number"diff --git a/gateway/session_active_list.py b/gateway/session_active_list.pyindex 5ca3abc0f38..f19b1c8757a 100644--- a/gateway/session_active_list.py+++ b/gateway/session_active_list.py@@ -49,5 +49,6 @@ async def active_list(connection, ref, params):'last_active': float(row.get('ended_at') or started), 'started_at': started,'message_count': int(row.get('message_count') or 0),'model': str(row.get('model') or ''), 'preview': '', 'title': row.get('title') or '',+ 'source': row.get('source'),'status': _status(live, handle, authority._pending_rows(candidate))})return {'sessions': rows}diff --git a/tui_gateway/contracts/sessions.py b/tui_gateway/contracts/sessions.pyindex 800dbb0d643..2ed546a01f4 100644--- a/tui_gateway/contracts/sessions.py+++ b/tui_gateway/contracts/sessions.py@@ -278,6 +278,7 @@ class SessionActiveItem(Result):model: strpreview: strsession_key: str+ source: str | None = Nonestarted_at: floatstatus: LiveSessionStatustitle: str