Add opt-in conversation history retrieval to Guardian reviews (#49036)

## Why

The transcript supplied to Guardian may omit earlier user instructions, restrictions, or revoked permissions. History retrieval lets the reviewer check relevant authorization before approving actions with side effects.

## What changed

- Add the disabled-by-default `guardian_conversation_history_tools` feature. With Apps enabled, expose `user_message.search_messages` and `user_message.read_messages` through the parent's live Apps connection and conversation identity.
- Recheck the parent's current app and tool policy on each call, rejecting disabled tools and calls requiring approval.
- Add retrieval instructions that distinguish user authorization from assistant context and account for later revocations and incomplete results. Allow overrides through `auto_review.experimental_conversation_history_prompt`.
- Limit history responses to an estimated 4,000 tokens by default, configurable through `auto_review.conversation_history_max_output_tokens`, while preserving stricter parent and reviewer limits.
- Allow explicit extension registries for isolated sessions and prevent those sessions from inheriting the implicit Apps connection.

## Testing

Add scenarios covering history tool exposure, parent connection and identity reuse, custom prompts, output truncation, stricter reviewer budgets, and live permission changes on a reused reviewer. Extend configuration coverage for blank prompt overrides.

GitOrigin-RevId: 055a69b113c8548bd58e7d5618ea026ba6d1ffb1
This commit is contained in:
felixxia-oai
2026-09-28 17:29:52 +00:00
committed by copyberry
parent 46fdd5ef39
commit 41ed72c32b
21 changed files with 718 additions and 27 deletions
+8
View File
@@ -334,6 +334,8 @@ pub enum Feature {
GuardianEnhancedNodeReplTranscripts,
/// Include completed node_repl or cua_repl Code Mode response images in Guardian reviews.
GuardianNodeReplTranscriptImages,
/// Give Guardian access to the root conversation's message history tools.
GuardianConversationHistoryTools,
/// Enable Guardian V2 automatic approval reviews.
GuardianV2,
/// Removed compatibility flag for the unused Guardian extension prototype.
@@ -1671,6 +1673,12 @@ pub const FEATURES: &[FeatureSpec] = &[
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec {
id: Feature::GuardianConversationHistoryTools,
key: "guardian_conversation_history_tools",
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec {
id: Feature::GuardianV2,
key: "guardianv2",