mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Use captured step settings when building model context (#44200)
## Why Model changes during an active turn could leave context using the turn's initial model and settings, even after requests switched to the new model. ## What changed - Build model, personality, approval, collaboration, app, plugin, and multi-agent instructions from captured step settings. - Resolve multi-agent policy from the step's effective reasoning effort. - Use the captured step's context window for full-context metadata and retain that step when rebuilding initial context for compaction. ## Testing Add regression coverage for model switches updating context without duplicating updates, delegation policy following selected or model-default reasoning effort, and compaction preserving retained context after a model change. GitOrigin-RevId: 3615c7a3f13f15fdcce9ad13d23311340e0aea88
This commit is contained in:
1 parent
ccf470c060
commit
b4507997e0
11 files changed
+373
-69
No files matched your search
@@ -7,6 +7,7 @@ use crate::mcp::McpEnvironmentScope;
|
||||
use crate::mcp::McpThreadIdentity;
|
||||
use crate::rollout::RolloutRecorder;
|
||||
use crate::session::session::SessionSettingsUpdate;
|
||||
use crate::session::step_context::StepContext;
|
||||
use crate::session::tests::build_world_state_from_turn_context;
|
||||
use crate::session::tests::make_session_and_context;
|
||||
use crate::tasks::InterruptedTurnHistoryMarker;
|
||||
@@ -598,8 +599,9 @@ async fn ignores_session_prefix_messages_when_truncating() {
|
||||
let (session, turn_context) = make_session_and_context().await;
|
||||
let turn_context = Arc::new(turn_context);
|
||||
let world_state = build_world_state_from_turn_context(&session, &turn_context).await;
|
||||
let step_context = StepContext::for_test(turn_context);
|
||||
let mut items = session
|
||||
.build_initial_context_with_world_state(&turn_context, &world_state)
|
||||
.build_initial_context_with_world_state(&step_context, &world_state)
|
||||
.await;
|
||||
items.push(user_msg("feature request"));
|
||||
items.push(assistant_msg("ack"));
|
||||
@@ -1201,10 +1203,11 @@ async fn spawn_internal_session_preserves_parent_lineage_without_forking_history
|
||||
let reviewer_turn = reviewer.thread.session.new_default_turn().await;
|
||||
let reviewer_world_state =
|
||||
build_world_state_from_turn_context(&reviewer.thread.session, &reviewer_turn).await;
|
||||
let reviewer_step = StepContext::for_test(Arc::clone(&reviewer_turn));
|
||||
let reviewer_context = reviewer
|
||||
.thread
|
||||
.session
|
||||
.build_initial_context_with_world_state(&reviewer_turn, &reviewer_world_state)
|
||||
.build_initial_context_with_world_state(&reviewer_step, &reviewer_world_state)
|
||||
.await;
|
||||
assert!(
|
||||
!serde_json::to_string(&reviewer_context)
|
||||
|
||||
Reference in new issue
Block a user