Make external sleep notifications lossless

This commit is contained in:
Rohit Arunachalam
2026-06-25 03:07:03 -07:00
parent 950b702fe7
commit 1329b0b013
2 changed files with 21 additions and 0 deletions
+12
View File
@@ -167,6 +167,7 @@ pub(crate) fn server_notification_requires_delivery(notification: &ServerNotific
| ServerNotification::ThreadSettingsUpdated(_)
| ServerNotification::ItemCompleted(_)
| ServerNotification::ExternalAgentConfigImportCompleted(_)
| ServerNotification::CurrentTimeSleep(_)
| ServerNotification::AgentMessageDelta(_)
| ServerNotification::PlanDelta(_)
| ServerNotification::ReasoningSummaryTextDelta(_)
@@ -2192,6 +2193,17 @@ mod tests {
)
)
));
assert!(event_requires_delivery(
&InProcessServerEvent::ServerNotification(
codex_app_server_protocol::ServerNotification::CurrentTimeSleep(
codex_app_server_protocol::CurrentTimeSleepNotification {
thread_id: "thread".to_string(),
sleep_id: "sleep".to_string(),
duration_ms: 1_000,
},
)
)
));
assert!(!event_requires_delivery(&InProcessServerEvent::Lagged {
skipped: 1
}));
+9
View File
@@ -107,6 +107,7 @@ fn server_notification_requires_delivery(notification: &ServerNotification) -> b
ServerNotification::TurnCompleted(_)
| ServerNotification::ThreadSettingsUpdated(_)
| ServerNotification::ExternalAgentConfigImportCompleted(_)
| ServerNotification::CurrentTimeSleep(_)
)
}
@@ -731,6 +732,7 @@ mod tests {
use super::*;
use codex_app_server_protocol::ClientInfo;
use codex_app_server_protocol::ConfigRequirementsReadResponse;
use codex_app_server_protocol::CurrentTimeSleepNotification;
use codex_app_server_protocol::ExternalAgentConfigImportCompletedNotification;
use codex_app_server_protocol::SessionSource as ApiSessionSource;
use codex_app_server_protocol::ThreadStartParams;
@@ -904,5 +906,12 @@ mod tests {
},
)
));
assert!(server_notification_requires_delivery(
&ServerNotification::CurrentTimeSleep(CurrentTimeSleepNotification {
thread_id: "thread-1".to_string(),
sleep_id: "sleep-1".to_string(),
duration_ms: 1_000,
})
));
}
}