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

@@ -1453,6 +1453,7 @@ mod tests {
instructions_template: None,
instructions_variables: None,
approvals: None,
collaboration_modes: None,
auto_review: Some(AutoReviewMessages {
policy: Some("Use the catalog Guardian policy.".to_string()),
policy_template: Some(catalog_template.to_string()),
@@ -1486,6 +1487,7 @@ mod tests {
instructions_template: None,
instructions_variables: None,
approvals: None,
collaboration_modes: None,
auto_review: Some(AutoReviewMessages {
policy: Some(String::new()),
policy_template: None,
@@ -1527,6 +1529,7 @@ mod tests {
instructions_template: None,
instructions_variables: None,
approvals: None,
collaboration_modes: None,
auto_review: Some(AutoReviewMessages {
policy: Some(catalog_policy.to_string()),
policy_template: Some(String::new()),