Make Code Mode wrappers transparent to Guardian model policies (#45915)

## Why

Code Mode wrappers should preserve cached scores for nested actions so adaptive review can reuse them across cells.

## What changed

Remove `code_mode` from `GuardianModelPolicy` and its approval scopes. Skip scoring and cache invalidation for direct Code Mode `exec` wrappers under model policies, leaving nested tools governed by their own categories. Preserve legacy wrapper scoring behavior.

## Testing

Expand app-server coverage for score reuse across cells, synchronous nested reviews, required model policies, and legacy configurations. Retain checks that ordinary tools named `exec` or MCP tools named `wait` invalidate cached scores.

GitOrigin-RevId: 7a0692e5330f3d4b4bda988ecbe7061bc8b2318c
This commit is contained in:
jif authored and copyberry committed 2026-09-16 10:11:26 +00:00
1 parent 2aff7208fe
commit 8f38d5a877
7 files changed
+112 -50

No files matched your search

+1 -1
View File
@@ -403,7 +403,7 @@ const fn is_true(value: &bool) -> bool {
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, TS, JsonSchema)]
pub struct ModelInfo {
/// Model-owned approval coverage. Absent preserves legacy settings; an empty map disables
/// ordinary Guardian review. Keys are computer_use, shell, code_mode, file_changes, mcp, network,
/// ordinary Guardian review. Keys are computer_use, shell, file_changes, mcp, network,
/// and permissions. This does not override mandatory safety or administrator requirements.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub guardian: Option<GuardianModelPolicy>,