mirror of
https://github.com/openai/codex.git
synced 2026-11-22 23:16:05 +00:00
Manage synchronous Guardian reviewers through the thread manager (#43570)
## What changed - Store the shared `GuardianReviewSessionManager` in thread extension data and let the Guardian extension spawn and fork reviewers through `ThreadManager`, independently of async scorer startup. - Preserve reviewer reuse, concurrent forks, cancellation, inherited environments, and user instructions. Gate managed reviewer startup on parent registration and remove terminated reviewers from the manager. - Retain the `guardian` subagent identity in saved conversations. Reject resume of live Guardian reviewers and reject client archive or delete of live owner-managed workers with JSON-RPC error `-32600`; allow normal access after the owner releases them. - Keep standalone reviewer support for inline delegates and remove duplicated extension prompt and configuration code. ## Testing Add app-server tests covering reviewer reuse and concurrent forks, inherited instructions and prompt cache keys, live resume and removal rejection, saved reviewer discovery and resume after parent shutdown, and strict Guardian assessment inside an inline review. GitOrigin-RevId: 4f9893c1ade151eacb4c11ffeae3d9e9ec019187
This commit is contained in:
1 parent
ca6fb194b6
commit
98a5cb46b1
33 files changed
+687
-1522
No files matched your search
@@ -177,6 +177,8 @@ pub struct GuardianRootSnapshot {
|
||||
pub struct CodexThread {
|
||||
pub(crate) session: Arc<Session>,
|
||||
pub(crate) io: SessionIo,
|
||||
// Registration source controls live access and lifecycle hooks. Managed Guardian
|
||||
// reviewers keep their existing subagent identity inside the session.
|
||||
pub(crate) session_source: SessionSource,
|
||||
session_configured: SessionConfiguredEvent,
|
||||
rollout_path: Option<PathBuf>,
|
||||
@@ -243,13 +245,18 @@ impl CodexThread {
|
||||
}
|
||||
|
||||
pub(crate) async fn emit_thread_ready_lifecycle(&self) {
|
||||
let config = self.config().await;
|
||||
for contributor in self
|
||||
let contributors = self
|
||||
.session
|
||||
.services
|
||||
.extensions
|
||||
.thread_lifecycle_contributors()
|
||||
{
|
||||
.thread_lifecycle_contributors();
|
||||
// Hook-free reviewers must reach their owner without suspending after registration.
|
||||
// Otherwise cancellation can strand the registered thread before cleanup is installed.
|
||||
if contributors.is_empty() {
|
||||
return;
|
||||
}
|
||||
let config = self.config().await;
|
||||
for contributor in contributors {
|
||||
contributor
|
||||
.on_thread_ready(codex_extension_api::ThreadReadyInput {
|
||||
config: config.as_ref(),
|
||||
@@ -658,7 +665,7 @@ impl CodexThread {
|
||||
|
||||
pub async fn guardian_trunk_rollout_path(&self) -> Option<PathBuf> {
|
||||
self.session
|
||||
.guardian_review_session
|
||||
.guardian_review_session()
|
||||
.trunk_rollout_path()
|
||||
.await
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user