mirror of
https://github.com/openai/codex.git
synced 2026-10-20 08:19:50 +00:00
Add an opt-in feature for subagent model context defaults (#52659)
## What changed Add the disabled-by-default `subagent_default_context_limits` feature and expose it in the configuration schema. When enabled, shared configuration for spawning and resuming subagents clears inherited `model_context_window` and `model_auto_compact_token_limit` overrides so subagents use their model's default context window and auto-compaction threshold. GitOrigin-RevId: 5168ae2b4fbe72c533d8c6152922a8bceb2c5cbd
This commit is contained in:
@@ -1178,6 +1178,9 @@
|
||||
"step_model_switching": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"subagent_default_context_limits": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"system_proxy_fallback": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -7472,6 +7475,9 @@
|
||||
"step_model_switching": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"subagent_default_context_limits": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"system_proxy_fallback": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
@@ -9,6 +9,7 @@ use crate::config::Config;
|
||||
use crate::session::session::Session;
|
||||
use crate::session::step_context::StepContext;
|
||||
use crate::session::turn_context::TurnContext;
|
||||
use codex_features::Feature;
|
||||
use codex_models_manager::manager::RefreshStrategy;
|
||||
use codex_protocol::config_types::SERVICE_TIER_DEFAULT_REQUEST_VALUE;
|
||||
use codex_protocol::models::BaseInstructions;
|
||||
@@ -131,6 +132,13 @@ pub(crate) fn build_agent_resume_config(turn: &TurnContext) -> Result<Config, St
|
||||
fn build_agent_shared_config(turn: &TurnContext) -> Result<Config, String> {
|
||||
let base_config = turn.config.clone();
|
||||
let mut config = (*base_config).clone();
|
||||
if config
|
||||
.features
|
||||
.enabled(Feature::SubagentDefaultContextLimits)
|
||||
{
|
||||
config.model_context_window = None;
|
||||
config.model_auto_compact_token_limit = None;
|
||||
}
|
||||
// Preserve activation for history forks without freezing the parent's model-owned prompts.
|
||||
// Fresh child startup restores configured preferences from the retained snapshot.
|
||||
config.token_budget = turn.configured_token_budget.clone();
|
||||
|
||||
@@ -225,6 +225,8 @@ pub enum Feature {
|
||||
ModelCatalogInContext,
|
||||
/// Inherit client-defined dynamic tools in fresh V2 subagents.
|
||||
MultiAgentV2DynamicTools,
|
||||
/// Use each subagent model's default context window and auto-compaction threshold.
|
||||
SubagentDefaultContextLimits,
|
||||
/// Keep sampling through reasoning and commentary boundaries when agent mail arrives.
|
||||
/// Pending mail is delivered at the next normal input boundary instead.
|
||||
DeferMailboxPreemption,
|
||||
@@ -1464,6 +1466,12 @@ pub const FEATURES: &[FeatureSpec] = &[
|
||||
stage: Stage::UnderDevelopment,
|
||||
default_enabled: false,
|
||||
},
|
||||
FeatureSpec {
|
||||
id: Feature::SubagentDefaultContextLimits,
|
||||
key: "subagent_default_context_limits",
|
||||
stage: Stage::UnderDevelopment,
|
||||
default_enabled: false,
|
||||
},
|
||||
FeatureSpec {
|
||||
id: Feature::DeferMailboxPreemption,
|
||||
key: "defer_mailbox_preemption",
|
||||
|
||||
Reference in New Issue
Block a user