Distinguish Guardian review threads from subagents (#40221)

## Why

Guardian reviews were reported with the generic `subagent` thread source, making them indistinguishable from other delegated threads in persisted metadata and analytics.

## What changed

- Add the `guardian_review` thread source to the core protocol and app-server schema.
- Assign it to Guardian reviewer sessions and propagate the configured source through turn metadata, rollouts, and analytics.
- Continue treating Guardian reviews like subagents for paginated history and trusted-provenance checks.

## Testing

- Cover protocol round trips, delegate source selection, emitted analytics, request metadata, and persisted rollout metadata.

GitOrigin-RevId: 07480c122715812874c9d3b48bb39fc5c86b2367
This commit is contained in:
Dylan Hurd authored and copyberry committed 2026-08-23 10:06:57 +00:00
1 parent 83d1fe0e67
commit c9b19deb09
16 files changed
+74 -28

No files matched your search

+2 -1
View File
@@ -1323,7 +1323,7 @@ impl Session {
ThreadHistoryMode::Paginated
) && matches!(
session_configuration.thread_source.as_ref(),
Some(ThreadSource::Subagent)
Some(ThreadSource::Subagent | ThreadSource::GuardianReview)
),
)
};
@@ -4230,6 +4230,7 @@ pub(crate) fn emit_subagent_session_started(
client_version,
model: thread_config.model,
ephemeral: thread_config.ephemeral,
thread_source: thread_config.thread_source,
subagent_source,
created_at,
});