Publish Guardian cached scores and coverage atomically (#46245)

## Why

Asynchronous score publication updated the risk score, authorization, and tool-call coverage separately. Approval checks could therefore read inconsistent evidence when deciding whether to reuse a cached score.

## What changed

Keep Guardian's cached score and observation state under one lock, and use consistent snapshots for approval checks. Publish successful scores together with their authorization and classified tool-call index. Preserve timestamp ordering, fail-closed precedence on timestamp ties, and per-call oversized-action tracking.

## Testing

Add regression coverage for rejected delayed results and timestamp ties. Add a gated integration test showing that a delayed score becomes stale after intervening tool calls, while a sufficiently fresh score permits cached approval.

GitOrigin-RevId: 8df6fafd5e0ee59aa0f78f541eac562efce3d4d0
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-09-17 16:06:11 +00:00
1 parent 2833985d88
commit fcf05456bb
12 files changed
+833 -401

No files matched your search

+2
View File
@@ -74,6 +74,8 @@ mod external_auth;
mod fork_thread;
mod git_enrichment;
mod guardian_authorization;
#[path = "guardian_cached_score_tests.rs"]
mod guardian_cached_score;
#[path = "guardian_checkpoint_migration_tests.rs"]
mod guardian_checkpoint_migration;
// Uses the same command-approval harness as guardian_review below.