Lightweight coding agent that runs in your terminal
Rust
Tag current time reminders in model context (#38443)
rka-oai3ba52d6075bb
diff --git a/codex-rs/app-server/tests/suite/v2/current_time.rs b/codex-rs/app-server/tests/suite/v2/current_time.rsindex 9f8ae49d46..d311acd9a7 100644--- a/codex-rs/app-server/tests/suite/v2/current_time.rs+++ b/codex-rs/app-server/tests/suite/v2/current_time.rs@@ -26,7 +26,8 @@ const DEFAULT_READ_TIMEOUT: Duration = Duration::from_secs(25);#[cfg(not(windows))]const DEFAULT_READ_TIMEOUT: Duration = Duration::from_secs(10);const CURRENT_TIME_AT: i64 = 1_781_717_655;-const CURRENT_TIME_REMINDER: &str = "It is 2026-06-17 17:34:15 UTC.";+const CURRENT_TIME_REMINDER: &str =+ "<current_time_reminder>It is 2026-06-17 17:34:15 UTC.</current_time_reminder>";#[tokio::test]async fn current_time_read_round_trip_adds_reminder_to_model_input() -> Result<()> {diff --git a/codex-rs/core/src/context/current_time_reminder.rs b/codex-rs/core/src/context/current_time_reminder.rsindex 0baf56b281..7b6b61da5c 100644--- a/codex-rs/core/src/context/current_time_reminder.rs+++ b/codex-rs/core/src/context/current_time_reminder.rs@@ -29,7 +29,7 @@ impl ContextualUserFragment for CurrentTimeReminder {}fn type_markers() -> (&'static str, &'static str) {- ("", "")+ ("<current_time_reminder>", "</current_time_reminder>")}fn body(&self) -> String {diff --git a/codex-rs/core/src/tools/handlers/current_time.rs b/codex-rs/core/src/tools/handlers/current_time.rsindex d03e7ffb0a..983e33e23d 100644--- a/codex-rs/core/src/tools/handlers/current_time.rs+++ b/codex-rs/core/src/tools/handlers/current_time.rs@@ -26,7 +26,7 @@ struct CurrentTimeOutput(CurrentTimeReminder);impl ToolOutput for CurrentTimeOutput {fn log_preview(&self) -> String {- self.0.render()+ self.0.body()}fn success_for_logging(&self) -> bool {@@ -34,8 +34,7 @@ impl ToolOutput for CurrentTimeOutput {}fn to_response_item(&self, call_id: &str, payload: &ToolPayload) -> ResponseInputItem {- FunctionToolOutput::from_text(self.0.render(), Some(true))- .to_response_item(call_id, payload)+ FunctionToolOutput::from_text(self.0.body(), Some(true)).to_response_item(call_id, payload)}fn code_mode_result(&self, _payload: &ToolPayload) -> JsonValue {diff --git a/codex-rs/core/tests/suite/current_time_reminder.rs b/codex-rs/core/tests/suite/current_time_reminder.rsindex 44fe2ad6c1..2cdac3c78e 100644--- a/codex-rs/core/tests/suite/current_time_reminder.rs+++ b/codex-rs/core/tests/suite/current_time_reminder.rs@@ -41,10 +41,14 @@ use core_test_support::wait_for_event;use pretty_assertions::assert_eq;use serde_json::json;-const FIRST_REMINDER: &str = "It is 2026-06-17 17:34:15 UTC.";-const EARLIER_REMINDER: &str = "It is 2026-06-17 17:33:15 UTC.";-const SECOND_REMINDER: &str = "It is 2026-06-17 17:35:15 UTC.";-const THIRD_REMINDER: &str = "It is 2026-06-17 17:36:15 UTC.";+const FIRST_REMINDER: &str =+ "<current_time_reminder>It is 2026-06-17 17:34:15 UTC.</current_time_reminder>";+const EARLIER_REMINDER: &str =+ "<current_time_reminder>It is 2026-06-17 17:33:15 UTC.</current_time_reminder>";+const SECOND_REMINDER: &str =+ "<current_time_reminder>It is 2026-06-17 17:35:15 UTC.</current_time_reminder>";+const THIRD_REMINDER: &str =+ "<current_time_reminder>It is 2026-06-17 17:36:15 UTC.</current_time_reminder>";const FIRST_TIME_UNIX_SECONDS: i64 = 1_781_717_655;struct TestTimeProvider {@@ -93,7 +97,7 @@ fn current_time_reminders(request: &ResponsesRequest) -> Vec<String> {request.message_input_texts("developer").into_iter()- .filter(|text| text.starts_with("It is "))+ .filter(|text| text.starts_with("<current_time_reminder>")).collect()}@@ -340,7 +344,7 @@ async fn system_time_source_adds_current_time_reminder() -> Result<()> {let reminders = current_time_reminders(&responses.single_request());assert_eq!(reminders.len(), 1);assert_regex_match(- r"^It is \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} UTC\.$",+ r"^<current_time_reminder>It is \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} UTC\.</current_time_reminder>$",&reminders[0],);@@ -495,7 +499,7 @@ async fn current_time_tool_returns_the_latest_time() -> Result<()> {);assert_eq!(requests[1].function_call_output_text(CALL_ID),- Some(SECOND_REMINDER.to_string())+ Some("It is 2026-06-17 17:35:15 UTC.".to_string()));Ok(())