Move default realtime prompt into core (#17165)

- Adds a core-owned realtime backend prompt template and preparation
path.
- Makes omitted realtime start prompts use the core default, while null
or empty prompts intentionally send empty instructions.
- Covers the core realtime path and app-server v2 path with integration
coverage.

---------

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Ahmed Ibrahim
2026-04-08 19:34:40 -07:00
committed by GitHub
parent 36586eafed
commit 4c2a1ae31b
17 changed files with 491 additions and 59 deletions

View File

@@ -1761,7 +1761,7 @@ mod tests {
request_id: RequestId::Integer(9),
params: v2::ThreadRealtimeStartParams {
thread_id: "thr_123".to_string(),
prompt: "You are on a call".to_string(),
prompt: Some(Some("You are on a call".to_string())),
session_id: Some("sess_456".to_string()),
transport: None,
},
@@ -1782,6 +1782,85 @@ mod tests {
Ok(())
}
#[test]
fn serialize_thread_realtime_start_prompt_default_and_null() -> Result<()> {
let default_prompt_request = ClientRequest::ThreadRealtimeStart {
request_id: RequestId::Integer(9),
params: v2::ThreadRealtimeStartParams {
thread_id: "thr_123".to_string(),
prompt: None,
session_id: None,
transport: None,
},
};
assert_eq!(
json!({
"method": "thread/realtime/start",
"id": 9,
"params": {
"threadId": "thr_123",
"sessionId": null,
"transport": null
}
}),
serde_json::to_value(&default_prompt_request)?,
);
let null_prompt_request = ClientRequest::ThreadRealtimeStart {
request_id: RequestId::Integer(9),
params: v2::ThreadRealtimeStartParams {
thread_id: "thr_123".to_string(),
prompt: Some(None),
session_id: None,
transport: None,
},
};
assert_eq!(
json!({
"method": "thread/realtime/start",
"id": 9,
"params": {
"threadId": "thr_123",
"prompt": null,
"sessionId": null,
"transport": null
}
}),
serde_json::to_value(&null_prompt_request)?,
);
let default_prompt_value = json!({
"method": "thread/realtime/start",
"id": 9,
"params": {
"threadId": "thr_123",
"sessionId": null,
"transport": null
}
});
assert_eq!(
serde_json::from_value::<ClientRequest>(default_prompt_value)?,
default_prompt_request,
);
let null_prompt_value = json!({
"method": "thread/realtime/start",
"id": 9,
"params": {
"threadId": "thr_123",
"prompt": null,
"sessionId": null,
"transport": null
}
});
assert_eq!(
serde_json::from_value::<ClientRequest>(null_prompt_value)?,
null_prompt_request,
);
Ok(())
}
#[test]
fn serialize_thread_status_changed_notification() -> Result<()> {
let notification =
@@ -1852,7 +1931,7 @@ mod tests {
request_id: RequestId::Integer(1),
params: v2::ThreadRealtimeStartParams {
thread_id: "thr_123".to_string(),
prompt: "You are on a call".to_string(),
prompt: Some(Some("You are on a call".to_string())),
session_id: None,
transport: None,
},