Skip to content

The agent that grows with you

test(desktop): a messaging completion known only from the project tree does not light unread (currently failing)

Teknium9a4c9075f639
diff --git a/apps/desktop/src/store/session-states-eviction.test.ts b/apps/desktop/src/store/session-states-eviction.test.ts
index d9654bed356..d4245ac34f5 100644
--- a/apps/desktop/src/store/session-states-eviction.test.ts
+++ b/apps/desktop/src/store/session-states-eviction.test.ts
@@ -1,6 +1,7 @@
import { beforeEach, describe, expect, it } from 'vitest'
import { createClientSessionState } from '@/lib/chat-runtime'
+import { $projectTree } from '@/store/project-tree'
import {
$activeSessionId,
$messagingSessions,
@@ -36,6 +37,7 @@ beforeEach(() => {
$sessionTiles.set([])
$sessions.set([])
$messagingSessions.set([])
+ $projectTree.set([])
$activeSessionId.set(null)
$selectedStoredSessionId.set(null)
$unreadFinishedSessionIds.set([])
@@ -73,6 +75,40 @@ describe('publish-time eviction', () => {
expect($unreadFinishedSessionIds.get()).toContain('shared')
})
+ it('does not mark a messaging completion unread when only the project tree has its row', () => {
+ // The project tree lists messaging rows too (it excludes only cron/kanban/oneshot), and a
+ // conversation older than the loaded messaging page is known only from there.
+ $projectTree.set([
+ {
+ id: 'proj',
+ label: 'proj',
+ path: null,
+ repos: [
+ {
+ id: 'repo',
+ label: 'repo',
+ path: null,
+ groups: [
+ {
+ id: 'lane',
+ label: 'lane',
+ path: null,
+ sessions: [makeSessionInfo({ id: 'tg-old', source: 'telegram' })]
+ }
+ ],
+ sessionCount: 1
+ }
+ ],
+ sessionCount: 1
+ } as never
+ ])
+
+ publishSessionState('rt-tg', state('tg-old', { busy: true }))
+ publishSessionState('rt-tg', state('tg-old', { busy: false }))
+
+ expect($unreadFinishedSessionIds.get()).not.toContain('tg-old')
+ })
+
it('keeps a busy session with no surface — its background turn feeds the sidebar dot', () => {
publishSessionState('rt-1', state('stored-1', { busy: true }))
publishSessionState('rt-1', state('stored-1', { busy: true, awaitingResponse: true }))