@@ -4,7 +4,7 @@ import { createGatewayEventHandler } from '../app/createGatewayEventHandler.js'
44import { getOverlayState , resetOverlayState } from '../app/overlayStore.js'
55import { turnController } from '../app/turnController.js'
66import { getTurnState , resetTurnState } from '../app/turnStore.js'
7- import { patchUiState , resetUiState } from '../app/uiStore.js'
7+ import { getUiState , patchUiState , resetUiState } from '../app/uiStore.js'
88import { estimateTokensRough } from '../lib/text.js'
99import type { Msg } from '../types.js'
1010
@@ -132,6 +132,46 @@ describe('createGatewayEventHandler', () => {
132132 expect ( ctx . system . sys ) . toHaveBeenCalledWith ( 'compressing 968 messages (~123,400 tok)…' )
133133 } )
134134
135+ it ( 'keeps goal verdict text in transcript but shows a brief idle status (#goal statusbar)' , ( ) => {
136+ const appended : Msg [ ] = [ ]
137+ const ctx = buildCtx ( appended )
138+ const onEvent = createGatewayEventHandler ( ctx )
139+ const verdict = '✓ Goal achieved: long judge reason goes only in transcript, not merged with cwd label.'
140+
141+ vi . useFakeTimers ( )
142+ try {
143+ onEvent ( {
144+ payload : { kind : 'goal' , text : verdict } ,
145+ type : 'status.update'
146+ } as any )
147+
148+ expect ( ctx . system . sys ) . toHaveBeenCalledWith ( verdict )
149+ expect ( getUiState ( ) . status ) . toBe ( '✓ goal complete' )
150+
151+ vi . advanceTimersByTime ( 6001 )
152+ expect ( getUiState ( ) . status ) . toBe ( 'ready' )
153+ } finally {
154+ vi . useRealTimers ( )
155+ }
156+ } )
157+
158+ it ( 'maps goal status.update prefixes to short status strings' , ( ) => {
159+ const ctx = buildCtx ( [ ] )
160+ const onEvent = createGatewayEventHandler ( ctx )
161+
162+ onEvent ( {
163+ payload : { kind : 'goal' , text : '↻ Continuing toward goal (1/10): reason' } ,
164+ type : 'status.update'
165+ } as any )
166+ expect ( getUiState ( ) . status ) . toBe ( '↻ goal continuing' )
167+
168+ onEvent ( {
169+ payload : { kind : 'goal' , text : '⏸ Goal paused — budget exhausted.' } ,
170+ type : 'status.update'
171+ } as any )
172+ expect ( getUiState ( ) . status ) . toBe ( '⏸ goal paused' )
173+ } )
174+
135175 it ( 'surfaces self-improvement review summaries as a persistent system line' , ( ) => {
136176 const appended : Msg [ ] = [ ]
137177 const ctx = buildCtx ( appended )
0 commit comments