mirror of
https://github.com/openai/codex.git
synced 2026-11-05 20:10:33 +00:00
Skip stale Guardian risk score persistence (#38612)
## Why Concurrent Guardian samples can finish out of order. A stale result rejected by the thread's latest-score update could still be appended to the rollout. ## What changed Return without persisting a risk score when `insert_if` rejects it as older than the score already stored on the thread. GitOrigin-RevId: 7b2c895742753a19dfe48fd7f8ecd912d3cd3af6
This commit is contained in:
@@ -382,11 +382,14 @@ impl ToolLifecycleContributor for GuardianV2Extension {
|
||||
scores,
|
||||
sampled_at: Some(sampled_at.into()),
|
||||
};
|
||||
thread
|
||||
if !thread
|
||||
.thread_extension_data()
|
||||
.insert_if(score.clone(), |previous| {
|
||||
previous.is_none_or(|previous| previous.sampled_at < score.sampled_at)
|
||||
});
|
||||
})
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
if !ephemeral {
|
||||
thread
|
||||
.append_rollout_items(&[RolloutItem::SecurityRiskScore(score)])
|
||||
|
||||
Reference in New Issue
Block a user