Move Guardian reviewer startup into the pool (#45521)

## What changed

Replace `ReviewerSessionFactory` with a startup callback installed through
`ReviewerPool::new`. Review requests supply shared setup data and reuse context,
while the pool uses its callback to create both reusable and forked reviewers.

Update Guardian session setup, prewarming, and existing test fixtures to use the
new pool API.

GitOrigin-RevId: fa171503afcee8bdbdf6822573bea8ded50ce117
This commit is contained in:
jif authored and copyberry committed 2026-09-14 21:34:33 +00:00
1 parent 78dfc1349e
commit e84a594636
6 files changed
+112 -104

No files matched your search

+5 -3
View File
@@ -2247,9 +2247,11 @@ impl Session {
/// Uses the extension-owned reviewer, or the same manager for standalone hosts.
pub(crate) fn guardian_review_session(&self) -> Arc<GuardianReviewSessionManager> {
self.services
.thread_extension_data
.get_or_init(GuardianReviewSessionManager::default)
self.services.thread_extension_data.get_or_init(|| {
GuardianReviewSessionManager::new(|context, key, kind, snapshot, cancel| {
Box::pin(async move { context.spawn(key, kind, snapshot, cancel).await })
})
})
}
pub(crate) async fn emit_turn_started(&self, turn_context: &TurnContext) {