Allow environment selection updates during an active turn (#47435)

## What changed

- Add `environments` to `TurnSettingsUpdate` to replace the selection for subsequent steps without changing future turns.
- Capture model settings and environments together so combined updates apply or reject atomically, while existing steps retain their captured selection.
- Validate environment IDs, working directories, configuration ownership, and permission requirements against the running turn's selections.
- Preserve executor startup behavior when switching environments and use the step's local working directory for tool hooks.

## Testing

Add coverage for workspace switching and restoration on the next turn, atomic model and environment updates, permission validation, executor connection waits, and replacement of pending environment selections.

GitOrigin-RevId: 02b5c57a78fd594b2aed84fc09d9e99eb97be28c
This commit is contained in:
sayan-oai
2026-09-23 03:12:33 +00:00
committed by copyberry
parent 8a3c4ea3b5
commit 370cd7cba8
31 changed files with 1203 additions and 332 deletions
@@ -897,11 +897,7 @@ impl UnifiedExecProcessManager {
};
let _interaction_guard = locked_process.interaction_lock().lock_owned().await;
// A queued write must observe strict review enabled while it was waiting.
let strict_auto_review = context
.session
.active_turn_context_and_strict_auto_review()
.await
.is_some_and(|(_, _, strict)| strict);
let strict_auto_review = context.session.strict_auto_review_enabled().await;
let approval = {
let store = self.process_store.lock().await;
let entry = store