realtime: rename provider session ids (#20361)

## Summary

Codex is repurposing `session` to mean a thread group, so the realtime
provider session id should no longer use `session_id` / `sessionId` in
Codex-facing protocol payloads. This PR renames that provider-specific
field to `realtime_session_id` / `realtimeSessionId` and intentionally
breaks clients that still send the old field names.

## What Changed

- Renamed realtime provider session fields in `ConversationStartParams`,
`RealtimeConversationStartedEvent`, and `RealtimeEvent::SessionUpdated`.
- Renamed app-server v2 realtime request and notification fields to
`realtimeSessionId`.
- Removed legacy serde aliases for `session_id` / `sessionId`; clients
must send the new names.
- Propagated the rename through core realtime startup, app-server
adapters, codex-api websocket handling, and TUI realtime state.
- Regenerated app-server protocol schema/TypeScript outputs and updated
app-server README examples.
- Kept upstream Realtime API concepts unchanged: provider `session.id`
parsing and `x-session-id` headers still use the upstream wire names.

## Testing

- CI is running on the latest pushed commit.
- Earlier local verification on this PR:
  - `cargo test -p codex-protocol`
- `CODEX_SKIP_VENDORED_BWRAP=1 cargo test -p codex-core
realtime_conversation`
  - `cargo test -p codex-app-server-protocol`
- `CODEX_SKIP_VENDORED_BWRAP=1 cargo test -p codex-app-server
realtime_conversation`
- attempted `CODEX_SKIP_VENDORED_BWRAP=1 cargo test -p codex-tui` (local
linker bus error while linking the test binary)

---------

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Ahmed Ibrahim
2026-04-30 13:39:48 +03:00
committed by GitHub
Unverified
parent c37f7434ba
commit 8a97f3cf03
23 changed files with 271 additions and 146 deletions
@@ -2558,7 +2558,7 @@ mod tests {
thread_id: "thr_123".to_string(),
output_modality: RealtimeOutputModality::Audio,
prompt: Some(Some("You are on a call".to_string())),
session_id: Some("sess_456".to_string()),
realtime_session_id: Some("sess_456".to_string()),
transport: None,
voice: Some(RealtimeVoice::Marin),
},
@@ -2571,7 +2571,7 @@ mod tests {
"threadId": "thr_123",
"outputModality": "audio",
"prompt": "You are on a call",
"sessionId": "sess_456",
"realtimeSessionId": "sess_456",
"transport": null,
"voice": "marin"
}
@@ -2589,7 +2589,7 @@ mod tests {
thread_id: "thr_123".to_string(),
output_modality: RealtimeOutputModality::Audio,
prompt: None,
session_id: None,
realtime_session_id: None,
transport: None,
voice: None,
},
@@ -2601,7 +2601,7 @@ mod tests {
"params": {
"threadId": "thr_123",
"outputModality": "audio",
"sessionId": null,
"realtimeSessionId": null,
"transport": null,
"voice": null
}
@@ -2615,7 +2615,7 @@ mod tests {
thread_id: "thr_123".to_string(),
output_modality: RealtimeOutputModality::Audio,
prompt: Some(None),
session_id: None,
realtime_session_id: None,
transport: None,
voice: None,
},
@@ -2628,7 +2628,7 @@ mod tests {
"threadId": "thr_123",
"outputModality": "audio",
"prompt": null,
"sessionId": null,
"realtimeSessionId": null,
"transport": null,
"voice": null
}
@@ -2642,7 +2642,7 @@ mod tests {
"params": {
"threadId": "thr_123",
"outputModality": "audio",
"sessionId": null,
"realtimeSessionId": null,
"transport": null,
"voice": null
}
@@ -2659,7 +2659,7 @@ mod tests {
"threadId": "thr_123",
"outputModality": "audio",
"prompt": null,
"sessionId": null,
"realtimeSessionId": null,
"transport": null,
"voice": null
}
@@ -2771,7 +2771,7 @@ mod tests {
thread_id: "thr_123".to_string(),
output_modality: RealtimeOutputModality::Audio,
prompt: Some(Some("You are on a call".to_string())),
session_id: None,
realtime_session_id: None,
transport: None,
voice: None,
},
@@ -2854,7 +2854,7 @@ mod tests {
let notification =
ServerNotification::ThreadRealtimeStarted(v2::ThreadRealtimeStartedNotification {
thread_id: "thr_123".to_string(),
session_id: Some("sess_456".to_string()),
realtime_session_id: Some("sess_456".to_string()),
version: RealtimeConversationVersion::V1,
});
let reason = crate::experimental_api::ExperimentalApi::experimental_reason(&notification);
@@ -5293,7 +5293,7 @@ pub struct ThreadRealtimeStartParams {
#[ts(optional = nullable)]
pub prompt: Option<Option<String>>,
#[ts(optional = nullable)]
pub session_id: Option<String>,
pub realtime_session_id: Option<String>,
#[ts(optional = nullable)]
pub transport: Option<ThreadRealtimeStartTransport>,
#[ts(optional = nullable)]
@@ -5383,7 +5383,7 @@ pub struct ThreadRealtimeListVoicesResponse {
#[ts(export_to = "v2/")]
pub struct ThreadRealtimeStartedNotification {
pub thread_id: String,
pub session_id: Option<String>,
pub realtime_session_id: Option<String>,
pub version: RealtimeConversationVersion,
}