mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Preserve delegated tasks across remote compaction (#36128)
## What changed - Retain bounded, non-completion agent messages in remote v2 compaction history so delegated tasks remain available on follow-up turns. - Account for encrypted agent-message content when estimating token usage and place restored initial context before the latest real user or agent message. - Exclude child completion messages from retained follow-up history and strip inherited parent agent messages when forking a child. ## Testing - Extend compaction, history-estimation, and agent-fork tests to cover encrypted delegated tasks, child completions, context ordering, and fork sanitization. GitOrigin-RevId: ba4392e9cfdf4ecbcdc9c7d8581d58a8d2d78260
This commit is contained in:
1 parent
89a0eed93c
commit
4f6d06d485
8 files changed
+180
-23
No files matched your search
@@ -696,6 +696,9 @@ impl AgentControl {
|
||||
// Compaction stores response items separately, so sanitize both top-level messages and
|
||||
// compacted replacement histories with the same policy.
|
||||
let retain_forked_item = |response_item: &mut ResponseItem, replaced: &mut bool| {
|
||||
if matches!(response_item, ResponseItem::AgentMessage { .. }) {
|
||||
return false;
|
||||
}
|
||||
if is_multi_agent_v2_usage_hint_message(
|
||||
response_item,
|
||||
&multi_agent_v2_usage_hint_texts_to_filter,
|
||||
|
||||
Reference in new issue
Block a user