Persist security risk scores in rollout history (#38363)

## What changed

- Add a `SecurityRiskScore` rollout item containing a category and numeric score.
- Persist the item in both thread history modes while excluding it from model context, user-visible thread history, search text, forks, and reconstructed conversation history.
- Re-export the score type from the extension API.

## Testing

- Cover serialization, persistence and loading, thread history projection, session reconstruction, append planning, and memory filtering.

GitOrigin-RevId: 1926fe366aeaa75052708a6da589f45a38eefb52
This commit is contained in:
jif authored and copyberry committed 2026-08-13 12:04:29 +00:00
1 parent 9ed0047a61
commit 72fa74fbc9
32 files changed
+165 -4

No files matched your search

+5 -1
View File
@@ -352,6 +352,10 @@ fn rollout_item_variants_preserve_existing_payload_shapes() -> Result<()> {
"type": "world_state",
"payload": { "full": true, "state": { "cwd": "/tmp" } },
}),
json!({
"type": "security_risk_score",
"payload": { "category": "action_risk", "score": 0.92 },
}),
json!({
"type": "event_msg",
"payload": { "type": "warning", "message": "heads up" },
@@ -370,7 +374,7 @@ fn rollout_item_variants_preserve_existing_payload_shapes() -> Result<()> {
fn rollout_item_schema_matches_tagged_payload_and_sibling_metadata() -> Result<()> {
let schema = serde_json::to_value(schemars::schema_for!(RolloutItem))?;
let variants = schema["oneOf"].as_array().expect("rollout variants");
assert_eq!(variants.len(), 8);
assert_eq!(variants.len(), 9);
for variant in variants {
let required = variant["required"].as_array().expect("required fields");