From 50e02cbeb3b4e1fa33edc9f86ec5ebb70ca8d933 Mon Sep 17 00:00:00 2001 From: raju Date: Wed, 13 May 2026 21:37:21 -0700 Subject: [PATCH] Support initial Codex time context overrides --- .../schema/json/ClientRequest.json | 42 +++++++++++++++++++ .../codex_app_server_protocol.schemas.json | 42 +++++++++++++++++++ .../codex_app_server_protocol.v2.schemas.json | 42 +++++++++++++++++++ .../schema/json/v2/ThreadResumeParams.json | 14 +++++++ .../schema/json/v2/ThreadStartParams.json | 14 +++++++ .../schema/json/v2/TurnStartParams.json | 14 +++++++ .../typescript/v2/ThreadResumeParams.ts | 10 ++++- .../schema/typescript/v2/ThreadStartParams.ts | 10 ++++- .../schema/typescript/v2/TurnStartParams.ts | 8 ++++ .../src/protocol/v2/thread.rs | 16 +++++++ .../request_processors/thread_processor.rs | 14 +++++++ .../thread_processor_tests.rs | 2 + .../app-server/tests/suite/v2/skills_list.rs | 2 + codex-rs/core/src/config/config_tests.rs | 8 ++++ codex-rs/core/src/config/mod.rs | 14 +++++++ codex-rs/core/src/session/mod.rs | 4 +- codex-rs/core/src/session/tests.rs | 39 ++++++++++++----- codex-rs/exec/src/lib.rs | 4 ++ codex-rs/tui/src/app_server_session.rs | 4 ++ 19 files changed, 289 insertions(+), 14 deletions(-) diff --git a/codex-rs/app-server-protocol/schema/json/ClientRequest.json b/codex-rs/app-server-protocol/schema/json/ClientRequest.json index cb14a3a91a..4735ea2e64 100644 --- a/codex-rs/app-server-protocol/schema/json/ClientRequest.json +++ b/codex-rs/app-server-protocol/schema/json/ClientRequest.json @@ -3763,6 +3763,13 @@ "null" ] }, + "currentDate": { + "description": "Override the current date shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] + }, "cwd": { "type": [ "string", @@ -3816,6 +3823,13 @@ }, "threadId": { "type": "string" + }, + "timezone": { + "description": "Override the timezone shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] } }, "required": [ @@ -3938,6 +3952,13 @@ "null" ] }, + "currentDate": { + "description": "Override the current date shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] + }, "cwd": { "type": [ "string", @@ -4020,6 +4041,13 @@ } ], "description": "Optional client-supplied analytics source classification for this thread." + }, + "timezone": { + "description": "Override the timezone shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] } }, "type": "object" @@ -4132,6 +4160,13 @@ ], "description": "Override where approval requests are routed for review on this turn and subsequent turns." }, + "currentDate": { + "description": "Override the current date shown in the model-visible environment context for this turn and subsequent turns.", + "type": [ + "string", + "null" + ] + }, "cwd": { "description": "Override the working directory for this turn and subsequent turns.", "type": [ @@ -4208,6 +4243,13 @@ }, "threadId": { "type": "string" + }, + "timezone": { + "description": "Override the timezone shown in the model-visible environment context for this turn and subsequent turns.", + "type": [ + "string", + "null" + ] } }, "required": [ diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json index 0130e97653..2da52dc303 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json @@ -16815,6 +16815,13 @@ "null" ] }, + "currentDate": { + "description": "Override the current date shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] + }, "cwd": { "type": [ "string", @@ -16868,6 +16875,13 @@ }, "threadId": { "type": "string" + }, + "timezone": { + "description": "Override the timezone shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] } }, "required": [ @@ -17097,6 +17111,13 @@ "null" ] }, + "currentDate": { + "description": "Override the current date shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] + }, "cwd": { "type": [ "string", @@ -17179,6 +17200,13 @@ } ], "description": "Optional client-supplied analytics source classification for this thread." + }, + "timezone": { + "description": "Override the timezone shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] } }, "title": "ThreadStartParams", @@ -17846,6 +17874,13 @@ ], "description": "Override where approval requests are routed for review on this turn and subsequent turns." }, + "currentDate": { + "description": "Override the current date shown in the model-visible environment context for this turn and subsequent turns.", + "type": [ + "string", + "null" + ] + }, "cwd": { "description": "Override the working directory for this turn and subsequent turns.", "type": [ @@ -17922,6 +17957,13 @@ }, "threadId": { "type": "string" + }, + "timezone": { + "description": "Override the timezone shown in the model-visible environment context for this turn and subsequent turns.", + "type": [ + "string", + "null" + ] } }, "required": [ diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json index 66180b11e1..e8cdd912ce 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json @@ -14639,6 +14639,13 @@ "null" ] }, + "currentDate": { + "description": "Override the current date shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] + }, "cwd": { "type": [ "string", @@ -14692,6 +14699,13 @@ }, "threadId": { "type": "string" + }, + "timezone": { + "description": "Override the timezone shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] } }, "required": [ @@ -14921,6 +14935,13 @@ "null" ] }, + "currentDate": { + "description": "Override the current date shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] + }, "cwd": { "type": [ "string", @@ -15003,6 +15024,13 @@ } ], "description": "Optional client-supplied analytics source classification for this thread." + }, + "timezone": { + "description": "Override the timezone shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] } }, "title": "ThreadStartParams", @@ -15670,6 +15698,13 @@ ], "description": "Override where approval requests are routed for review on this turn and subsequent turns." }, + "currentDate": { + "description": "Override the current date shown in the model-visible environment context for this turn and subsequent turns.", + "type": [ + "string", + "null" + ] + }, "cwd": { "description": "Override the working directory for this turn and subsequent turns.", "type": [ @@ -15746,6 +15781,13 @@ }, "threadId": { "type": "string" + }, + "timezone": { + "description": "Override the timezone shown in the model-visible environment context for this turn and subsequent turns.", + "type": [ + "string", + "null" + ] } }, "required": [ diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeParams.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeParams.json index 5f07fe0149..475b2bf3c8 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeParams.json @@ -1048,6 +1048,13 @@ "null" ] }, + "currentDate": { + "description": "Override the current date shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] + }, "cwd": { "type": [ "string", @@ -1101,6 +1108,13 @@ }, "threadId": { "type": "string" + }, + "timezone": { + "description": "Override the timezone shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] } }, "required": [ diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartParams.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartParams.json index 9a60049a61..65740fc013 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartParams.json @@ -231,6 +231,13 @@ "null" ] }, + "currentDate": { + "description": "Override the current date shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] + }, "cwd": { "type": [ "string", @@ -313,6 +320,13 @@ } ], "description": "Optional client-supplied analytics source classification for this thread." + }, + "timezone": { + "description": "Override the timezone shown in the model-visible environment context for this thread and subsequent turns.", + "type": [ + "string", + "null" + ] } }, "title": "ThreadStartParams", diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json b/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json index 1ef33d4301..003d5d42fb 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json @@ -522,6 +522,13 @@ ], "description": "Override where approval requests are routed for review on this turn and subsequent turns." }, + "currentDate": { + "description": "Override the current date shown in the model-visible environment context for this turn and subsequent turns.", + "type": [ + "string", + "null" + ] + }, "cwd": { "description": "Override the working directory for this turn and subsequent turns.", "type": [ @@ -598,6 +605,13 @@ }, "threadId": { "type": "string" + }, + "timezone": { + "description": "Override the timezone shown in the model-visible environment context for this turn and subsequent turns.", + "type": [ + "string", + "null" + ] } }, "required": [ diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ThreadResumeParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadResumeParams.ts index 6d1dbdca4f..ab3f541ea5 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/ThreadResumeParams.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadResumeParams.ts @@ -25,4 +25,12 @@ model?: string | null, modelProvider?: string | null, serviceTier?: string | nul * Override where approval requests are routed for review on this thread * and subsequent turns. */ -approvalsReviewer?: ApprovalsReviewer | null, sandbox?: SandboxMode | null, config?: { [key in string]?: JsonValue } | null, baseInstructions?: string | null, developerInstructions?: string | null, personality?: Personality | null}; +approvalsReviewer?: ApprovalsReviewer | null, sandbox?: SandboxMode | null, config?: { [key in string]?: JsonValue } | null, baseInstructions?: string | null, developerInstructions?: string | null, /** + * Override the current date shown in the model-visible environment + * context for this thread and subsequent turns. + */ +currentDate?: string | null, /** + * Override the timezone shown in the model-visible environment context + * for this thread and subsequent turns. + */ +timezone?: string | null, personality?: Personality | null}; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/ThreadStartParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadStartParams.ts index 30509ef6cb..043e453db6 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/ThreadStartParams.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadStartParams.ts @@ -13,7 +13,15 @@ export type ThreadStartParams = {model?: string | null, modelProvider?: string | * Override where approval requests are routed for review on this thread * and subsequent turns. */ -approvalsReviewer?: ApprovalsReviewer | null, sandbox?: SandboxMode | null, config?: { [key in string]?: JsonValue } | null, serviceName?: string | null, baseInstructions?: string | null, developerInstructions?: string | null, personality?: Personality | null, ephemeral?: boolean | null, sessionStartSource?: ThreadStartSource | null, /** +approvalsReviewer?: ApprovalsReviewer | null, sandbox?: SandboxMode | null, config?: { [key in string]?: JsonValue } | null, serviceName?: string | null, baseInstructions?: string | null, developerInstructions?: string | null, /** + * Override the current date shown in the model-visible environment + * context for this thread and subsequent turns. + */ +currentDate?: string | null, /** + * Override the timezone shown in the model-visible environment context + * for this thread and subsequent turns. + */ +timezone?: string | null, personality?: Personality | null, ephemeral?: boolean | null, sessionStartSource?: ThreadStartSource | null, /** * Optional client-supplied analytics source classification for this thread. */ threadSource?: ThreadSource | null}; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/TurnStartParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/TurnStartParams.ts index b04919d86b..436d50b9f3 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/TurnStartParams.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/TurnStartParams.ts @@ -14,6 +14,14 @@ export type TurnStartParams = {threadId: string, input: Array, /** * Override the working directory for this turn and subsequent turns. */ cwd?: string | null, /** + * Override the current date shown in the model-visible environment context + * for this turn and subsequent turns. + */ +currentDate?: string | null, /** + * Override the timezone shown in the model-visible environment context for + * this turn and subsequent turns. + */ +timezone?: string | null, /** * Override the approval policy for this turn and subsequent turns. */ approvalPolicy?: AskForApproval | null, /** diff --git a/codex-rs/app-server-protocol/src/protocol/v2/thread.rs b/codex-rs/app-server-protocol/src/protocol/v2/thread.rs index 458722b3a2..a80950f9c3 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2/thread.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2/thread.rs @@ -130,6 +130,14 @@ pub struct ThreadStartParams { pub base_instructions: Option, #[ts(optional = nullable)] pub developer_instructions: Option, + /// Override the current date shown in the model-visible environment + /// context for this thread and subsequent turns. + #[ts(optional = nullable)] + pub current_date: Option, + /// Override the timezone shown in the model-visible environment context + /// for this thread and subsequent turns. + #[ts(optional = nullable)] + pub timezone: Option, #[ts(optional = nullable)] pub personality: Option, #[ts(optional = nullable)] @@ -285,6 +293,14 @@ pub struct ThreadResumeParams { pub base_instructions: Option, #[ts(optional = nullable)] pub developer_instructions: Option, + /// Override the current date shown in the model-visible environment + /// context for this thread and subsequent turns. + #[ts(optional = nullable)] + pub current_date: Option, + /// Override the timezone shown in the model-visible environment context + /// for this thread and subsequent turns. + #[ts(optional = nullable)] + pub timezone: Option, #[ts(optional = nullable)] pub personality: Option, /// When true, return only thread metadata and live-resume state without diff --git a/codex-rs/app-server/src/request_processors/thread_processor.rs b/codex-rs/app-server/src/request_processors/thread_processor.rs index 015ae5daf6..367731b697 100644 --- a/codex-rs/app-server/src/request_processors/thread_processor.rs +++ b/codex-rs/app-server/src/request_processors/thread_processor.rs @@ -806,6 +806,8 @@ impl ThreadRequestProcessor { service_name, base_instructions, developer_instructions, + current_date, + timezone, dynamic_tools, mock_experimental_field: _mock_experimental_field, experimental_raw_events, @@ -837,6 +839,8 @@ impl ThreadRequestProcessor { permissions, base_instructions, developer_instructions, + current_date, + timezone, personality, ); typesafe_overrides.ephemeral = ephemeral; @@ -1201,6 +1205,8 @@ impl ThreadRequestProcessor { permissions: Option, base_instructions: Option, developer_instructions: Option, + current_date: Option, + timezone: Option, personality: Option, ) -> ConfigOverrides { let mut overrides = ConfigOverrides { @@ -1217,6 +1223,8 @@ impl ThreadRequestProcessor { main_execve_wrapper_exe: self.arg0_paths.main_execve_wrapper_exe.clone(), base_instructions, developer_instructions, + current_date, + timezone, personality, ..Default::default() }; @@ -2369,6 +2377,8 @@ impl ThreadRequestProcessor { config: mut request_overrides, base_instructions, developer_instructions, + current_date, + timezone, personality, exclude_turns, persist_extended_history: _persist_extended_history, @@ -2403,6 +2413,8 @@ impl ThreadRequestProcessor { permissions, base_instructions, developer_instructions, + current_date, + timezone, personality, ); self.load_and_apply_persisted_resume_metadata( @@ -3063,6 +3075,8 @@ impl ThreadRequestProcessor { permissions, base_instructions, developer_instructions, + /*current_date*/ None, + /*timezone*/ None, /*personality*/ None, ); typesafe_overrides.ephemeral = ephemeral.then_some(true); diff --git a/codex-rs/app-server/src/request_processors/thread_processor_tests.rs b/codex-rs/app-server/src/request_processors/thread_processor_tests.rs index 5068f19963..f8a32c73de 100644 --- a/codex-rs/app-server/src/request_processors/thread_processor_tests.rs +++ b/codex-rs/app-server/src/request_processors/thread_processor_tests.rs @@ -637,6 +637,8 @@ mod thread_processor_behavior_tests { config: None, base_instructions: None, developer_instructions: None, + current_date: None, + timezone: None, personality: None, exclude_turns: false, persist_extended_history: false, diff --git a/codex-rs/app-server/tests/suite/v2/skills_list.rs b/codex-rs/app-server/tests/suite/v2/skills_list.rs index 39dae06bd0..6ded7e14eb 100644 --- a/codex-rs/app-server/tests/suite/v2/skills_list.rs +++ b/codex-rs/app-server/tests/suite/v2/skills_list.rs @@ -592,6 +592,8 @@ async fn skills_changed_notification_is_emitted_after_skill_change() -> Result<( service_name: None, base_instructions: None, developer_instructions: None, + current_date: None, + timezone: None, personality: None, ephemeral: None, session_start_source: None, diff --git a/codex-rs/core/src/config/config_tests.rs b/codex-rs/core/src/config/config_tests.rs index 9bda54a9a7..ebb565aa2b 100644 --- a/codex-rs/core/src/config/config_tests.rs +++ b/codex-rs/core/src/config/config_tests.rs @@ -7043,6 +7043,8 @@ async fn test_precedence_fixture_with_o3_profile() -> std::io::Result<()> { experimental_thread_store: ThreadStoreConfig::Local, base_instructions: None, developer_instructions: None, + current_date: None, + timezone: None, guardian_policy_config: None, include_permissions_instructions: true, include_apps_instructions: true, @@ -7463,6 +7465,8 @@ async fn test_precedence_fixture_with_gpt3_profile() -> std::io::Result<()> { experimental_thread_store: ThreadStoreConfig::Local, base_instructions: None, developer_instructions: None, + current_date: None, + timezone: None, guardian_policy_config: None, include_permissions_instructions: true, include_apps_instructions: true, @@ -7621,6 +7625,8 @@ async fn test_precedence_fixture_with_zdr_profile() -> std::io::Result<()> { experimental_thread_store: ThreadStoreConfig::Local, base_instructions: None, developer_instructions: None, + current_date: None, + timezone: None, guardian_policy_config: None, include_permissions_instructions: true, include_apps_instructions: true, @@ -7764,6 +7770,8 @@ async fn test_precedence_fixture_with_gpt5_profile() -> std::io::Result<()> { experimental_thread_store: ThreadStoreConfig::Local, base_instructions: None, developer_instructions: None, + current_date: None, + timezone: None, guardian_policy_config: None, include_permissions_instructions: true, include_apps_instructions: true, diff --git a/codex-rs/core/src/config/mod.rs b/codex-rs/core/src/config/mod.rs index b1277eda48..44bf7ca43f 100644 --- a/codex-rs/core/src/config/mod.rs +++ b/codex-rs/core/src/config/mod.rs @@ -449,6 +449,14 @@ pub struct Config { /// Developer instructions override injected as a separate message. pub developer_instructions: Option, + /// Optional current date override shown in the model-visible environment + /// context for this session. + pub current_date: Option, + + /// Optional timezone override shown in the model-visible environment + /// context for this session. + pub timezone: Option, + /// Guardian-specific policy config override from requirements.toml or config.toml. /// This is inserted into the fixed guardian prompt template under the /// `# Policy Configuration` section rather than replacing the whole @@ -1867,6 +1875,8 @@ pub struct ConfigOverrides { pub zsh_path: Option, pub base_instructions: Option, pub developer_instructions: Option, + pub current_date: Option, + pub timezone: Option, pub personality: Option, pub compact_prompt: Option, pub include_apply_patch_tool: Option, @@ -2142,6 +2152,8 @@ impl Config { zsh_path: zsh_path_override, base_instructions, developer_instructions, + current_date, + timezone, personality, compact_prompt, include_apply_patch_tool: include_apply_patch_tool_override, @@ -2999,6 +3011,8 @@ impl Config { base_instructions, personality, developer_instructions, + current_date, + timezone, compact_prompt, commit_attribution, include_permissions_instructions, diff --git a/codex-rs/core/src/session/mod.rs b/codex-rs/core/src/session/mod.rs index ec97da0989..7fc4f302f5 100644 --- a/codex-rs/core/src/session/mod.rs +++ b/codex-rs/core/src/session/mod.rs @@ -620,8 +620,8 @@ impl Codex { active_permission_profile: config.permissions.active_permission_profile(), windows_sandbox_level: WindowsSandboxLevel::from_config(&config), cwd: config.cwd.clone(), - current_date: None, - timezone: None, + current_date: config.current_date.clone(), + timezone: config.timezone.clone(), codex_home: config.codex_home.clone(), thread_name: None, environments: environment_selections.to_selections(), diff --git a/codex-rs/core/src/session/tests.rs b/codex-rs/core/src/session/tests.rs index af8357540d..d332519be5 100644 --- a/codex-rs/core/src/session/tests.rs +++ b/codex-rs/core/src/session/tests.rs @@ -2581,8 +2581,8 @@ async fn set_rate_limits_retains_previous_credits() { active_permission_profile: config.permissions.active_permission_profile(), windows_sandbox_level: WindowsSandboxLevel::from_config(&config), cwd: config.cwd.clone(), - current_date: None, - timezone: None, + current_date: config.current_date.clone(), + timezone: config.timezone.clone(), codex_home: config.codex_home.clone(), thread_name: None, environments: Vec::new(), @@ -2687,8 +2687,8 @@ async fn set_rate_limits_updates_plan_type_when_present() { active_permission_profile: config.permissions.active_permission_profile(), windows_sandbox_level: WindowsSandboxLevel::from_config(&config), cwd: config.cwd.clone(), - current_date: None, - timezone: None, + current_date: config.current_date.clone(), + timezone: config.timezone.clone(), codex_home: config.codex_home.clone(), thread_name: None, environments: Vec::new(), @@ -3146,6 +3146,25 @@ async fn session_configuration_apply_updates_environment_context_overrides() { assert_eq!(updated.timezone.as_deref(), Some("America/Los_Angeles")); } +#[tokio::test] +async fn turn_context_uses_initial_environment_context_overrides() { + let (_session, turn_context, _rx) = make_session_and_context_with_auth_and_config_and_rx( + CodexAuth::from_api_key("Test API Key"), + Vec::new(), + |config| { + config.current_date = Some("2026-05-13".to_string()); + config.timezone = Some("America/Los_Angeles".to_string()); + }, + ) + .await; + + assert_eq!(turn_context.current_date.as_deref(), Some("2026-05-13")); + assert_eq!( + turn_context.timezone.as_deref(), + Some("America/Los_Angeles") + ); +} + pub(crate) async fn make_session_configuration_for_tests() -> SessionConfiguration { let codex_home = tempfile::tempdir().expect("create temp dir"); let config = build_test_config(codex_home.path()).await; @@ -3182,8 +3201,8 @@ pub(crate) async fn make_session_configuration_for_tests() -> SessionConfigurati active_permission_profile: config.permissions.active_permission_profile(), windows_sandbox_level: WindowsSandboxLevel::from_config(&config), cwd: config.cwd.clone(), - current_date: None, - timezone: None, + current_date: config.current_date.clone(), + timezone: config.timezone.clone(), codex_home: config.codex_home.clone(), thread_name: None, environments: Vec::new(), @@ -3710,8 +3729,8 @@ async fn session_new_fails_when_zsh_fork_enabled_without_zsh_path() { active_permission_profile: config.permissions.active_permission_profile(), windows_sandbox_level: WindowsSandboxLevel::from_config(&config), cwd: config.cwd.clone(), - current_date: None, - timezone: None, + current_date: config.current_date.clone(), + timezone: config.timezone.clone(), codex_home: config.codex_home.clone(), thread_name: None, environments: Vec::new(), @@ -3821,8 +3840,8 @@ pub(crate) async fn make_session_and_context() -> (Session, TurnContext) { active_permission_profile: config.permissions.active_permission_profile(), windows_sandbox_level: WindowsSandboxLevel::from_config(&config), cwd: config.cwd.clone(), - current_date: None, - timezone: None, + current_date: config.current_date.clone(), + timezone: config.timezone.clone(), codex_home: config.codex_home.clone(), thread_name: None, environments: default_environments, diff --git a/codex-rs/exec/src/lib.rs b/codex-rs/exec/src/lib.rs index e68c96d00b..eaca1a107a 100644 --- a/codex-rs/exec/src/lib.rs +++ b/codex-rs/exec/src/lib.rs @@ -951,6 +951,8 @@ fn thread_start_params_from_config(config: &Config) -> ThreadStartParams { sandbox: sandbox.flatten(), permissions, config: config_request_overrides_from_config(config), + current_date: config.current_date.clone(), + timezone: config.timezone.clone(), ephemeral: Some(config.ephemeral), ..ThreadStartParams::default() } @@ -973,6 +975,8 @@ fn thread_resume_params_from_config(config: &Config, thread_id: String) -> Threa approvals_reviewer: approvals_reviewer_override_from_config(config), sandbox: sandbox.flatten(), permissions, + current_date: config.current_date.clone(), + timezone: config.timezone.clone(), config: config_request_overrides_from_config(config), ..ThreadResumeParams::default() } diff --git a/codex-rs/tui/src/app_server_session.rs b/codex-rs/tui/src/app_server_session.rs index 9f1e0f8101..53c9ed901c 100644 --- a/codex-rs/tui/src/app_server_session.rs +++ b/codex-rs/tui/src/app_server_session.rs @@ -1194,6 +1194,8 @@ fn thread_start_params_from_config( sandbox, permissions, config: config_request_overrides_from_config(config), + current_date: config.current_date.clone(), + timezone: config.timezone.clone(), ephemeral: Some(config.ephemeral), session_start_source, thread_source: Some(ThreadSource::User), @@ -1228,6 +1230,8 @@ fn thread_resume_params_from_config( sandbox, permissions, config: config_request_overrides_from_config(&config), + current_date: config.current_date.clone(), + timezone: config.timezone.clone(), persist_extended_history: false, ..ThreadResumeParams::default() }