[codex] route sleep through time providers (#29973)

## Summary

- add a cancellable sleep operation to `TimeProvider`
- route `clock.sleep` through the configured provider
- extend the supported sleep duration to 12 hours
- complete the sleep turn item before propagating provider failures

## Why

This isolates the core clock abstraction needed by external clock
integrations. Existing system and app-server behavior remains wall-clock
based in this PR; the stacked follow-up supplies app-server sleeps from
an external clock.
This commit is contained in:
rka-oai
2026-06-24 22:17:43 -07:00
committed by GitHub
Unverified
parent 22f12568e1
commit f66d793a2d
5 changed files with 130 additions and 12 deletions
+8
View File
@@ -10,6 +10,7 @@ use chrono::Utc;
use codex_app_server_protocol::CurrentTimeReadParams;
use codex_app_server_protocol::CurrentTimeReadResponse;
use codex_app_server_protocol::ServerRequestPayload;
use codex_core::SleepFuture;
use codex_core::TimeFuture;
use codex_core::TimeProvider;
use codex_protocol::ThreadId;
@@ -49,6 +50,13 @@ impl TimeProvider for AppServerTimeProvider {
request_current_time(outgoing, thread_state_manager, thread_id).await
})
}
fn sleep(&self, _thread_id: ThreadId, duration: Duration) -> SleepFuture<'_> {
Box::pin(async move {
tokio::time::sleep(duration).await;
Ok(())
})
}
}
async fn request_current_time(