Support model catalog permission messages (#33147)

## What changed

- Add per-sandbox-mode permission messages to `ModelMessages` and preserve them when applying model configuration overrides.
- Use the selected catalog message in permission instructions, substituting `{{ network_access }}` with the active network policy. Fall back to the existing sandbox text when no override is provided, and allow an empty override to omit only the sandbox section.
- Apply catalog permission messages when a session starts and when its model changes.

## Testing

- Cover catalog deserialization, mode selection, network substitution, fallback and empty-message behavior, remote model catalogs, and model changes.

GitOrigin-RevId: cd5ed3aee3155dca0e7b2358c0f09bae73236856
This commit is contained in:
rhan-oai authored and copyberry committed 2026-07-14 20:14:29 +00:00
1 parent f90e7deea6
commit eb80df0317
12 files changed
+540 -11

No files matched your search

+5 -1
View File
@@ -112,7 +112,10 @@ fn clear_instruction_messages(model: &mut ModelInfo) {
if let Some(model_messages) = &mut model.model_messages {
model_messages.instructions_template = None;
model_messages.instructions_variables = None;
if model_messages.approvals.is_none() && model_messages.auto_review.is_none() {
if model_messages.approvals.is_none()
&& model_messages.auto_review.is_none()
&& model_messages.permissions.is_none()
{
model.model_messages = None;
}
}
@@ -177,6 +180,7 @@ fn local_personality_messages_for_slug(slug: &str) -> Option<ModelMessages> {
}),
approvals: None,
auto_review: None,
permissions: None,
}),
_ => None,
}