Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Raise Guardian's action review limit to 200,000 bytes (#44060)

Won Park3d3df0a0cad5
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),
})
);
}