From 866fdc41ecb76fce3825dfaae8c356a6bb46834e Mon Sep 17 00:00:00 2001 From: won Date: Tue, 8 Sep 2026 21:59:29 -0700 Subject: [PATCH] Raise Guardian action review limit to about 50k tokens --- codex-rs/core/src/guardian/mod.rs | 2 +- codex-rs/core/src/guardian/tests.rs | 4 ++-- codex-rs/core/src/unified_exec/process_manager.rs | 3 ++- codex-rs/core/tests/suite/guardian_mcp_elicitation.rs | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/codex-rs/core/src/guardian/mod.rs b/codex-rs/core/src/guardian/mod.rs index 5e8fdb648d..943649536a 100644 --- a/codex-rs/core/src/guardian/mod.rs +++ b/codex-rs/core/src/guardian/mod.rs @@ -67,7 +67,7 @@ const GUARDIAN_MAX_TOOL_ENTRY_TOKENS: usize = codex_guardian_context::ContextPro .tool_tokens; pub(crate) const GUARDIAN_MAX_ROOT_MESSAGE_TOKENS: usize = 900; pub(crate) const GUARDIAN_MAX_NODE_REPL_TOOL_RESULT_TOKENS: usize = 6_000; -pub(crate) const GUARDIAN_MAX_ACTION_BYTES: usize = 8_000; +pub(crate) const GUARDIAN_MAX_ACTION_BYTES: usize = 50_000 * 4; const GUARDIAN_MAX_ACTION_STRING_TOKENS: usize = 16_000; /// Captures review inputs from the issuing step without retaining its MCP bindings or tool router. diff --git a/codex-rs/core/src/guardian/tests.rs b/codex-rs/core/src/guardian/tests.rs index 1599c04df8..543f86a898 100644 --- a/codex-rs/core/src/guardian/tests.rs +++ b/codex-rs/core/src/guardian/tests.rs @@ -1238,7 +1238,7 @@ fn guardian_action_formatters_reject_large_aggregate_payloads() { let action = GuardianApprovalRequest::ApplyPatch { id: "patch-1".to_string(), cwd: test_path_buf("/tmp").abs().into(), - files: vec![file; 1_000], + files: vec![file; 20_000], patch: String::new(), }; @@ -1250,7 +1250,7 @@ fn guardian_action_formatters_reject_large_aggregate_payloads() { error .expect_err("aggregate action should exceed the review limit") .to_string(), - "Guardian action exceeds the 8000-byte review limit" + "Guardian action exceeds the 200000-byte review limit" ); } } diff --git a/codex-rs/core/src/unified_exec/process_manager.rs b/codex-rs/core/src/unified_exec/process_manager.rs index a224b5f646..f19147f660 100644 --- a/codex-rs/core/src/unified_exec/process_manager.rs +++ b/codex-rs/core/src/unified_exec/process_manager.rs @@ -102,6 +102,7 @@ const UNIFIED_EXEC_ENV: [(&str, &str); 10] = [ const NETWORK_ACCESS_DENIED_MESSAGE: &str = "Network access was denied by the Codex sandbox network proxy."; const LATE_NETWORK_DENIAL_GRACE_PERIOD: Duration = Duration::from_millis(100); +const MAX_STDIN_APPROVAL_BYTES: usize = 8_000; const INTERRUPT: &str = "\u{3}"; /// Test-only override for deterministic unified exec process IDs. @@ -862,7 +863,7 @@ impl UnifiedExecProcessManager { // Bound the entire serialized action plus its reason, including JSON // escaping. Reject, never execute an unreviewed tail. let oversized = reviewed.text.len().saturating_add(approval_reason.len()) - > crate::guardian::GUARDIAN_MAX_ACTION_BYTES; + > MAX_STDIN_APPROVAL_BYTES; let size_check_result = if reviewed.truncated { "formatter_truncated" } else if oversized { diff --git a/codex-rs/core/tests/suite/guardian_mcp_elicitation.rs b/codex-rs/core/tests/suite/guardian_mcp_elicitation.rs index c028c736e4..bd4ee08ec6 100644 --- a/codex-rs/core/tests/suite/guardian_mcp_elicitation.rs +++ b/codex-rs/core/tests/suite/guardian_mcp_elicitation.rs @@ -417,7 +417,7 @@ async fn node_elicitations_attribute_independent_reviews_without_changing_action "connector_name": "Inner Connector", "connector_description": "Connector for the reviewed inner action", "tool_title": "Inner action", - "tool_description": "Review this action independently from JavaScript", + "tool_description": "Review this action independently from JavaScript".repeat(220), }); match call_id_source { CallIdSource::Host | CallIdSource::Missing => {} @@ -607,7 +607,7 @@ async fn node_elicitations_attribute_independent_reviews_without_changing_action "connector_id": "inner-connector", "connector_name": "Inner Connector", "connector_description": "Connector for the reviewed inner action", "tool_title": "Inner action", - "tool_description": "Review this action independently from JavaScript", + "tool_description": "Review this action independently from JavaScript".repeat(220), }) ); }