Derive collaboration settings from turn context (#32900)

## Why

`TurnContext` stored model and reasoning settings both as resolved turn fields and inside `CollaborationMode`, requiring the copies to stay synchronized when the model changed.

## What changed

- Store the mode and collaboration-mode developer instructions directly on `TurnContext`.
- Reconstruct `CollaborationMode` from those values plus the turn's current model and reasoning effort when callers need it.
- Read the mode directly for plan-mode checks, lifecycle events, and telemetry.

GitOrigin-RevId: b8fccafdd5d5cbccc84bc70d542588087ddf0093
This commit is contained in:
Ahmed Ibrahim authored and copyberry committed 2026-07-13 23:48:42 +00:00
1 parent 75470c3e2f
commit 4657ab06c6
16 files changed
+58 -41

No files matched your search

+3 -5
View File
@@ -70,13 +70,11 @@ fn build_collaboration_mode_update_item(
}
let prev = previous?;
if prev.collaboration_mode.as_ref() != Some(&next.collaboration_mode) {
let collaboration_mode = next.collaboration_mode();
if prev.collaboration_mode.as_ref() != Some(&collaboration_mode) {
// If the next mode has empty developer instructions, this returns None and we emit no
// update, so prior collaboration instructions remain in the prompt history.
Some(
CollaborationModeInstructions::from_collaboration_mode(&next.collaboration_mode)?
.render(),
)
Some(CollaborationModeInstructions::from_collaboration_mode(&collaboration_mode)?.render())
} else {
None
}