mirror of
https://github.com/openai/codex.git
synced 2026-10-28 00:03:58 +00:00
[codex] nest sleep config under current time reminder (#29910)
## Summary - move sleep tool enablement from top-level `[features].sleep_tool` to `[features.current_time_reminder].sleep_tool` - remove the standalone `Feature::SleepTool` flag and gate `clock.sleep` from resolved current-time configuration - update config schema, config-lock materialization, and existing sleep coverage Stacked on #29907.
This commit is contained in:
@@ -744,10 +744,14 @@ fn add_core_utility_tools(context: &CoreToolPlanContext<'_>, planned_tools: &mut
|
||||
|
||||
if features.enabled(Feature::CurrentTimeReminder) {
|
||||
planned_tools.add(CurrentTimeHandler);
|
||||
}
|
||||
|
||||
if features.enabled(Feature::SleepTool) {
|
||||
planned_tools.add(SleepHandler);
|
||||
if turn_context
|
||||
.config
|
||||
.current_time_reminder
|
||||
.as_ref()
|
||||
.is_some_and(|config| config.sleep_tool)
|
||||
{
|
||||
planned_tools.add(SleepHandler);
|
||||
}
|
||||
}
|
||||
|
||||
if tool_suggest_enabled(turn_context)
|
||||
|
||||
@@ -31,6 +31,7 @@ use codex_tools::ToolSpec;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::config::CurrentTimeReminderConfig;
|
||||
use crate::session::step_context::StepContext;
|
||||
use crate::session::tests::make_session_and_context;
|
||||
use crate::session::turn_context::TurnContext;
|
||||
@@ -721,19 +722,27 @@ async fn host_context_gates_agent_job_tools() {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn sleep_tool_follows_feature_gate() {
|
||||
async fn sleep_tool_follows_current_time_config() {
|
||||
let disabled = probe(|turn| {
|
||||
set_feature(turn, Feature::SleepTool, /*enabled*/ false);
|
||||
set_feature(turn, Feature::CurrentTimeReminder, /*enabled*/ true);
|
||||
})
|
||||
.await;
|
||||
disabled.assert_visible_lacks(&["clock"]);
|
||||
assert_eq!(disabled.namespace_function_names("clock"), ["curr_time"]);
|
||||
|
||||
let enabled = probe(|turn| {
|
||||
set_feature(turn, Feature::SleepTool, /*enabled*/ true);
|
||||
set_feature(turn, Feature::CurrentTimeReminder, /*enabled*/ true);
|
||||
let mut config = (*turn.config).clone();
|
||||
config.current_time_reminder = Some(CurrentTimeReminderConfig {
|
||||
sleep_tool: true,
|
||||
..CurrentTimeReminderConfig::default()
|
||||
});
|
||||
turn.config = Arc::new(config);
|
||||
})
|
||||
.await;
|
||||
enabled.assert_visible_contains(&["clock"]);
|
||||
assert_eq!(enabled.namespace_function_names("clock"), ["sleep"]);
|
||||
assert_eq!(
|
||||
enabled.namespace_function_names("clock"),
|
||||
["curr_time", "sleep"]
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
Reference in New Issue
Block a user