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:
felixxia-oai authored and copyberry committed 2026-09-10 16:01:02 +00:00
1 parent 3319d9b296
commit 9c4879f3a5
33 files changed
+841 -547

No files matched your search

+3 -3
View File
@@ -168,10 +168,10 @@ impl codex_extension_api::SynchronousApprovalReviewer for AllContributors {
fn review(
&self,
_reason: codex_protocol::approvals::GuardianReviewReason,
) -> ExtensionFuture<'_, codex_protocol::protocol::ReviewDecision> {
Box::pin(std::future::ready(
) -> ExtensionFuture<'_, Option<codex_protocol::protocol::ReviewDecision>> {
Box::pin(std::future::ready(Some(
codex_protocol::protocol::ReviewDecision::Approved,
))
)))
}
}