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

+6
View File
@@ -333,6 +333,9 @@ pub(crate) async fn run_turn(
}
// Incoming evidence can overflow even below the normal history
// threshold. Keep it pending while compacting, then select once more.
sess.services
.thread_extension_data
.insert(crate::guardian::ExhaustedReviewBudget::Compacting);
run_auto_compact(
&sess,
Arc::clone(&first_step_context),
@@ -704,6 +707,9 @@ pub(crate) async fn run_turn(
// token-budget resets must fail closed and retire the reviewer.
// Retry once per model step, so ineffective compaction cannot loop.
guardian_budget_compacted = true;
sess.services
.thread_extension_data
.insert(crate::guardian::ExhaustedReviewBudget::Compacting);
run_auto_compact(
&sess,
Arc::clone(&step_context),