docs(voice): freeze OpenAI Realtime Phase 0 contracts
Align voice specifications and the MVP plan with OpenAI Realtime. Document audio admission, bounded playback, cancellation ownership, turn correlation, cleanup barriers and calibration prerequisites. Preserve historical checkpoints and record unrun acceptance gates.
This commit is contained in:
@@ -10,6 +10,19 @@ This checklist tracks implementation; it does not replace the governing
|
||||
Checked baseline items mean existing component implementation, not end-to-end
|
||||
MVP acceptance. See the reference map for executed component checks; these do not certify the full MVP.
|
||||
|
||||
## Realtime Phase 0 checkpoint (2026-10-08)
|
||||
|
||||
- [x] Authorized voice-provider change and frozen 24 kHz PCM16LE/application events documented.
|
||||
- [x] Phase 0 contract preparation repaired: reference/final-report lifecycle, integer coordinates, transport bounds, sixteen walkthroughs, official retirement dates and read-only preflight examples. All remain future runtime obligations.
|
||||
- [x] Remaining four Phase 0 documentation findings corrected: paced generated backlog, backend cancellation/race ownership, delayed user ASR and current committed-turn release/supersession. Runtime remains unimplemented.
|
||||
- [ ] Validate provider cancellation/truncation acknowledgement and enforce documented transport/playback bounds in later runtime work.
|
||||
- [ ] Make separate model/transcription replacement decisions before 2027-01-20 / 2027-02-26 retirement; no automatic migration.
|
||||
- [x] Backend configuration, independent real-call opt-ins and exact next commands recorded in the [Phase 0 report](../guides/realtime-agent-phase0.md).
|
||||
- [ ] Persisted compatible profile, approved bindings and measured cutoff verified; CALIBRATION_REQUIRED remains closed.
|
||||
- [ ] Actual Realtime runtime/tool smoke and browser acceptance (later phases).
|
||||
|
||||
Use the [Realtime MVP plan](realtime-agent-mvp-plan.md) for the current backend sequence; prior WP/day estimates below are historical.
|
||||
|
||||
## Existing baseline to reuse
|
||||
|
||||
- [x] Phase 1: PostgreSQL/pgvector foundation, frozen processing/embedding profiles and trusted bootstrap.
|
||||
@@ -78,7 +91,7 @@ or a four-document capacity limit.
|
||||
- [x] Expose the shared search through a strict sync/async LangChain tool with lazy imports, bounded admission/deadlines, cancellation and shutdown; see [Phase 3 handoff](../guides/scoped-search-phase3.md).
|
||||
- [ ] Keep persistent secrets and provider-specific objects behind server adapters.
|
||||
- [ ] Add minimal owned voice conversations, Live sessions and voice tool-call persistence through forward migrations.
|
||||
- [ ] Implement session reservation and authenticated backend WSS audio relay to Gemini Live.
|
||||
- [ ] Implement session reservation and authenticated backend WSS audio relay to OpenAI Realtime.
|
||||
- [ ] Dispatch tools with trusted backend context; model arguments cannot override identity or knowledge scope.
|
||||
- [ ] Correlate current-session transcripts, tool results and displayed sources.
|
||||
- [ ] Handle follow-up context, interruption/cancellation, provider failure and session termination.
|
||||
|
||||
@@ -82,6 +82,8 @@ Deferred: frontend implementation, durable transcript history, public text chat,
|
||||
- `audio_started` with `turn_ref` and backend-generated `audio_ref`.
|
||||
- Client `playback_progress` with `audio_ref` and cumulative `played_ms`.
|
||||
- Retain the existing `session_ready`, `transcript`, `sources`, `turn_interrupted`, and `error` event contracts.
|
||||
- Freeze audio_ref lifecycle/coordinates, final progress after interruption, acknowledged truncation before continuation, and transport admission/overflow policy in API Section 7.1. Add audio_ended as a generation delimiter, not playback acknowledgement; one ref per provider output item/audio content part, no splitting. See its sixteen contract walkthroughs, including bounded burst delivery, cancellation races, delayed user ASR, overlapping-turn release and stall/cleanup timer ownership.
|
||||
- Keep these future runtime requirements as documentation in Phase 0; implement none of Phases 1-4 here.
|
||||
- Verify the persisted embedding profile and approved document bindings. Use the existing calibration command and report loader; never invent a cutoff.
|
||||
- Establish separate explicit opt-ins for ingestion, calibration, and voice smoke calls.
|
||||
|
||||
@@ -177,6 +179,23 @@ provider/input-item/response/call-to-turn correlation. Keep retrieval
|
||||
off the audio receive loop. Coalesce duplicate events within the
|
||||
active runtime and prevent duplicate response continuation.
|
||||
|
||||
Follow authoritative API 7.1.2/7.1.5/7.1.6: acknowledge VAD
|
||||
create_response=false and interrupt_response=false; the backend alone
|
||||
cancels the specific old response. Correlate a narrowly identified
|
||||
no-active-response race with terminal state and complete context cleanup.
|
||||
Keep provider-generated audio in the bounded reservoir and pace browser
|
||||
delivery with progress credits; keep provider control reception responsive.
|
||||
Only eligible open/sealed refs have playback-stall deadlines; atomically
|
||||
invalidate ref/timer identities on finalization, recheck queued callbacks,
|
||||
and start each new eligible interval independently. Retire credit once while
|
||||
retaining heard/sent/generated evidence; cleanup and release gates stay separate.
|
||||
Preserve delayed authorized user transcripts under their original turn;
|
||||
suppress late assistant output only for actually interrupted/superseded work.
|
||||
Gate each response/create and tool continuation on committed current input,
|
||||
valid authority/epoch and every cleanup barrier. Consume one intent, and
|
||||
make cleanup callbacks reevaluate the latest turn token, never release a
|
||||
superseded response. Diagnostic text uses confirmed input-item creation.
|
||||
|
||||
Use an English policy prompt that requires concise Persian speech,
|
||||
fresh retrieval for document claims and follow-ups, faithful material
|
||||
conditions, clarification for ambiguity, and safe handling of
|
||||
@@ -244,6 +263,21 @@ truncation, late-event suppression, bounded queues, and cleanup.
|
||||
Accept only documented application controls; never forward arbitrary
|
||||
browser JSON as provider events.
|
||||
|
||||
Apply API 7.1.2/7.1.5/7.1.6 exactly: separate bounded generated backlog,
|
||||
transport reservations and browser playback; use a paced progress-credit
|
||||
window, not a two-second cap on a generation burst. Restrict playback-stall
|
||||
timers to eligible open/sealed refs; finalization atomically invalidates them,
|
||||
queued callbacks recheck state/identity, and new eligible output gets fresh
|
||||
timing. Acknowledged retirement releases remaining credit once without
|
||||
changing playback evidence or bypassing response-release barriers. Both VAD flags are
|
||||
false, with backend-owned response-specific cancellation and the narrow
|
||||
no-active cancellation race exception after terminal-state confirmation.
|
||||
Preserve delayed user ASR, distinguish normal completion from interruption,
|
||||
and suppress only ineligible assistant output. Response release requires
|
||||
current correlated input commitment, authorization/epoch and all cleanup
|
||||
barriers; a new genuine speech-start supersedes pending work without
|
||||
restarting old cleanup or letting its callbacks release the old turn.
|
||||
|
||||
Integrate logical epoch invalidation with the existing selection
|
||||
service and close affected runtimes after commit. Handle logout,
|
||||
expiry, disablement, provider loss, and startup recovery.
|
||||
@@ -399,13 +433,18 @@ For each material failure, record the scenario, expected behavior, correlated ID
|
||||
|
||||
- **Responsibility:** backend implementation and integration support; frontend implementation remains with its developer.
|
||||
- **Development:** local browser first, using a same-origin proxy; HTTPS/WSS remains a separate deployment checkpoint.
|
||||
- **Voice profile:** keep the proof's configured model, `shimmer` voice, and Persian transcription initially; validate provider acknowledgement. No runtime voice switching.
|
||||
- **Voice profile:** preserve gpt-realtime-mini and fixed shimmer; proof input transcription is whisper-1 with language fa (output speed 0.98). Official retirement dates checked 2026-10-08: gpt-realtime-mini 2027-01-20; whisper-1 2027-02-26. No shimmer-specific retirement date found. See [official deprecations](https://developers.openai.com/api/docs/deprecations) and [Phase 0 configuration lifecycle](../guides/realtime-agent-phase0.md). Replacement needs a separate explicit decision/account/budget/validation before retirement; never silently migrate.
|
||||
- **Search:** reuse the current compatible embedding profile, measured cutoff, evidence limits, and four-running/eight-waiting runner with its existing 75-second maximum.
|
||||
- **Proposed local defaults:** eight-hour auth sessions, ten-minute voice sessions, 15-second provider connection timeout, 30-second setup deadline, and at most two seconds of queued audio per direction. Make these configurable engineering defaults.
|
||||
- **Transport/lifecycle defaults:** API Section 7.1 is canonical: 9600-byte aligned PCM messages; 4096-byte client controls / 65536-byte server events; 96000-byte and 100-message audio queues; 1000 ms final progress window; 5-second cleanup acknowledgement and send deadlines. A separate 1440000-byte (30 s) generated-plus-undrained backlog and 72000-byte (1500 ms) progress-credit delivery window prevent healthy generation bursts overflowing playback; 5 s stalled progress fails explicitly only for eligible open/sealed refs. Finalization invalidates their stall timer atomically; final-progress/cancellation/cleanup deadlines remain independent, callbacks recheck state/identity, and newly eligible output gets fresh timing. Retirement releases credit once while retaining evidence counters. Other reference/input/provider/control/memory caps and current-turn release gates are specified there. These are initial engineering defaults, not product capacity/latency approval.
|
||||
- **Real-call limits:** retain the existing ten-call calibration and 26-query evaluation bounds. Use a separately opted-in voice smoke run capped at ten minutes total. Ingestion has its own explicit budget.
|
||||
- **External prerequisites:** approved originals/document bindings, required human review, compatible database/provider access, and frontend availability. Missing prerequisites block their dependent acceptance only.
|
||||
- **Markdown artifact:** this plan is stored as `docs/plans/realtime-agent-mvp-plan.md`. Add links to phase completion reports as implementation progresses. This document records the proposed work; it does not claim implementation or runtime acceptance.
|
||||
|
||||
## Phase 0 checkpoint (2026-10-08)
|
||||
|
||||
Contract/configuration preparation repaired for ordering, coordinates, transport bounds, provider retirement, preflight, paced output, cancellation races, delayed user transcripts and overlapping-turn release; see [prerequisites, next commands and actual results](../guides/realtime-agent-phase0.md). Measured calibration remains blocked by explicit opt-in, approved bindings and verified database/profile access. Later phases are not implemented by this checkpoint.
|
||||
|
||||
## Phase 1 repair checkpoint (2026-10-08)
|
||||
|
||||
Implemented the scoped existing-runtime repairs; see
|
||||
|
||||
Reference in New Issue
Block a user