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

+10
View File
@@ -7,6 +7,7 @@ use super::InterAgentCommunication;
use super::ResponseItem;
use super::ResponseItemEnvelope;
use super::RolloutItem;
use super::SecurityRiskScore;
use super::SessionMetaLine;
use super::TurnContextItem;
use super::WorldStateItem;
@@ -41,6 +42,9 @@ pub(super) enum RolloutItemWire<'a> {
WorldState {
payload: Cow<'a, WorldStateItem>,
},
SecurityRiskScore {
payload: Cow<'a, SecurityRiskScore>,
},
EventMsg {
payload: Cow<'a, EventMsg>,
},
@@ -75,6 +79,9 @@ impl<'a> From<&'a RolloutItem> for RolloutItemWire<'a> {
RolloutItem::WorldState(payload) => Self::WorldState {
payload: Cow::Borrowed(payload),
},
RolloutItem::SecurityRiskScore(payload) => Self::SecurityRiskScore {
payload: Cow::Borrowed(payload),
},
RolloutItem::EventMsg(payload) => Self::EventMsg {
payload: Cow::Borrowed(payload),
},
@@ -103,6 +110,9 @@ impl From<RolloutItemWire<'_>> for RolloutItem {
RolloutItemWire::Compacted { payload } => Self::Compacted(payload.into_owned()),
RolloutItemWire::TurnContext { payload } => Self::TurnContext(payload.into_owned()),
RolloutItemWire::WorldState { payload } => Self::WorldState(payload.into_owned()),
RolloutItemWire::SecurityRiskScore { payload } => {
Self::SecurityRiskScore(payload.into_owned())
}
RolloutItemWire::EventMsg { payload } => Self::EventMsg(payload.into_owned()),
}
}