Move sleep items to the extension-owned lifecycle path (#33159)

## What changed

- Define `SleepItem` in `codex-extension-items` and carry `clock.sleep` events through `TurnItem::Extension`.
- Preserve sleep persistence, thread-history reconstruction, and the app-server's `type: "sleep"` schema while reusing the extension-owned type.

## Testing

- Add serialization coverage for the `clock.sleep` extension wire shape and its protocol wrapper.
- Update sleep lifecycle and thread-history tests to exercise the extension-owned item.

GitOrigin-RevId: 34bb33ed9b90a09bf4744aafdb56e019c717a168
This commit is contained in:
pakrym-oai authored and copyberry committed 2026-07-14 21:01:54 +00:00
1 parent 83a4187837
commit 5d325ba223
41 files changed
+141 -55

No files matched your search

+23
View File
@@ -3,6 +3,7 @@ use serde_json::json;
use super::ExtensionItem;
use super::image_generation::ImageGenerationItem;
use super::sleep::SleepItem;
use super::web_search::WebSearchAction;
use super::web_search::WebSearchItem;
@@ -84,6 +85,28 @@ fn web_search_item_preserves_stable_wire_shape() {
);
}
#[test]
fn sleep_item_preserves_stable_wire_shape() {
let item = ExtensionItem::Sleep(SleepItem {
id: "sleep-1".to_string(),
duration_ms: 1_000,
});
let value = serde_json::to_value(&item).expect("serialize extension item");
assert_eq!(
value,
json!({
"kind": "clock.sleep",
"id": "sleep-1",
"durationMs": 1_000,
})
);
assert_eq!(
serde_json::from_value::<ExtensionItem>(value).expect("deserialize extension item"),
item
);
}
#[test]
fn unknown_extension_kind_is_rejected() {
let value = json!({