fix(orchestration): expose unverifiable read liveness

This commit is contained in:
Brennan Benson
2026-08-16 19:58:31 -07:00
parent 02e29185e1
commit 03a785aadd
5 changed files with 51 additions and 4 deletions
@@ -91,7 +91,18 @@ export const ORCHESTRATION_FEDERATION_CONTROL_METHODS: RpcMethod[] = [
dispatchId: params.dispatchId,
terminalHandle: observation.terminal.handle,
workerState: attachment.state,
terminalStatus: observation.status === 'exited' ? 'exited' : 'running',
terminalStatus:
observation.status === 'exited'
? 'exited'
: observation.status === 'unverifiable'
? 'unknown'
: 'running',
terminalLiveness:
observation.status === 'unverifiable'
? 'unverifiable'
: observation.status === 'exited'
? 'exited'
: 'live',
attachedAt: attachment.created_at,
source: params.source,
cursor: params.cursor,
@@ -208,7 +208,18 @@ export const ORCHESTRATION_WORKER_CONTROL_METHODS: RpcMethod[] = [
dispatchId: params.dispatch,
terminalHandle: worker.agent_terminal_handle,
workerState: worker.state,
terminalStatus: observation.status === 'exited' ? 'exited' : 'running',
terminalStatus:
observation.status === 'exited'
? 'exited'
: observation.status === 'unverifiable'
? 'unknown'
: 'running',
terminalLiveness:
observation.status === 'unverifiable'
? 'unverifiable'
: observation.status === 'exited'
? 'exited'
: 'live',
attachedAt: worker.created_at,
source: params.source,
cursor: params.cursor,
@@ -83,6 +83,19 @@ describe('exact orchestration worker output', () => {
expect(readTerminal).not.toHaveBeenCalled()
})
it('reports unverifiable liveness without claiming the terminal is running', async () => {
const result = await read({
terminalStatus: 'unknown',
terminalLiveness: 'unverifiable'
})
expect(result.status).toEqual({
worker: 'ready',
terminal: 'unknown',
liveness: 'unverifiable'
})
})
it('reads Grok through the shared Native Chat transcript decoder', async () => {
await writeFile(
transcriptA,
@@ -20,6 +20,7 @@ export async function readExactWorkerOutput(args: {
terminalHandle: string
workerState: string
terminalStatus: RuntimeTerminalState
terminalLiveness?: 'live' | 'unverifiable' | 'exited'
attachedAt: string
source?: OrchestrationWorkerReadSource
cursor?: string | number
@@ -100,7 +101,11 @@ export async function readExactWorkerOutput(args: {
returnedMessageCount: transcript.messages.length
},
cursor: nextCursor,
status: { worker: args.workerState, terminal: args.terminalStatus },
status: {
worker: args.workerState,
terminal: args.terminalStatus,
...(args.terminalLiveness ? { liveness: args.terminalLiveness } : {})
},
fallbackReason: null,
warnings: transcript.warnings
}
@@ -145,7 +150,11 @@ async function readTerminalOutput(
sourceIdentity,
terminal: { ...terminal, tail: redactedTerminal.lines },
cursor: nextCursor,
status: { worker: args.workerState, terminal: terminal.status },
status: {
worker: args.workerState,
terminal: args.terminalLiveness === 'unverifiable' ? args.terminalStatus : terminal.status,
...(args.terminalLiveness ? { liveness: args.terminalLiveness } : {})
},
fallbackReason: null,
warnings: redactedTerminal.warnings
}
@@ -1,6 +1,7 @@
import type { AgentProviderSessionMetadata } from './agent-session-resume'
import type { AgentType, NativeChatMessage } from './native-chat-types'
import type { RuntimeTerminalRead, RuntimeTerminalState } from './runtime-types'
import type { PtyLivenessVerdict } from './pty-liveness-verdict'
export const ORCHESTRATION_WORKER_READ_SOURCES = ['auto', 'transcript', 'terminal'] as const
export type OrchestrationWorkerReadSource = (typeof ORCHESTRATION_WORKER_READ_SOURCES)[number]
@@ -41,6 +42,7 @@ export type OrchestrationWorkerReadTranscriptResult = {
status: {
worker: string
terminal: RuntimeTerminalState
liveness?: PtyLivenessVerdict['status']
}
fallbackReason: null
warnings: string[]
@@ -57,6 +59,7 @@ export type OrchestrationWorkerReadTerminalResult = {
status: {
worker: string
terminal: RuntimeTerminalState
liveness?: PtyLivenessVerdict['status']
}
fallbackReason: OrchestrationWorkerReadFallbackReason | null
warnings: string[]