Files
orca/src/shared/codex-turn-transcript.test.ts
T
Neil 02790c53e8 Fix Codex status after Ctrl+C copy and side-chat navigation (#24339)
* fix: preserve Codex status on ambiguous Ctrl+C input

* fix: confirm Codex turn cancellations from host rollout records

* fix: keep ephemeral side hooks separate from the Codex main turn

* perf: watch active Codex rollouts and skip unrelated records

* fix: retain confirmed Codex cancellation across late relay events
2026-10-01 17:33:58 -07:00

33 lines
1.6 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { reconcileCodexTranscriptTurn, type CodexTranscriptTurn } from './codex-turn-transcript'
const event = (payload: unknown): Record<string, unknown> => ({ type: 'event_msg', payload })
describe('Codex root turn evidence', () => {
it('ignores a stale abort for an older turn and a quoted interruption message', () => {
const turn: CodexTranscriptTurn = { interrupted: false }
reconcileCodexTranscriptTurn(turn, [
event({ type: 'task_started', turn_id: 'new' }),
event({ type: 'turn_aborted', turn_id: 'old', reason: 'interrupted' }),
event({ type: 'agent_message', message: 'Conversation interrupted - use /feedback' })
])
expect(turn).toEqual({ turnId: 'new', interrupted: false })
reconcileCodexTranscriptTurn(turn, [
event({ type: 'turn_aborted', turn_id: 'new', reason: 'interrupted' })
])
expect(turn.interrupted).toBe(true)
reconcileCodexTranscriptTurn(turn, [event({ type: 'task_started', turn_id: 'next' })])
expect(turn).toEqual({ turnId: 'next', interrupted: false })
})
it('accepts older abort events without a turn id and ignores other abort reasons', () => {
const turn: CodexTranscriptTurn = { interrupted: false }
reconcileCodexTranscriptTurn(turn, [event({ type: 'turn_aborted', reason: 'budget_limited' })])
expect(turn.interrupted).toBe(false)
reconcileCodexTranscriptTurn(turn, [event({ type: 'turn_aborted', reason: 'interrupted' })])
expect(turn.interrupted).toBe(true)
reconcileCodexTranscriptTurn(turn, [event({ type: 'turn_complete' })])
expect(turn.interrupted).toBe(false)
})
})