Skip to content

Commit 609c485

Browse files
Merge pull request NousResearch#27971 from NousResearch/austin/fix/goal-statusbar
fix(tui): keep /goal verdict out of compact status row
1 parent d9b6f75 commit 609c485

2 files changed

Lines changed: 54 additions & 5 deletions

File tree

ui-tui/src/__tests__/createGatewayEventHandler.test.ts

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { createGatewayEventHandler } from '../app/createGatewayEventHandler.js'
44
import { getOverlayState, resetOverlayState } from '../app/overlayStore.js'
55
import { turnController } from '../app/turnController.js'
66
import { getTurnState, resetTurnState } from '../app/turnStore.js'
7-
import { patchUiState, resetUiState } from '../app/uiStore.js'
7+
import { getUiState, patchUiState, resetUiState } from '../app/uiStore.js'
88
import { estimateTokensRough } from '../lib/text.js'
99
import 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)

ui-tui/src/app/createGatewayEventHandler.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,14 +338,23 @@ export function createGatewayEventHandler(ctx: GatewayEventHandlerContext): (ev:
338338
return
339339
}
340340

341-
setStatus(p.text)
342-
343-
if (p.kind === 'compressing') {
341+
if (p.kind === 'goal') {
344342
sys(p.text)
343+
const brief = p.text.startsWith('✓')
344+
? '✓ goal complete'
345+
: p.text.startsWith('↻')
346+
? '↻ goal continuing'
347+
: p.text.startsWith('⏸')
348+
? '⏸ goal paused'
349+
: 'ready'
350+
setStatus(brief)
351+
restoreStatusAfter(6000)
345352
return
346353
}
347354

348-
if (p.kind === 'goal') {
355+
setStatus(p.text)
356+
357+
if (p.kind === 'compressing') {
349358
sys(p.text)
350359
return
351360
}

0 commit comments

Comments
 (0)