guardian: cap planned action context

This commit is contained in:
Michael Bolin
2026-06-11 11:50:50 -04:00
parent df0d400304
commit d7c86f0dd7
2 changed files with 5 additions and 1 deletions

View File

@@ -54,7 +54,7 @@ const GUARDIAN_MAX_MESSAGE_TRANSCRIPT_TOKENS: usize = 10_000;
const GUARDIAN_MAX_TOOL_TRANSCRIPT_TOKENS: usize = 10_000;
const GUARDIAN_MAX_MESSAGE_ENTRY_TOKENS: usize = 2_000;
const GUARDIAN_MAX_TOOL_ENTRY_TOKENS: usize = 1_000;
const GUARDIAN_MAX_ACTION_STRING_TOKENS: usize = 16_000;
const GUARDIAN_MAX_ACTION_STRING_TOKENS: usize = 10_000;
const GUARDIAN_RECENT_ENTRY_LIMIT: usize = 40;
const TRUNCATION_TAG: &str = "truncated";

View File

@@ -827,6 +827,10 @@ fn format_guardian_action_pretty_truncates_large_string_fields() -> serde_json::
assert!(rendered.text.contains("\"tool\": \"apply_patch\""));
assert!(rendered.text.contains("<truncated omitted_approx_tokens="));
assert!(rendered.text.len() < patch.len());
assert!(
rendered.text.len() < 80_000,
"guardian action text should stay below the 10k-token context review cap"
);
assert!(rendered.truncated);
Ok(())
}