Give Guardian classifications distinct turn identities (#41385)

## What changed

- Generate a UUIDv7 turn ID for each Guardian classification and preserve it across retries.
- Record the owning turn as `parent_turn_id` and propagate its trusted `root_turn_id` when known, including through the tool lifecycle extension API.
- Omit ambiguous or unknown root lineage and keep classification identities distinct when reusing Guardian sessions and WebSocket connections.

## Testing

- Cover classification metadata across retries, connection reuse, concurrent samples, auth refresh, and consecutive owning turns.

GitOrigin-RevId: 78757f2ad031844e4b545802f634c678a9ee2298
This commit is contained in:
Eddie Chen authored and copyberry committed 2026-08-28 18:23:47 +00:00
1 parent e4d0ba4e92
commit 60fc699560
11 files changed
+221 -62

No files matched your search

+2
View File
@@ -28,6 +28,7 @@ pub(crate) async fn notify_tool_start(
}
let thread_store = &invocation.session.services.thread_extension_data;
let conversation_history = invocation.session.conversation_history_snapshot().await;
let root_turn_id = invocation.turn.turn_metadata_state.root_turn_id();
for contributor in contributors {
contributor
@@ -36,6 +37,7 @@ pub(crate) async fn notify_tool_start(
thread_store,
turn_store: invocation.turn.extension_data.as_ref(),
turn_id: invocation.turn.sub_id.as_str(),
root_turn_id: root_turn_id.as_deref(),
call_id: invocation.call_id.as_str(),
tool_name: &invocation.tool_name,
mcp_tool,