Route Guardian reviewers through ThreadManager for inline parents (#45518)

## Why

Inline delegates have no entry in the thread registry, so reviewer creation cannot depend on looking up the parent or waiting for its thread-ready notification.

## What changed

- Capture parent identity, authentication, shared agent control, originator, and inherited instructions in `StartThreadOptions` so `ThreadManager` can start a child without a registered parent.
- Route Guardian reviewer creation through this path, remove the standalone fallback and readiness gate, and require a Guardian extension host.
- Install explicit reviewer hosts in unit tests and the Guardian reviewer extension in the integration test harness, using `ExtensionRegistry::to_builder()` to preserve existing contributors.

## Testing

Extend the thread-manager regression test to remove the parent from the registry before starting a child, then verify inherited lineage, originator, session identity, and authentication, and exclusion from the public thread list.

GitOrigin-RevId: 468ded6fdce7520cb39d55c1a884dcfa5aaea2d9
This commit is contained in:
jif authored and copyberry committed 2026-09-14 21:23:06 +00:00
1 parent 280c7e1e56
commit 7c73903be2
18 files changed
+318 -199

No files matched your search

+41
View File
@@ -1476,6 +1476,47 @@ async fn spawn_internal_session_preserves_parent_lineage_without_forking_history
.is_none()
);
// Captured lineage also works for an inline parent with no registry entry.
manager.remove_thread(&parent.thread_id).await;
let child = manager
.start_thread(StartThreadOptions {
internal_parent: Some(InternalSessionParent {
thread_id: parent.thread_id,
auth_manager: Arc::clone(&parent.thread.session.services.auth_manager),
agent_control: parent.thread.session.services.agent_control.clone(),
originator: reviewer_config.originator.clone(),
inherited_instructions: None,
}),
session_source: Some(SessionSource::Internal(
InternalSessionSource::MemoryConsolidation,
)),
..StartThreadOptions::new(parent.thread.session.get_config().await.as_ref().clone())
})
.await
.expect("start child without a parent registry entry");
let child_config = child.thread.config_snapshot().await;
assert_eq!(
(
child_config.parent_thread_id,
child_config.originator,
child.thread.session.session_id(),
),
(
Some(parent.thread_id),
reviewer_config.originator,
parent.thread.session.session_id(),
)
);
assert!(Arc::ptr_eq(
&child.thread.session.services.auth_manager,
&parent.thread.session.services.auth_manager
));
assert!(manager.list_thread_ids().await.is_empty());
parent
.thread
.shutdown_and_wait()
.await
.expect("stop parent");
manager
.shutdown_all_threads_bounded(Duration::from_secs(10))
.await;