mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Preserve complete actions in Guardian approval reviews (#44569)
## Why Truncating action arguments can leave approval reviewers evaluating incomplete actions. Large actions need complete review input and explicit handling when they exceed the review budget. ## What changed - Remove action truncation and the fixed synchronous action byte limit. Admit complete actions against the whole-request budget, splitting long text losslessly into bounded transport parts and accounting for their framing. - Route actions exceeding the asynchronous action budget to synchronous review. Prevent cached scores from covering oversized calls, including expanded approval arguments, while allowing later small actions to recover score reuse. - Request user approval when optional review exhausts its local input budget. Keep required review and compaction service failures closed to approval, and retire exhausted review sessions. ## Testing Add coverage for complete large-action delivery, optional user fallback, required-review denial, subsequent review recovery, async overflow through MCP approval routing, and lossless text splitting with budget accounting. GitOrigin-RevId: 08f06e68a94b2f779480dd6b6cf5bc30b241f6dd
This commit is contained in:
1 parent
3319d9b296
commit
9c4879f3a5
33 files changed
+841
-547
No files matched your search
@@ -39,7 +39,6 @@ use codex_protocol::models::ResponseInputItem;
|
||||
use codex_protocol::models::ResponseItem;
|
||||
use codex_protocol::openai_models::InputModality;
|
||||
use codex_protocol::openai_models::ReasoningEffort as ReasoningEffortConfig;
|
||||
#[cfg(test)]
|
||||
use codex_protocol::protocol::CodexErrorInfo;
|
||||
use codex_protocol::protocol::Event;
|
||||
use codex_protocol::protocol::EventMsg;
|
||||
@@ -610,7 +609,6 @@ async fn run_review_on_session(
|
||||
);
|
||||
}
|
||||
};
|
||||
let reviewed_action_truncated = prompt_items.reviewed_action_truncated;
|
||||
let transcript_cursor = prompt_items.transcript_cursor;
|
||||
let node_repl_evidence_admission = (prompt_items.node_repl_evidence_sequence
|
||||
> last_admitted_node_repl_response_sequence)
|
||||
@@ -691,7 +689,6 @@ async fn run_review_on_session(
|
||||
response_sequence,
|
||||
});
|
||||
}
|
||||
analytics_result.reviewed_action_truncated = reviewed_action_truncated;
|
||||
|
||||
let outcome = wait_for_guardian_review(
|
||||
review_session,
|
||||
@@ -719,14 +716,29 @@ async fn run_review_on_session(
|
||||
state.prior_review_count = state.prior_review_count.saturating_add(1);
|
||||
state.last_reviewed_transcript_cursor = Some(transcript_cursor);
|
||||
}
|
||||
let keep_review_session = outcome.1
|
||||
&& review_session
|
||||
.session
|
||||
.services
|
||||
.thread_extension_data
|
||||
.remove::<super::request_budget::ExhaustedReviewBudget>()
|
||||
.is_none();
|
||||
(outcome.0, keep_review_session, analytics_result)
|
||||
let budget_exhausted = review_session
|
||||
.session
|
||||
.services
|
||||
.thread_extension_data
|
||||
.remove::<super::request_budget::ExhaustedReviewBudget>();
|
||||
let result = match outcome.0 {
|
||||
GuardianReviewSessionOutcome::SessionFailed {
|
||||
error_info: Some(CodexErrorInfo::ContextWindowExceeded),
|
||||
..
|
||||
} if matches!(
|
||||
budget_exhausted.as_deref(),
|
||||
Some(super::request_budget::ExhaustedReviewBudget::Detected)
|
||||
) =>
|
||||
{
|
||||
GuardianReviewSessionOutcome::InputBudgetExceeded
|
||||
}
|
||||
result => result,
|
||||
};
|
||||
(
|
||||
result,
|
||||
outcome.1 && budget_exhausted.is_none(),
|
||||
analytics_result,
|
||||
)
|
||||
}
|
||||
|
||||
async fn ensure_guardian_followup_reminder(review_session: &GuardianReviewSession) {
|
||||
|
||||
Reference in new issue
Block a user