From b88173048752cd971fd75a722afaeaad52c40e59 Mon Sep 17 00:00:00 2001 From: ioanbudea-OAI Date: Mon, 26 Oct 2026 12:26:11 +0000 Subject: [PATCH] Honor configured message limits for encrypted guardian transcripts (#57241) Remove the hard-coded 9,000-token cap for encrypted agent messages in both synchronous and asynchronous guardian context. Use `message_tokens` directly when converting the configured limit to a byte budget, allowing larger messages when the configured limit permits them. Messages that exceed the configured budget still produce an omission notice; encrypted content remains intact when retained. GitOrigin-RevId: a9032ca19102ebad44be8df1ac4d4892d4404ead --- codex-rs/guardian-context/src/profile.rs | 6 ++---- codex-rs/guardian-context/src/transcript.rs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/codex-rs/guardian-context/src/profile.rs b/codex-rs/guardian-context/src/profile.rs index df58ff3dbd..779807ba0f 100644 --- a/codex-rs/guardian-context/src/profile.rs +++ b/codex-rs/guardian-context/src/profile.rs @@ -316,10 +316,8 @@ fn prepare_sync_content<'a>( TranscriptContent::Record(record) => record.text(), TranscriptContent::AgentMessage(_) => { // Native ciphertext stays whole, or leaves an omission at the same position. - let limit = codex_protocol::protocol::TruncationPolicy::Tokens( - limits.message_tokens.min(/*other*/ 9_000), - ) - .byte_budget(); + let limit = codex_protocol::protocol::TruncationPolicy::Tokens(limits.message_tokens) + .byte_budget(); return if entry.original_bytes > limit { std::borrow::Cow::Owned(TranscriptContent::Text( crate::transcript::TRANSCRIPT_OMISSION_NOTICE.to_owned(), diff --git a/codex-rs/guardian-context/src/transcript.rs b/codex-rs/guardian-context/src/transcript.rs index 56a2ea2a10..50872f4b52 100644 --- a/codex-rs/guardian-context/src/transcript.rs +++ b/codex-rs/guardian-context/src/transcript.rs @@ -217,7 +217,7 @@ fn collect_transcript_for_target( TranscriptContent::AgentMessage(Box::new(item.clone())) } else { let limit = codex_protocol::protocol::TruncationPolicy::Tokens( - config.entry_limits.message_tokens.min(9_000), + config.entry_limits.message_tokens, ) .byte_budget(); if bytes <= limit {