mirror of
https://github.com/openai/codex.git
synced 2026-11-16 22:00:36 +00:00
## What changed - Make `TimeProvider::current_time` and `CodexThread::current_time` synchronous, with clock reads required to avoid yielding or calling back into the session. - Remove the experimental `currentTime/read` app-server request and its client-backed clock and sleep polling implementation. - Require a host-provided `TimeProvider` for external clocks. App-server thread startup now fails when `features.current_time_reminder.clock_source = "external"` has no provider. ## Testing Add coverage for external provider selection and rejection of app-server thread startup without an external provider. GitOrigin-RevId: 09479d6eb28453b343dee78b3673092e73ae5d73
41 lines
1.3 KiB
Rust
41 lines
1.3 KiB
Rust
//! Explicit external time requires a native clock on the app-server.
|
|
use anyhow::Result;
|
|
use app_test_support::MockResponsesConfig;
|
|
use app_test_support::TestAppServer;
|
|
use codex_app_server_protocol::RequestId;
|
|
use codex_app_server_protocol::ThreadStartParams;
|
|
use core_test_support::responses;
|
|
use core_test_support::skip_if_no_network;
|
|
use tempfile::TempDir;
|
|
|
|
#[tokio::test]
|
|
async fn external_time_without_native_provider_fails_thread_start() -> Result<()> {
|
|
skip_if_no_network!(Ok(()));
|
|
let server = responses::start_mock_server().await;
|
|
let home = TempDir::new()?;
|
|
MockResponsesConfig::new(&server.uri())
|
|
.with_extra_config(
|
|
"[features.current_time_reminder]\nenabled = true\nclock_source = \"external\"",
|
|
)
|
|
.write(home.path())?;
|
|
let mut app_server = TestAppServer::builder()
|
|
.with_codex_home(home.path())
|
|
.build_initialized()
|
|
.await?;
|
|
let id = app_server
|
|
.send_thread_start_request_with_auto_env(ThreadStartParams::default())
|
|
.await?;
|
|
let error = app_server
|
|
.read_stream_until_error_message(RequestId::Integer(id))
|
|
.await?;
|
|
assert!(
|
|
error
|
|
.error
|
|
.message
|
|
.contains("no external current-time provider"),
|
|
"{}",
|
|
error.error.message
|
|
);
|
|
Ok(())
|
|
}
|