## Why
A realtime call can end with completed speech that has yet to reach a
Codex turn. The next turn needs that context even if the call's transport
has already disconnected.
## What changed
- For V3 calls with realtime frame history enabled, save pending speech
as context for the next turn. Restore it on thread reload and exclude
it from the turn count used by rollback.
- Drain already received transcript events and settle pending handoffs
before saving the call's closing marker. Report recovery required if
shutdown cannot confirm that history was saved.
- Keep transport detach separate from ending a call. Reattaching restores
saved pending speech, and an open call can be ended from persisted
history after a reload. Use the call ID for TUI attachments so successive
calls on one thread have distinct history.
## Testing
Add coverage for queued speech at hangup, reconnect and stop after
reload, retries after an uncertain write, and rollback across saved
session-end context.
GitOrigin-RevId: 657491f1d7e446a1a48e22189758810c8bdd82cb
## Why
Realtime history needs to record which transcript frames reached the
coding agent and which turn received them. If a handoff fails or the
conversation reconnects, Codex needs to distinguish speech that was
already used from speech that is still available for the next input.
## What changed
- Route handoffs through normal turn admission to start or steer a turn.
When realtime frame history is enabled, persist the transcript frames
and the receiving turn's input before publishing acceptance or exposing
the input to the model. Attribute only transcript frames represented
in the rendered input.
- Reserve transcript frames across overlapping handoffs and release them
on definite rejection. Retry an uncertain write with the same input
and require history recovery if the write still cannot be confirmed.
- On V3 reconnect, restore persisted speech that has not been consumed
and put it before newly captured speech.
## Testing
Add regression tests for attribution after transcript truncation,
overlapping handoffs, V3 reconnect ordering, and preservation of typed
input when a handoff in the same turn fails before model sampling.
GitOrigin-RevId: 432dd51971f7ced20344ebc7f0c7b007bb849f54
## What changed
Move realtime text routing into `realtime_handoff` and keep it on the shared start-or-steer path. Extract UTF-8-safe range selection for realtime delegation truncation.
Use `RolloutItem` accessors for realtime timestamps and items in recording, clock restoration, and thread history reads. Pass annotated response items to turn-boundary checks in core and migration rollback so callers can work directly with history envelopes.
GitOrigin-RevId: 3dd37cf91ee5abdca84e87b7d7e304749d9baf04