Include auto-review state in turn metadata (#38046)

## What changed

- Add `auto_review_enabled` to serialized turn metadata for regular and review turns.
- Derive the value from approval-policy routing and reserve the metadata key so client-provided metadata cannot override it.

## Testing

- Cover enabled metadata, reserved-key handling, Guardian review requests, and updated compaction request snapshots.

GitOrigin-RevId: 52773e2bf7d4be251f8466332de9f9c9869dd084
This commit is contained in:
sayan-oai authored and copyberry committed 2026-08-11 18:06:05 +00:00
1 parent 99915080b6
commit f2a6f2585c
8 files changed
+47 -2

No files matched your search

+4
View File
@@ -107,6 +107,7 @@ pub(crate) struct TurnMetadataState {
turn_id: String,
sandbox: Option<String>,
sandbox_mode: Option<String>,
auto_review_enabled: bool,
enriched_workspaces: RwLock<Option<BTreeMap<String, TurnMetadataWorkspace>>>,
tool_namespaces_info: RwLock<Option<TurnToolNamespacesInfo>>,
turn_started_at_unix_ms: RwLock<Option<i64>>,
@@ -130,6 +131,7 @@ impl TurnMetadataState {
permission_profile: &PermissionProfile,
windows_sandbox_level: WindowsSandboxLevel,
enforce_managed_network: bool,
auto_review_enabled: bool,
) -> Self {
let repo_root = get_git_repo_root(&cwd);
let sandbox = Some(
@@ -156,6 +158,7 @@ impl TurnMetadataState {
turn_id,
sandbox,
sandbox_mode,
auto_review_enabled,
enriched_workspaces: RwLock::new(None),
tool_namespaces_info: RwLock::new(None),
turn_started_at_unix_ms: RwLock::new(None),
@@ -304,6 +307,7 @@ impl TurnMetadataState {
thread_source: self.thread_source.clone(),
sandbox: self.sandbox.clone(),
sandbox_mode: self.sandbox_mode.clone(),
auto_review_enabled: Some(self.auto_review_enabled),
workspaces: self.current_workspaces(),
tool_namespaces_info: self
.tool_namespaces_info