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
This commit is contained in:
ioanbudea-OAI
2026-10-26 20:41:16 +00:00
committed by copyberry
parent 333d7bde0f
commit b881730487
2 changed files with 3 additions and 5 deletions
+2 -4
View File
@@ -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(),
+1 -1
View File
@@ -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 {