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

+5
View File
@@ -100,6 +100,10 @@ pub(super) async fn spawn_review_thread(
};
per_turn_config.service_tier = service_tier;
let auto_review_enabled = crate::guardian::routes_approval_policy_to_guardian(
per_turn_config.permissions.approval_policy.value(),
per_turn_config.approvals_reviewer,
);
let per_turn_config = Arc::new(per_turn_config);
let review_turn_id = sub_id.to_string();
let turn_metadata_state = Arc::new(TurnMetadataState::new(
@@ -115,6 +119,7 @@ pub(super) async fn spawn_review_thread(
&parent_turn_context.permission_profile(),
parent_turn_context.windows_sandbox_level,
parent_turn_context.network.is_some(),
auto_review_enabled,
));
let extension_data = Arc::new(codex_extension_api::ExtensionData::new(