Skip to content

The agent that grows with you

test(gateway,desktop): a messaging turn that settles before its row loads does not light unread (currently failing)

yoniebansd1e3792aa3f1
diff --git a/apps/desktop/src/app/contrib/hooks/live-status-reap.test.ts b/apps/desktop/src/app/contrib/hooks/live-status-reap.test.ts
index 7e202064434..29a7863abff 100644
--- a/apps/desktop/src/app/contrib/hooks/live-status-reap.test.ts
+++ b/apps/desktop/src/app/contrib/hooks/live-status-reap.test.ts
@@ -60,6 +60,16 @@ describe('rehydrateLiveSessionStatuses — reaping vanished runtimes', () => {
expect($unreadFinishedSessionIds.get()).toEqual(['stored-b'])
})
+ it('stays dark for a messaging turn that settles before its messaging row loads', () => {
+ rehydrateLiveSessionStatuses({
+ sessions: [{ id: 'runtime-tg', session_key: 'stored-tg', source: 'telegram', status: 'working' }]
+ })
+
+ rehydrateLiveSessionStatuses({ sessions: [] })
+
+ expect($unreadFinishedSessionIds.get()).toEqual([])
+ })
+
// A turn that started just before the socket dropped was never polled, so
// "seen live last poll" cannot gate its confirmation: the reconcile parked it,
// and the first fresh snapshot that does not report it working is the
diff --git a/apps/desktop/src/app/contrib/hooks/use-background-sync.ts b/apps/desktop/src/app/contrib/hooks/use-background-sync.ts
index 07d2d527562..1a771eb6f6f 100644
--- a/apps/desktop/src/app/contrib/hooks/use-background-sync.ts
+++ b/apps/desktop/src/app/contrib/hooks/use-background-sync.ts
@@ -716,6 +716,7 @@ interface LiveSessionStatusItem {
id?: string
last_active?: number
session_key?: string
+ source?: null | string
status?: 'idle' | 'starting' | 'waiting' | 'working'
}
diff --git a/tests/gateway/test_authority_active_list.py b/tests/gateway/test_authority_active_list.py
index 064a9cac26b..c344c918159 100644
--- a/tests/gateway/test_authority_active_list.py
+++ b/tests/gateway/test_authority_active_list.py
@@ -62,6 +62,13 @@ async def test_a_running_turn_reads_working_until_it_settles(owner):
assert (await owner.active())['chat']['status'] == 'idle'
+async def test_a_row_names_its_source(owner):
+ # Desktop's poll can see a messaging turn settle before its messaging row loads; the source
+ # on the live row is what keeps that settle from reading as a Desktop completion.
+ assert (await owner.active())['chat']['source'] == 'telegram'
+
+
@pytest.mark.asyncio
async def test_a_turn_blocked_on_a_prompt_reads_waiting(owner, monkeypatch):
await owner.submit('hi')