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
2026-08-23 10:01:24 +00:00
committed by copyberry
parent 83d1fe0e67
commit c9b19deb09
16 changed files with 74 additions and 28 deletions

View File

@@ -2604,6 +2604,7 @@ pub enum SessionSource {
pub enum ThreadSource {
User,
Subagent,
GuardianReview,
Feature(String),
MemoryConsolidation,
}
@@ -2613,6 +2614,7 @@ impl ThreadSource {
match self {
ThreadSource::User => "user",
ThreadSource::Subagent => "subagent",
ThreadSource::GuardianReview => "guardian_review",
ThreadSource::Feature(feature) => feature,
ThreadSource::MemoryConsolidation => "memory_consolidation",
}
@@ -2646,6 +2648,7 @@ impl FromStr for ThreadSource {
match value {
"user" => Ok(ThreadSource::User),
"subagent" => Ok(ThreadSource::Subagent),
"guardian_review" => Ok(ThreadSource::GuardianReview),
"memory_consolidation" => Ok(ThreadSource::MemoryConsolidation),
other => Ok(ThreadSource::Feature(other.to_string())),
}