mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
Keep rejected audio file IDs out of protocol events (#63667)
## Why Codex needs rejected audio file IDs when reconstructing a session so later model requests can omit those attachments. Clients only need the turn error. ## What changed Store rejected audio file IDs as rollout metadata and restore them from that metadata when replaying history. Keep the existing JSONL layout under `error.rejected_audio_file_ids` so older versions can still read newly written rollouts. ## Testing Add a regression test that round-trips a legacy rollout entry and verifies that serializing the protocol event omits the rejected IDs. GitOrigin-RevId: 982dd85d0037cebee056caf61d70988762e42767
This commit is contained in:
@@ -651,7 +651,6 @@ impl CodexErr {
|
||||
ErrorEvent {
|
||||
message,
|
||||
codex_error_info: Some(self.to_codex_protocol_error()),
|
||||
rejected_audio_file_ids: Vec::new(),
|
||||
misalignment: match &self.details {
|
||||
CodexErrorDetails::MisalignmentPolicyViolation { misalignment, .. } => {
|
||||
misalignment.clone()
|
||||
|
||||
@@ -2393,11 +2393,6 @@ pub struct ErrorEvent {
|
||||
pub message: String,
|
||||
#[serde(default)]
|
||||
pub codex_error_info: Option<CodexErrorInfo>,
|
||||
/// Host-only file identities proven rejected against the submitted request.
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
#[schemars(skip)]
|
||||
#[ts(skip)]
|
||||
pub rejected_audio_file_ids: Vec<String>,
|
||||
/// Sensitive explanation and steering are delivered live but never enter rollout storage.
|
||||
#[serde(skip)]
|
||||
#[schemars(skip)]
|
||||
@@ -6373,7 +6368,6 @@ mod tests {
|
||||
misalignment: None,
|
||||
message: "rollback failed".into(),
|
||||
codex_error_info: Some(CodexErrorInfo::ThreadRollbackFailed),
|
||||
rejected_audio_file_ids: Vec::new(),
|
||||
};
|
||||
assert!(!event.affects_turn_status());
|
||||
}
|
||||
@@ -6386,7 +6380,6 @@ mod tests {
|
||||
codex_error_info: Some(CodexErrorInfo::ActiveTurnNotSteerable {
|
||||
turn_kind: NonSteerableTurnKind::Review,
|
||||
}),
|
||||
rejected_audio_file_ids: Vec::new(),
|
||||
};
|
||||
assert!(!event.affects_turn_status());
|
||||
}
|
||||
@@ -6397,7 +6390,6 @@ mod tests {
|
||||
misalignment: None,
|
||||
message: "generic".into(),
|
||||
codex_error_info: Some(CodexErrorInfo::Other),
|
||||
rejected_audio_file_ids: Vec::new(),
|
||||
};
|
||||
assert!(event.affects_turn_status());
|
||||
}
|
||||
@@ -6407,7 +6399,6 @@ mod tests {
|
||||
let event = ErrorEvent {
|
||||
message: "This request violated the misalignment policy.".to_string(),
|
||||
codex_error_info: Some(CodexErrorInfo::MisalignmentPolicyViolation),
|
||||
rejected_audio_file_ids: Vec::new(),
|
||||
misalignment: Some(MisalignmentErrorDetails {
|
||||
error_type: Some("unauthorized_data_transfer".to_string()),
|
||||
detailed_explanation: Some("Sensitive customer explanation".to_string()),
|
||||
@@ -6436,22 +6427,6 @@ mod tests {
|
||||
assert!(!debug.contains("sensitive-review-target"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejected_audio_identity_round_trips_for_host_recovery() {
|
||||
let event = ErrorEvent {
|
||||
message: "invalid recording".to_string(),
|
||||
codex_error_info: Some(CodexErrorInfo::BadRequest),
|
||||
rejected_audio_file_ids: vec!["file_audio".to_string()],
|
||||
misalignment: None,
|
||||
};
|
||||
|
||||
let serialized = serde_json::to_value(&event).expect("serialize error event");
|
||||
assert_eq!(serialized["rejected_audio_file_ids"], json!(["file_audio"]));
|
||||
let restored: ErrorEvent =
|
||||
serde_json::from_value(serialized).expect("deserialize error event");
|
||||
assert_eq!(restored.rejected_audio_file_ids, vec!["file_audio"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn realtime_conversation_started_event_uses_realtime_session_id() {
|
||||
let event = RealtimeConversationStartedEvent {
|
||||
|
||||
Reference in New Issue
Block a user