fix(core): preserve effective effort for fork-context children

This commit is contained in:
Friel
2026-03-30 04:22:19 +00:00
parent df69f49b6b
commit c79cb41b7d
2 changed files with 9 additions and 2 deletions

View File

@@ -1673,7 +1673,10 @@ async fn turn_start_emits_spawn_agent_item_with_effective_inherited_model_metada
const PARENT_PROMPT: &str = "spawn a child and continue";
const SPAWN_CALL_ID: &str = "spawn-call-1";
const INHERITED_MODEL: &str = "gpt-5.2-codex";
const INHERITED_REASONING_EFFORT: ReasoningEffort = ReasoningEffort::XHigh;
// thread/start only sets the model here; the session keeps the resolved collaboration-mode
// effort for that thread, so fork-context children should inherit `Medium`, not the model
// catalog default.
const INHERITED_REASONING_EFFORT: ReasoningEffort = ReasoningEffort::Medium;
const REQUESTED_MODEL: &str = "gpt-5.1";
const REQUESTED_REASONING_EFFORT: ReasoningEffort = ReasoningEffort::Low;

View File

@@ -225,7 +225,11 @@ fn build_agent_shared_config(turn: &TurnContext) -> Result<Config, FunctionCallE
let mut config = (*base_config).clone();
config.model = Some(turn.model_info.slug.clone());
config.model_provider = turn.provider.clone();
config.model_reasoning_effort = turn.reasoning_effort;
// Forked children must preserve the spawning turn's effective model settings, including a
// model catalog default effort, so their config snapshot matches the actual request shape.
config.model_reasoning_effort = turn
.reasoning_effort
.or(turn.model_info.default_reasoning_level);
config.model_reasoning_summary = Some(turn.reasoning_summary);
config.developer_instructions = turn.developer_instructions.clone();
config.compact_prompt = turn.compact_prompt.clone();