Support a host-selected inference provider for Guardian (#62588)

## Why

Guardian inherits the actor's inference provider by default. Hosts that run
actors on a different provider need to route Guardian reviews independently
and resolve reviewer policy and model capabilities from the Guardian provider.

## What changed

- Share the selected provider and its model catalog between asynchronous
  scoring and blocking approval reviews. Use the provider's preferred
  reviewer and resolve policy from managed requirements or reviewer model
  metadata.
- Keep Guardian review history independent of actor compaction when the
  host selects a provider. Preserve inherited routing when no provider is
  selected.

## Testing

Add integration coverage for separate actor and Guardian endpoints, catalog
isolation when both share an endpoint, and routing after resuming a compacted
thread.

GitOrigin-RevId: 1eb15421f746a58eefe27257e86d948de31bcf86
This commit is contained in:
XMLIU-oai
2026-11-19 20:43:32 +00:00
committed by copyberry
parent 8b2070d29f
commit 5f8c36e836
35 changed files with 1279 additions and 179 deletions
+9
View File
@@ -102,6 +102,15 @@ pub(crate) async fn run_codex_thread_interactive(
};
let mut thread_extension_init = codex_extension_api::ExtensionDataInit::default();
thread_extension_init.insert(isolation);
if config.guardian_model_provider.is_some()
&& Arc::ptr_eq(&auth_manager, &parent_session.services.auth_manager)
&& let Some(context) = parent_session
.services
.thread_extension_data
.get::<crate::guardian::GuardianInferenceContext>()
{
thread_extension_init.insert((*context).clone());
}
let spawn_result = Session::spawn(SessionSpawnArgs {
attached_thread: false,
startup: Some(Arc::clone(&startup)),