Gate local realtime frame history on paginated storage (#62271)

## Why

Legacy rollout migration rewrites rolled-back history and can disrupt
the realtime stream. Enroll local threads once they use paginated history
so the stream stays intact.

## What changed

- Add the off-by-default `features.realtime_frames_local` flag for
  paginated local threads with a state database. Accept runtime updates
  through the app server and keep threads enrolled once they have a
  persisted canonical session start.
- Add thread-store APIs to recover a realtime session and look up the
  latest session ID from durable history. Route frame completion through
  a store seal so completion acknowledges durable writes.
- Add a local seal for accepted model input that writes source frames
  before the input and lets callers retry an uncertain flush without
  appending the input twice.

## Testing

Cover enrollment for legacy and paginated threads, continued enrollment
after disabling the flag, and retrying a local input seal after a failed
directory sync.

GitOrigin-RevId: 2012feeca3857da90f9b026f077b31a26d15191b
This commit is contained in:
Zahan Malkani
2026-11-18 12:55:14 +00:00
committed by copyberry
parent 4389a526d5
commit 29cb67623c
29 changed files with 693 additions and 41 deletions
+5 -1
View File
@@ -18,7 +18,7 @@ pub struct RealtimeItem {
}
/// A frame holds one or more payloads, at most one per channel. They share one ID,
/// observation time, and seal. V1 requires its only channel, `voice_transcript`.
/// observation time, and seal. Currently, `voice_transcript` is required.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, JsonSchema, TS)]
pub struct RealtimeFrameChannels {
pub voice_transcript: RealtimeVoiceTranscript,
@@ -51,6 +51,10 @@ pub enum RealtimeItemContent {
},
RealtimeSessionClosed {
outcome: RealtimeSessionOutcome,
/// Hosted frame-table sequence of the session's last frame (zero for a silent call).
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(type = "number | null", optional)]
final_frame_sequence: Option<u64>,
},
/// Durable acceptance of the exact bounded input used by an agent turn.
/// The enclosing item ID is the acceptance identity; source IDs never use