fix(cli): label the worker-read PTY verdict as terminal liveness

The line printed the PTY verdict with the same word the fleet verdict uses, so a
live pane holding a dead agent read as "Liveness: live". It is now
"Terminal liveness", with "Agent liveness" printed from the fleet projection
when the receipt carries one.
This commit is contained in:
Jinwoo-H
2026-09-04 03:15:26 -04:00
parent c78f40fdd0
commit b49bcd4307
2 changed files with 32 additions and 2 deletions
@@ -171,6 +171,30 @@ describe('worker-read plain formatting', () => {
'No transcript messages returned. This exact transcript read did not request terminal evidence.'
)
})
it('separates the PTY verdict from the fleet agent verdict', () => {
const output = formatWorkerRead({
dispatchId: 'dispatch_1',
status: { worker: 'ready', terminal: 'running', liveness: 'live' },
projection: { liveness: 'unverifiable' },
source: 'terminal',
sourceIdentity: 'private-source-identity',
terminal: {
handle: 'term_worker',
status: 'running',
tail: ['tail'],
truncated: false,
nextCursor: null
},
cursor: null,
fallbackReason: null,
warnings: []
} as unknown as OrchestrationWorkerReadResult)
expect(output).toContain('Terminal liveness: live')
expect(output).toContain('Agent liveness: unverifiable')
expect(output).not.toMatch(/^Liveness:/mu)
})
it('distinguishes a released archive read from a live one', () => {
const output = formatWorkerRead({
dispatchId: 'dispatch_1',
@@ -191,7 +215,7 @@ describe('worker-read plain formatting', () => {
} as unknown as OrchestrationWorkerReadResult)
expect(output).toContain('Archived: true')
expect(output).toContain('Liveness: unverifiable')
expect(output).toContain('Terminal liveness: unverifiable')
expect(output).toContain('Worker: succeeded')
})
})
@@ -73,8 +73,14 @@ function formatWorkerReadDetails(value: OrchestrationWorkerReadResult): string {
lines.push(`Worker: ${value.status.worker}`)
}
lines.push(`Archived: ${value.archived === true}`)
// Two different verdicts: status.liveness is the PTY's, the fleet projection is the agent's.
if (value.status?.liveness) {
lines.push(`Liveness: ${value.status.liveness}`)
lines.push(`Terminal liveness: ${value.status.liveness}`)
}
const agentLiveness = (value as { projection?: { liveness?: string } | null }).projection
?.liveness
if (agentLiveness) {
lines.push(`Agent liveness: ${agentLiveness}`)
}
if (value.sourceExact !== undefined) {
lines.push(`Source exact: ${value.sourceExact}`)