The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(desktop): cover terminal settle after compaction recovery
Xipong8bfdb3f0b5d4
diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/compaction-event.test.tsx b/apps/desktop/src/app/session/hooks/use-message-stream/compaction-event.test.tsxindex 41db16bdec1..588b24a00b1 100644--- a/apps/desktop/src/app/session/hooks/use-message-stream/compaction-event.test.tsx+++ b/apps/desktop/src/app/session/hooks/use-message-stream/compaction-event.test.tsx@@ -105,6 +105,50 @@ describe('useMessageStream compaction lifecycle', () => {expect(hydrateFromStoredSession).not.toHaveBeenCalled()})+ it('retires the turn clock when compaction recovery settles without message.complete', () => {+ const states = new Map([+ [+ SID,+ {+ ...createClientSessionState(),+ awaitingResponse: true,+ busy: true,+ turnLive: true,+ turnStartedAt: 1_000+ }+ ]+ ])++ stream = renderMessageStream(SID, { states })++ // Provider-side reconnect/client rebuild is internal to the agent. From+ // Desktop's point of view an aborted compaction can only clear its phase+ // and later settle the turn through the authoritative running=false edge.+ emit('status.update', { kind: 'compacting' })+ emit('status.update', { kind: 'ready' })++ // ready only ends the compaction phase; the turn itself is still live.+ expect(stream.state()).toMatchObject({+ awaitingResponse: true,+ busy: true,+ turnLive: true,+ turnStartedAt: 1_000+ })++ // If message.complete was lost across the provider failure/recovery, the+ // terminal heartbeat must still retire the clock/live claim so a pending+ // assistant bubble cannot keep TurnActivityIndicator ticking forever.+ emit('session.info', { running: false })++ expect(stream.state()).toMatchObject({+ awaitingResponse: false,+ busy: false,+ turnLive: false,+ turnStartedAt: null+ })+ expect($compactingSessions.get()).toEqual({})+ })+it('reconciles a reconnecting compaction only from trusted terminal server state', () => {mountStream()emit('status.update', { kind: 'compacting' })diff --git a/apps/desktop/src/components/assistant-ui/thread/turn-gap-indicator.test.tsx b/apps/desktop/src/components/assistant-ui/thread/turn-gap-indicator.test.tsxindex 11760c0292d..76647640f5e 100644--- a/apps/desktop/src/components/assistant-ui/thread/turn-gap-indicator.test.tsx+++ b/apps/desktop/src/components/assistant-ui/thread/turn-gap-indicator.test.tsx@@ -162,8 +162,9 @@ describe('the turn timer covers the gaps, not just the streaming', () => {act(() => $busy.set(true))act(() => vi.advanceTimersByTime(7_000))expect(container.querySelector('[data-slot="aui_turn-activity"][data-state="active"]')).toBe(row)+ })- it('does not revive a tail timer from a pending row after the session retires its busy claim', () => {+ it('does not revive a tail timer from a pending row after the session retires its busy claim', () => {$busy.set(false)$turnStartedAt.set(null)@@ -193,5 +194,6 @@ describe('the turn timer covers the gaps, not just the streaming', () => {act(() => vi.advanceTimersByTime(7_000))- expect(container.querySelector('[data-slot="aui_turn-activity"]')).not.toBeNull() })+ expect(container.querySelector('[data-slot="aui_turn-activity"]')).not.toBeNull()+ })})