mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
[codex] add current time reminder delivery mode config (#30031)
```python delivery_mode = "any_inference" # default delivery_mode = "after_user_or_tool_output" # new mode ``` ## Validation - just test -p codex-core load_config_resolves_current_time_reminder - just test -p codex-core lock_contains_prompts_and_materializes_features
This commit is contained in:
committed by
GitHub
Unverified
parent
c65cfeab14
commit
e8d4a1a411
@@ -810,6 +810,9 @@
|
||||
"clock_source": {
|
||||
"$ref": "#/definitions/CurrentTimeSource"
|
||||
},
|
||||
"delivery_mode": {
|
||||
"$ref": "#/definitions/CurrentTimeReminderDeliveryMode"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -825,6 +828,25 @@
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"CurrentTimeReminderDeliveryMode": {
|
||||
"description": "Which inference boundaries may receive current-time reminders.",
|
||||
"oneOf": [
|
||||
{
|
||||
"description": "Allow a reminder before any inference request once the interval is due.",
|
||||
"enum": [
|
||||
"any_inference"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"description": "Allow reminders after user input or tool output; new context windows still force one.",
|
||||
"enum": [
|
||||
"after_user_or_tool_output"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"CurrentTimeSource": {
|
||||
"enum": [
|
||||
"system",
|
||||
|
||||
@@ -627,11 +627,13 @@ current_time_reminder = true
|
||||
enabled = true
|
||||
reminder_interval_seconds = 0
|
||||
clock_source = "external"
|
||||
delivery_mode = "after_user_or_tool_output"
|
||||
sleep_tool = true
|
||||
"#,
|
||||
CurrentTimeReminderConfig {
|
||||
reminder_interval_seconds: 0,
|
||||
clock_source: CurrentTimeSource::External,
|
||||
delivery_mode: CurrentTimeReminderDeliveryMode::AfterUserOrToolOutput,
|
||||
sleep_tool: true,
|
||||
},
|
||||
),
|
||||
|
||||
@@ -59,6 +59,7 @@ use codex_exec_server::ExecutorFileSystem;
|
||||
use codex_exec_server::LOCAL_FS;
|
||||
use codex_features::CodeModeConfigToml;
|
||||
use codex_features::CurrentTimeReminderConfigToml;
|
||||
use codex_features::CurrentTimeReminderDeliveryMode;
|
||||
use codex_features::CurrentTimeSource;
|
||||
use codex_features::Feature;
|
||||
use codex_features::FeatureConfigSource;
|
||||
@@ -1120,6 +1121,7 @@ pub struct RolloutBudgetConfig {
|
||||
pub struct CurrentTimeReminderConfig {
|
||||
pub reminder_interval_seconds: u64,
|
||||
pub clock_source: CurrentTimeSource,
|
||||
pub delivery_mode: CurrentTimeReminderDeliveryMode,
|
||||
/// Whether to expose the input-interruptible `clock.sleep` tool.
|
||||
pub sleep_tool: bool,
|
||||
}
|
||||
@@ -1129,6 +1131,7 @@ impl Default for CurrentTimeReminderConfig {
|
||||
Self {
|
||||
reminder_interval_seconds: 1,
|
||||
clock_source: CurrentTimeSource::System,
|
||||
delivery_mode: CurrentTimeReminderDeliveryMode::AnyInference,
|
||||
sleep_tool: false,
|
||||
}
|
||||
}
|
||||
@@ -2691,6 +2694,9 @@ fn resolve_current_time_reminder_config(
|
||||
clock_source: base
|
||||
.and_then(|config| config.clock_source)
|
||||
.unwrap_or(default.clock_source),
|
||||
delivery_mode: base
|
||||
.and_then(|config| config.delivery_mode)
|
||||
.unwrap_or(default.delivery_mode),
|
||||
sleep_tool: base
|
||||
.and_then(|config| config.sleep_tool)
|
||||
.unwrap_or(default.sleep_tool),
|
||||
|
||||
@@ -361,6 +361,7 @@ mod tests {
|
||||
enabled: Some(true),
|
||||
reminder_interval_seconds: Some(1),
|
||||
clock_source: Some(codex_features::CurrentTimeSource::System),
|
||||
delivery_mode: Some(codex_features::CurrentTimeReminderDeliveryMode::AnyInference),
|
||||
sleep_tool: Some(false),
|
||||
}))
|
||||
);
|
||||
|
||||
@@ -141,6 +141,17 @@ pub enum CurrentTimeSource {
|
||||
External,
|
||||
}
|
||||
|
||||
/// Which inference boundaries may receive current-time reminders.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, Default, PartialEq, Eq, JsonSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum CurrentTimeReminderDeliveryMode {
|
||||
/// Allow a reminder before any inference request once the interval is due.
|
||||
#[default]
|
||||
AnyInference,
|
||||
/// Allow reminders after user input or tool output; new context windows still force one.
|
||||
AfterUserOrToolOutput,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct CurrentTimeReminderConfigToml {
|
||||
@@ -150,6 +161,8 @@ pub struct CurrentTimeReminderConfigToml {
|
||||
pub reminder_interval_seconds: Option<u64>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub clock_source: Option<CurrentTimeSource>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub delivery_mode: Option<CurrentTimeReminderDeliveryMode>,
|
||||
/// Expose the input-interruptible `clock.sleep` tool.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub sleep_tool: Option<bool>,
|
||||
|
||||
@@ -18,6 +18,7 @@ mod feature_configs;
|
||||
mod legacy;
|
||||
pub use feature_configs::CodeModeConfigToml;
|
||||
pub use feature_configs::CurrentTimeReminderConfigToml;
|
||||
pub use feature_configs::CurrentTimeReminderDeliveryMode;
|
||||
pub use feature_configs::CurrentTimeSource;
|
||||
pub use feature_configs::MultiAgentV2ConfigToml;
|
||||
pub use feature_configs::NetworkProxyConfigToml;
|
||||
|
||||
Reference in New Issue
Block a user