Fix terminal read for blank TUI tails (#5050)

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Jinwoo Hong
2026-06-09 15:53:39 -07:00
committed by GitHub
co-authored by Orca
parent 9c199a5b85
commit 7d666fafab
4 changed files with 264 additions and 2 deletions
+36
View File
@@ -1348,6 +1348,42 @@ describe('orca cli worktree awareness', () => {
})
})
it('prints terminal.read fallback screen lines in json mode', async () => {
queueFixtures(
callMock,
okFixture('req_terminal_read', {
terminal: {
handle: 'term_worker',
status: 'running',
tail: ['Claude Code', 'Checking files', 'Waiting for input'],
truncated: false,
limited: true,
oldestCursor: '0',
nextCursor: '3000',
latestCursor: '3000',
returnedLineCount: 3
}
})
)
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {})
await main(
['terminal', 'read', '--terminal', 'term_worker', '--limit', '120', '--json'],
'/tmp/repo'
)
expect(callMock).toHaveBeenCalledWith('terminal.read', {
terminal: 'term_worker',
limit: 120
})
const printed = JSON.parse(String(logSpy.mock.calls[0]?.[0]))
expect(printed.result.terminal.tail).toEqual([
'Claude Code',
'Checking files',
'Waiting for input'
])
})
it('keeps interactive Codex startup commands backgrounded unless focus is explicit', async () => {
queueFixtures(
callMock,