Files
codex/codex-rs/ext/guardian-v2/src/lib.rs
T
jif a113f3e063 Consolidate Guardian reviewer lifecycle ownership (#45672)
## What changed

- Use cancellation guards to tie reusable reviewers and temporary forks to their lifetimes, including when a review future is dropped. Replace cancelled reusable reviewers before reuse.
- Share `ReviewerTasks` between the pool and `ThreadManager`, and wait for tracked cleanup during pool shutdown. Remove the separate session shutdown protocol.
- Move denial cleanup from core task handling into Guardian's turn start, stop, and abort hooks. Expose `install_reviewer` to register both thread and turn lifecycle contributors together.

## Testing

Add an integration test that exercises stale denial cleanup at turn start, completion, and interruption, including starting another turn after interruption.

GitOrigin-RevId: 85badb235309c1e1576547d1746f7ee9fc66d545
2026-09-15 10:45:16 +00:00

23 lines
621 B
Rust

use std::sync::Arc;
use std::sync::Weak;
use codex_core::ThreadManager;
use codex_core::config::Config;
use codex_extension_api::ExtensionRegistryBuilder;
use codex_login::AuthManager;
mod async_scorer;
mod sync_reviewer;
pub use sync_reviewer::install as install_reviewer;
/// Installs the guardian contributors into the extension registry.
pub fn install(
registry: &mut ExtensionRegistryBuilder<Config>,
auth_manager: Arc<AuthManager>,
thread_manager: Weak<ThreadManager>,
) {
async_scorer::install(registry, auth_manager, thread_manager.clone());
install_reviewer(registry, thread_manager);
}