Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

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

Owen Lin7dd08e304ce8
diff --git a/codex-rs/rollout/src/policy.rs b/codex-rs/rollout/src/policy.rs
index 22615623f3..e6e4de862d 100644
--- a/codex-rs/rollout/src/policy.rs
+++ b/codex-rs/rollout/src/policy.rs
@@ -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
- ));
- }
-}