Refresh current-time reminders for full-history subagents (#38446)

## What changed

- Exclude current-time reminder developer messages when copying parent history into a full-history subagent.
- Keep the child's newly generated reminder, preventing inherited reminders from accumulating while preserving the rest of the forked context.

## Testing

- Extend the full-history V2 spawn test to verify that two reminders in the parent become one fresh reminder in the child request.

GitOrigin-RevId: fb61c72f7f0d61d1068f2c599a8b8caf1788b7e2
This commit is contained in:
rka-oai authored and copyberry committed 2026-08-13 22:30:59 +00:00
1 parent bff03ecce5
commit 6344a655a5
2 files changed
+35 -7

No files matched your search

+8 -5
View File
@@ -2,6 +2,8 @@ use super::residency::is_v2_resident_session_source;
use super::*;
use crate::agent::role::apply_role_to_config_for_multi_agent_v2;
use crate::config::PermissionProfileSnapshot;
use crate::context::ContextualUserFragment;
use crate::context::CurrentTimeReminder;
use codex_extension_api::ExtensionDataInit;
const AGENT_NAMES: &str = include_str!("../agent_names.txt");
@@ -81,7 +83,7 @@ fn keep_forked_rollout_item(item: &RolloutItem, preserve_reference_context_item:
}
}
fn is_multi_agent_v2_usage_hint_message(item: &ResponseItem, usage_hint_texts: &[String]) -> bool {
fn is_fork_excluded_developer_message(item: &ResponseItem, usage_hint_texts: &[String]) -> bool {
let ResponseItem::Message { role, content, .. } = item else {
return false;
};
@@ -92,9 +94,10 @@ fn is_multi_agent_v2_usage_hint_message(item: &ResponseItem, usage_hint_texts: &
return false;
};
usage_hint_texts
.iter()
.any(|usage_hint_text| usage_hint_text == text)
CurrentTimeReminder::matches_text(text)
|| usage_hint_texts
.iter()
.any(|usage_hint_text| usage_hint_text == text)
}
async fn load_agent_model_context(
@@ -720,7 +723,7 @@ impl AgentControl {
if matches!(response_item, ResponseItem::AgentMessage { .. }) {
return false;
}
if is_multi_agent_v2_usage_hint_message(
if is_fork_excluded_developer_message(
response_item,
&multi_agent_v2_usage_hint_texts_to_filter,
) {