Snapshot resolved settings for each model step (#40651)

## Why

Thread settings can change while a turn is running, and delegated review or
compaction steps can select a different model. Each request needs a consistent
set of settings resolved against the model that will execute it.

## What changed

- Capture immutable resolved settings for each model step, including model
  metadata, reasoning options, service tier, approvals, and personality.
- Keep in-flight steps on their captured settings while applying thread updates
  to subsequent work.
- Resolve inherited reasoning summaries and filter service tiers against the
  selected model and feature configuration for review and compaction steps.

## Testing

Added coverage for settings updates during paused turns, model changes,
previous-model compaction, review-model defaults, and service-tier filtering.

GitOrigin-RevId: fca4b3b305379f1bf26a5cac75ee0dd1747ac1f6
This commit is contained in:
joeflorencio-openai authored and copyberry committed 2026-08-25 17:41:22 +00:00
1 parent ba6cf9c692
commit 68301fa45f
68 files changed
+1393 -516

No files matched your search

+6 -6
View File
@@ -287,7 +287,7 @@ pub(crate) async fn handle_mcp_tool_call(
&call_id,
invocation,
item_metadata.clone(),
crate::guardian::guardian_timeout_message(&turn_context.model_info),
crate::guardian::guardian_timeout_message(turn_context.model_info()),
/*already_started*/ true,
)
.await
@@ -449,7 +449,7 @@ async fn handle_approved_mcp_tool_call(
.map(|(connector_id, action_name)| HostedFileUploadContext {
connector_id: connector_id.clone(),
action_name: action_name.clone(),
model: turn_context.model_info.slug.clone(),
model: turn_context.model_info().slug.clone(),
});
let rewritten_arguments = rewrite_mcp_tool_arguments_for_openai_files(
sess,
@@ -491,7 +491,7 @@ async fn handle_approved_mcp_tool_call(
.await
.map_err(|error| format!("tool call error: {error:?}"))?;
let result = sanitize_mcp_tool_result_for_model(
&turn_context.model_info.input_modalities,
&turn_context.model_info().input_modalities,
Ok(result),
)?;
Ok(maybe_request_codex_apps_auth_elicitation(
@@ -1023,7 +1023,7 @@ async fn maybe_track_codex_app_used(
};
let tracking = build_track_events_context(
turn_context.model_info.slug.clone(),
turn_context.model_info().slug.clone(),
sess.thread_id.to_string(),
turn_context.sub_id.clone(),
turn_context.originator.clone(),
@@ -1193,7 +1193,7 @@ fn build_mcp_tool_call_request_meta(
if let Some(turn_metadata) = turn_context
.turn_metadata_state
.current_meta_value_for_mcp_request(McpTurnMetadataContext {
model: turn_context.model_info.slug.as_str(),
model: turn_context.model_info().slug.as_str(),
reasoning_effort: turn_context.effective_reasoning_effort(),
})
{
@@ -1317,7 +1317,7 @@ async fn maybe_request_mcp_tool_approval(
let approvals_reviewer = connectors::mcp_approvals_reviewer_from_layers(
&config.config_layer_stack,
config.approvals_reviewer,
Some(turn_context.model_info.slug.as_str()),
Some(turn_context.model_info().slug.as_str()),
&invocation.server,
metadata.connector_id.as_deref(),
);