Use model catalog collaboration mode messages (#36351)

## What changed

- Add optional `default` and `plan` collaboration-mode messages to model catalog metadata.
- Prefer the active mode's catalog message, including an explicit empty value, while falling back to the existing developer instructions when the catalog variant is absent.
- Track the model in collaboration-mode world state so mode and model changes append the appropriate instructions, and clear prior instructions when no current message exists.
- Preserve catalog collaboration messages when instruction overrides remove other model instruction fields.

## Testing

- Cover catalog deserialization, variant selection, fallback and empty-message behavior, legacy snapshot migration, mode changes, and model changes.

GitOrigin-RevId: d4c6c0028423bc50b0e8175e55586f3e7bc1c3a8
This commit is contained in:
rhan-oai authored and copyberry committed 2026-07-31 15:40:52 +00:00
1 parent 7b38c48da9
commit 2c005abb07
13 files changed
+556 -36

No files matched your search

@@ -113,6 +113,7 @@ fn clear_instruction_messages(model: &mut ModelInfo) {
model_messages.instructions_template = None;
model_messages.instructions_variables = None;
if model_messages.approvals.is_none()
&& model_messages.collaboration_modes.is_none()
&& model_messages.auto_review.is_none()
&& model_messages.permissions.is_none()
&& model_messages.token_budget.is_none()
@@ -180,6 +181,7 @@ fn local_personality_messages_for_slug(slug: &str) -> Option<ModelMessages> {
personality_pragmatic: Some(LOCAL_PRAGMATIC_TEMPLATE.to_string()),
}),
approvals: None,
collaboration_modes: None,
auto_review: None,
permissions: None,
token_budget: None,