Record reviewed actions with security risk scores (#40901)

## What changed

- Add optional `call_id` and `action` fields to `SecurityRiskScore` so a persisted score identifies the tool call and bounded action that produced it.
- Populate the fields after Guardian V2 classifies an action while leaving fail-closed and legacy scores without provenance.

## Testing

- Verify scores preserve action details for direct tool calls and nested code-mode calls.
- Verify rollout serialization retains the new fields.

GitOrigin-RevId: fce69af37f368cecf1d9bce42bfc38a969e969b7
This commit is contained in:
jif authored and copyberry committed 2026-08-26 15:02:21 +00:00
1 parent 62fb56ee56
commit d4998d611a
9 files changed
+130 -3

No files matched your search

@@ -66,6 +66,8 @@ fn requires_a_strict_nonempty_model_prefix() {
}
let security_risk = RolloutItem::SecurityRiskScore(SecurityRiskScore {
scores: BTreeMap::from([("action_risk".to_string(), 0.92)]),
call_id: None,
action: None,
sampled_at: None,
});
metadata_changed.push(security_risk.clone());