Add reusable per-agent reviewer conversations to Guardian v3 (#62134)

## What changed

Give the root agent and subagents with a board identity their own Guardian
reviewer reservation. Each new reviewer thread starts with empty history
and uses the acting agent's live message-board retrieval tools.

Keep one reservation active per agent and retain the conversation only
when the caller marks it reusable. Reuse requires matching reviewer settings
and history-reset version. Dropping a reservation retires its thread.

## Testing

Add an integration test that checks thread reuse after a reusable
disposition, replacement after an unfinished reservation is dropped, and
exclusion of legacy subagents without a board identity.

GitOrigin-RevId: c7bccf4651ad4e04c42d9aee1d9e8de24b5b48df
This commit is contained in:
felixxia-oai
2026-11-17 23:48:01 +00:00
committed by copyberry
parent c2595ad343
commit 18d82cf7eb
6 changed files with 323 additions and 7 deletions
@@ -76,6 +76,16 @@ impl PreparedGuardianContext {
}
impl PreparedGuardianContext {
/// Compares reviewer settings and the parent's history-reset version.
/// Callers separately decide whether changes to parent history or the root's
/// authorization and review-context revisions allow reuse.
pub fn matches_session_configuration(&self, previous: &GuardianReviewSession) -> bool {
let mut key = self.key.clone();
key.root_review_version = previous.reuse_key.root_review_version;
key.parent_history_version = previous.reuse_key.parent_history_version;
key == previous.reuse_key
}
pub fn reuse_key(
&self,
previous: Option<&GuardianReviewSession>,