Support catalog templates for approved command prefixes (#55366)

## What changed

Add `approved_prefixes` to catalog permission messages, with `{{ approved_prefixes }}` substitution for the approved command list. An empty template suppresses the section; missing or null values retain the bundled template.

For `on-request` approvals, append an explicitly supplied prefix template even when the catalog also supplies approval instructions. Use the template for bundled `on-request` and granular approval instructions as well.

## Testing

Extend the remote model catalog integration test to cover custom prefix rendering alongside catalog approval instructions and suppression with an empty template.

GitOrigin-RevId: 82dd6f83caa56cab0a2f6343bf912efe2cb97d64
This commit is contained in:
Dylan Hurd
2026-10-19 19:55:39 +00:00
committed by copyberry
parent ee8b4ea181
commit d9a36f6ec7
10 changed files with 125 additions and 51 deletions
+6
View File
@@ -784,6 +784,10 @@ pub struct PermissionMessages {
pub danger_full_access: Option<String>,
pub workspace_write: Option<String>,
pub read_only: Option<String>,
/// Supports `{{ approved_prefixes }}`. Missing or null uses the bundled text;
/// an empty string suppresses the approved-prefix section.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub approved_prefixes: Option<String>,
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq, Eq, TS, JsonSchema)]
@@ -1310,6 +1314,7 @@ mod tests {
danger_full_access: None,
workspace_write: Some(String::new()),
read_only: None,
approved_prefixes: None,
})
);
}
@@ -1554,6 +1559,7 @@ mod tests {
danger_full_access: None,
workspace_write: Some("workspace".to_string()),
read_only: None,
approved_prefixes: None,
}),
multi_agent: None,
token_budget: None,