mirror of
https://github.com/openai/codex.git
synced 2026-11-13 06:45:07 +00:00
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:
1 parent
ba6cf9c692
commit
68301fa45f
68 files changed
+1393
-516
No files matched your search
@@ -2,35 +2,19 @@ use std::sync::Arc;
|
||||
|
||||
use crate::agents_md::LoadedAgentsMd;
|
||||
use crate::environment_selection::TurnEnvironmentSnapshot;
|
||||
use crate::session::step_settings::ResolvedStepSettings;
|
||||
use crate::session::turn_context::TurnContext;
|
||||
use crate::tools::router::ToolRouter;
|
||||
use codex_exec_server::ExecutorCapabilityDiscoverySnapshot;
|
||||
use codex_exec_server::ResolvedSelectedCapabilityRoot;
|
||||
use codex_mcp::McpBinding;
|
||||
use codex_otel::SessionTelemetry;
|
||||
use codex_protocol::config_types::ApprovalsReviewer;
|
||||
use codex_protocol::config_types::ReasoningSummary;
|
||||
use codex_protocol::openai_models::ModelInfo;
|
||||
use codex_protocol::openai_models::ReasoningEffort;
|
||||
use codex_protocol::protocol::AskForApproval;
|
||||
|
||||
/// Request-scoped state that may change between model sampling requests.
|
||||
pub(crate) struct StepContext {
|
||||
pub(crate) turn: Arc<TurnContext>,
|
||||
/// Concrete model and capabilities used by this sampling request.
|
||||
pub(crate) model_info: Arc<ModelInfo>,
|
||||
/// Reasoning effort selected for this sampling request.
|
||||
pub(crate) reasoning_effort: Option<ReasoningEffort>,
|
||||
/// Reasoning summary resolved for this sampling request.
|
||||
pub(crate) reasoning_summary: ReasoningSummary,
|
||||
/// Effective service tier supported by this sampling request's model.
|
||||
pub(crate) service_tier: Option<String>,
|
||||
/// Effective approval policy used by this sampling request's tool actions.
|
||||
/// Model-specific Guardian requirements can change this during a model switch.
|
||||
pub(crate) approval_policy: AskForApproval,
|
||||
/// Effective reviewer selected for this sampling request's approvals.
|
||||
/// Model-specific Guardian requirements can change this during a model switch.
|
||||
pub(crate) approvals_reviewer: ApprovalsReviewer,
|
||||
/// One immutable settings version captured before request preparation.
|
||||
pub(crate) settings: Arc<ResolvedStepSettings>,
|
||||
/// Telemetry context tagged with this sampling request's model.
|
||||
pub(crate) session_telemetry: SessionTelemetry,
|
||||
pub(crate) environments: TurnEnvironmentSnapshot,
|
||||
|
||||
Reference in new issue
Block a user