mirror of
https://github.com/openai/codex.git
synced 2026-11-22 15:15:18 +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
@@ -70,7 +70,6 @@ use codex_features::FeaturesToml;
|
||||
use codex_features::MultiAgentV2ConfigToml;
|
||||
use codex_features::NetworkProxyConfigToml;
|
||||
use codex_features::TokenBudgetConfigToml;
|
||||
use codex_features::TokenBudgetMode;
|
||||
use codex_git_utils::resolve_root_git_project_for_trust;
|
||||
use codex_http_client::HttpClientFactory;
|
||||
use codex_http_client::OutboundProxyPolicy;
|
||||
@@ -1136,7 +1135,6 @@ const AUTO_COMPACT_FALLBACK_PROMPT_MAX_BYTES: usize = 2000;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||
pub struct TokenBudgetConfig {
|
||||
pub mode: TokenBudgetMode,
|
||||
pub reminder_threshold_tokens: Option<i64>,
|
||||
pub reminder_message_template: String,
|
||||
pub guidance_message: Option<String>,
|
||||
@@ -1229,7 +1227,6 @@ impl TokenBudgetConfig {
|
||||
impl Default for TokenBudgetConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
mode: TokenBudgetMode::default(),
|
||||
reminder_threshold_tokens: None,
|
||||
reminder_message_template: DEFAULT_TOKEN_BUDGET_REMINDER_MESSAGE_TEMPLATE.to_string(),
|
||||
guidance_message: None,
|
||||
@@ -2813,9 +2810,6 @@ fn resolve_token_budget_config(
|
||||
}
|
||||
|
||||
let token_budget_config = token_budget_toml_config(config_toml.features.as_ref());
|
||||
let mode = token_budget_config
|
||||
.and_then(|config| config.mode)
|
||||
.unwrap_or_default();
|
||||
let reminder_threshold_tokens =
|
||||
token_budget_config.and_then(|config| config.reminder_threshold_tokens);
|
||||
let reminder_message_template = token_budget_config
|
||||
@@ -2833,7 +2827,6 @@ fn resolve_token_budget_config(
|
||||
token_budget_config.and_then(|config| config.auto_compact_fallback_buffer_tokens);
|
||||
|
||||
let token_budget = TokenBudgetConfig {
|
||||
mode,
|
||||
reminder_threshold_tokens,
|
||||
reminder_message_template,
|
||||
guidance_message,
|
||||
|
||||
Reference in new issue
Block a user