mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Track context windows per agent (#37347)
## Why Forked subagents can inherit a parent's compacted history, but their context-window metadata needs to identify the child and start a distinct window lineage. ## What changed - Always identify context windows by agent name and remove the `features.token_budget.mode` setting. - Persist the agent path in world state and emit context-window metadata as a standalone developer message when the identity changes. - Reset inherited compaction metadata to the forked subagent's initial context window and restore that window in session state. ## Testing Extend the full-history subagent test to verify parent and child world-state snapshots, agent identities, distinct window IDs, and the reset child checkpoint. GitOrigin-RevId: 6584201e57b3d2fba0ce626b89a8b3b0b3c752db
This commit is contained in:
1 parent
270d93268c
commit
69b6152c17
15 files changed
+195
-111
No files matched your search
@@ -3542,18 +3542,11 @@ impl Session {
|
||||
.join("\n");
|
||||
(!text.is_empty()).then_some(text)
|
||||
});
|
||||
developer_sections.push(
|
||||
separate_developer_sections.push(
|
||||
crate::context::TokenBudgetContext::new(
|
||||
self.thread_id(),
|
||||
session_source
|
||||
.get_agent_path()
|
||||
.unwrap_or_else(codex_protocol::AgentPath::root),
|
||||
turn_context
|
||||
.config
|
||||
.token_budget
|
||||
.as_ref()
|
||||
.map(|config| config.mode)
|
||||
.unwrap_or_default(),
|
||||
auto_compact_window_ids.first_window_id,
|
||||
auto_compact_window_ids.previous_window_id,
|
||||
auto_compact_window_ids.window_id,
|
||||
|
||||
Reference in new issue
Block a user