mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Instrument stdin review size checks (#41189)
## What changed Emit a `codex.unified_exec.stdin_review.size_check` counter when reviewing input for an escalated terminal. Tag each check with: - the result: `formatter_truncated`, `over_limit`, or `within_limit`; - whether the submitted input is control-only or text. Preserve the existing rejection behavior for truncated or oversized reviews. GitOrigin-RevId: 6556beb2121cfaf91d572a26822b50442391c95f
This commit is contained in:
1 parent
4761851ff3
commit
efc020d224
1 file changed
+19
-3
@@ -807,9 +807,25 @@ impl UnifiedExecProcessManager {
|
|||||||
.map_err(|err| UnifiedExecError::StdinApproval(ToolError::Rejected(err.to_string())))?;
|
.map_err(|err| UnifiedExecError::StdinApproval(ToolError::Rejected(err.to_string())))?;
|
||||||
// Bound the entire serialized action plus its reason, including JSON
|
// Bound the entire serialized action plus its reason, including JSON
|
||||||
// escaping. Reject, never execute an unreviewed tail.
|
// escaping. Reject, never execute an unreviewed tail.
|
||||||
if reviewed.truncated
|
let oversized = reviewed.text.len().saturating_add(approval_reason.len()) > 8_000;
|
||||||
|| reviewed.text.len().saturating_add(approval_reason.len()) > 8_000
|
let size_check_result = if reviewed.truncated {
|
||||||
{
|
"formatter_truncated"
|
||||||
|
} else if oversized {
|
||||||
|
"over_limit"
|
||||||
|
} else {
|
||||||
|
"within_limit"
|
||||||
|
};
|
||||||
|
let input_kind = if request.input.chars().all(char::is_control) {
|
||||||
|
"control"
|
||||||
|
} else {
|
||||||
|
"text"
|
||||||
|
};
|
||||||
|
context.step_context.session_telemetry.counter(
|
||||||
|
"codex.unified_exec.stdin_review.size_check",
|
||||||
|
/*inc*/ 1,
|
||||||
|
&[("result", size_check_result), ("input_kind", input_kind)],
|
||||||
|
);
|
||||||
|
if reviewed.truncated || oversized {
|
||||||
return Err(UnifiedExecError::StdinApproval(ToolError::Rejected(
|
return Err(UnifiedExecError::StdinApproval(ToolError::Rejected(
|
||||||
"terminal input and permission details are too large to review safely; use a smaller input or start a new terminal with fewer grants".to_string(),
|
"terminal input and permission details are too large to review safely; use a smaller input or start a new terminal with fewer grants".to_string(),
|
||||||
)));
|
)));
|
||||||
|
|||||||
Reference in new issue
Block a user