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

+2
View File
@@ -6167,6 +6167,7 @@ pub(crate) async fn make_session_and_context() -> (Session, TurnContext) {
skills_snapshot,
);
session.mark_mcp_runtime_dirty();
crate::guardian::test_host::install(&session, &turn_context.config);
(session, turn_context)
}
@@ -8344,6 +8345,7 @@ where
skills_snapshot,
));
session.mark_mcp_runtime_dirty();
crate::guardian::test_host::install(&session, &turn_context.config);
(session, turn_context, rx_event)
}
@@ -223,6 +223,7 @@ async fn request_permissions_routes_to_guardian_when_reviewer_is_enabled() {
config.model_provider.clone(),
);
session.services.models_manager = models_manager;
crate::guardian::test_host::install(&session, &config);
turn_context_raw.config = Arc::clone(&config);
turn_context_raw.provider = create_model_provider(
config.model_provider.clone(),
@@ -423,6 +424,7 @@ async fn request_permissions_guardian_review_stops_when_cancelled() {
.expect("single session ref")
.services
.models_manager = models_manager;
crate::guardian::test_host::install(&session, &config);
turn_context_raw.config = Arc::clone(&config);
turn_context_raw.provider = create_model_provider(
config.model_provider.clone(),
@@ -549,6 +551,7 @@ async fn guardian_allows_exec_command_additional_permissions_requests_past_polic
config.model_provider.clone(),
);
session.services.models_manager = models_manager;
crate::guardian::test_host::install(&session, &config);
turn_context_raw.config = Arc::clone(&config);
turn_context_raw.provider = create_model_provider(
config.model_provider.clone(),
@@ -668,6 +671,7 @@ async fn strict_auto_review_turn_grant_forces_guardian_for_exec_command_policy_s
config.model_provider.clone(),
);
session.services.models_manager = models_manager;
crate::guardian::test_host::install(&session, &config);
turn_context_raw.config = Arc::clone(&config);
turn_context_raw.provider = create_model_provider(
config.model_provider.clone(),