mirror of
https://github.com/openai/codex.git
synced 2026-10-27 00:00:53 +00:00
Allow custom Codex instructions for realtime transitions (#36408)
## What changed - Add optional `realtimeStartInstructions` and `realtimeEndInstructions` fields to `thread/realtime/start`. - Apply the instructions when Codex enters and leaves realtime mode, while preserving the existing defaults when either field is omitted. - Limit each field to 8,192 estimated tokens. ## Testing - Cover custom entry and exit instructions across realtime state transitions. - Cover token-limit validation for both fields. GitOrigin-RevId: b9cfa1ff22e084d8a6b2ed56bd27d95ffdd6b6bd
This commit is contained in:
@@ -8808,7 +8808,7 @@ async fn record_context_updates_emits_realtime_end_when_session_stops_being_live
|
||||
assert!(
|
||||
developer_texts
|
||||
.iter()
|
||||
.any(|text| text.contains("Reason: inactive")),
|
||||
.any(|text| text.contains("<realtime_conversation>")),
|
||||
"expected a realtime end update, got {developer_texts:?}"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -96,12 +96,19 @@ impl Session {
|
||||
{
|
||||
world_state.add_section(ContextWindowGuidanceState::new(guidance));
|
||||
}
|
||||
let realtime_mode_instructions = self.conversation.mode_instructions().await;
|
||||
world_state.add_section(RealtimeState::new(
|
||||
turn_context.realtime_active,
|
||||
turn_context
|
||||
.config
|
||||
.experimental_realtime_start_instructions
|
||||
.as_deref(),
|
||||
realtime_mode_instructions
|
||||
.as_ref()
|
||||
.and_then(|instructions| instructions.start.as_deref())
|
||||
.or(turn_context
|
||||
.config
|
||||
.experimental_realtime_start_instructions
|
||||
.as_deref()),
|
||||
realtime_mode_instructions
|
||||
.as_ref()
|
||||
.and_then(|instructions| instructions.end.as_deref()),
|
||||
));
|
||||
world_state.add_section(AgentsMdState::new(step_context.loaded_agents_md.as_deref()));
|
||||
if turn_context.config.include_permissions_instructions {
|
||||
|
||||
Reference in New Issue
Block a user