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

@@ -144,6 +144,7 @@ fn thread_sources_round_trip_as_scalar_labels() {
for (source, label) in [
(ThreadSource::User, "user"),
(ThreadSource::Subagent, "subagent"),
(ThreadSource::GuardianReview, "guardian_review"),
(
ThreadSource::Feature("automation".to_string()),
"automation",
@@ -101,6 +101,7 @@ impl From<ThreadHistoryMode> for CoreThreadHistoryMode {
pub enum ThreadSource {
User,
Subagent,
GuardianReview,
Feature(String),
MemoryConsolidation,
}
@@ -135,6 +136,7 @@ impl From<CoreThreadSource> for ThreadSource {
match value {
CoreThreadSource::User => ThreadSource::User,
CoreThreadSource::Subagent => ThreadSource::Subagent,
CoreThreadSource::GuardianReview => ThreadSource::GuardianReview,
CoreThreadSource::Feature(feature) => ThreadSource::Feature(feature),
CoreThreadSource::MemoryConsolidation => ThreadSource::MemoryConsolidation,
}
@@ -146,6 +148,7 @@ impl From<ThreadSource> for CoreThreadSource {
match value {
ThreadSource::User => CoreThreadSource::User,
ThreadSource::Subagent => CoreThreadSource::Subagent,
ThreadSource::GuardianReview => CoreThreadSource::GuardianReview,
ThreadSource::Feature(feature) => CoreThreadSource::Feature(feature),
ThreadSource::MemoryConsolidation => CoreThreadSource::MemoryConsolidation,
}