feat(rollouts): store EventMsg::ApplyPatchEnd in limited history mode (#20463)

The Codex App treats apply patch tool calls quite load-bearing in the UI
(always shown on a completed turn), so we'd like to persist
`EventMsg::ApplyPatchEnd` to guarantee that when a client reconnects to
app-server mid-turn, we always have the full diff to display at the end
of that turn.
This commit is contained in:
Owen Lin
2026-04-30 12:11:02 -07:00
committed by GitHub
Unverified
parent 06f3b4836a
commit 7dd08e304c
+1 -40
View File
@@ -94,6 +94,7 @@ fn event_msg_persistence_mode(ev: &EventMsg) -> Option<EventPersistenceMode> {
| EventMsg::AgentMessage(_)
| EventMsg::AgentReasoning(_)
| EventMsg::AgentReasoningRawContent(_)
| EventMsg::PatchApplyEnd(_)
| EventMsg::TokenCount(_)
| EventMsg::ThreadNameUpdated(_)
| EventMsg::ContextCompacted(_)
@@ -119,7 +120,6 @@ fn event_msg_persistence_mode(ev: &EventMsg) -> Option<EventPersistenceMode> {
| EventMsg::GuardianAssessment(_)
| EventMsg::WebSearchEnd(_)
| EventMsg::ExecCommandEnd(_)
| EventMsg::PatchApplyEnd(_)
| EventMsg::McpToolCallEnd(_)
| EventMsg::ViewImageToolCall(_)
| EventMsg::CollabAgentSpawnEnd(_)
@@ -185,42 +185,3 @@ fn event_msg_persistence_mode(ev: &EventMsg) -> Option<EventPersistenceMode> {
| EventMsg::ImageGenerationBegin(_) => None,
}
}
#[cfg(test)]
mod tests {
use super::EventPersistenceMode;
use super::should_persist_event_msg;
use codex_protocol::ThreadId;
use codex_protocol::protocol::EventMsg;
use codex_protocol::protocol::ImageGenerationEndEvent;
use codex_protocol::protocol::ThreadNameUpdatedEvent;
#[test]
fn persists_image_generation_end_events_in_limited_mode() {
let event = EventMsg::ImageGenerationEnd(ImageGenerationEndEvent {
call_id: "ig_123".into(),
status: "completed".into(),
revised_prompt: Some("final prompt".into()),
result: "Zm9v".into(),
saved_path: None,
});
assert!(should_persist_event_msg(
&event,
EventPersistenceMode::Limited
));
}
#[test]
fn persists_thread_name_updates_in_limited_mode() {
let event = EventMsg::ThreadNameUpdated(ThreadNameUpdatedEvent {
thread_id: ThreadId::new(),
thread_name: Some("saved-session".to_string()),
});
assert!(should_persist_event_msg(
&event,
EventPersistenceMode::Limited
));
}
}