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:
Abhinav authored and copyberry committed 2026-09-09 16:48:03 +00:00
1 parent ccf470c060
commit b4507997e0
11 files changed
+373 -69

No files matched your search

+1 -4
View File
@@ -103,10 +103,7 @@ pub(crate) async fn build_compaction_initial_context(
step_context,
} => {
let items = sess
.build_initial_context_with_world_state(
step_context.turn.as_ref(),
world_state.as_ref(),
)
.build_initial_context_with_world_state(step_context, world_state.as_ref())
.await;
(
items.into_iter().map(ResponseItemEnvelope::new).collect(),