Defer synchronous Guardian tool-call truncation to preparation (#56505)

## What changed

Preserve complete tool-call text when collecting synchronous Guardian context, then apply the profile's tool token limit when preparing the transcript. Calculate retained bytes and token usage from the truncated text.

## Testing

Extend the oversized-action regression test to verify that a subsequent review includes the previous call's arguments truncated to the 1,000-token history limit.

GitOrigin-RevId: 2b52505d9ccfa3651b3535e67cc12597be819459
This commit is contained in:
ioanbudea-OAI
2026-10-23 15:37:39 +00:00
committed by copyberry
parent 2839ed763b
commit 1c0c45bfc3
5 changed files with 53 additions and 18 deletions
+2 -2
View File
@@ -267,8 +267,8 @@ pub(crate) fn render_guardian_transcript_entries(
/// Keep both tool calls and tool results here. The reviewer often needs the
/// agent's exact queried path / arguments as well as the returned evidence to
/// decide whether the pending approval is justified.
/// Per-entry truncation happens during collection, using the current review's
/// Node REPL cap; the cursor still counts every non-empty evidence entry.
/// Tool-call truncation happens in sync preparation; other caps still apply
/// during collection. The cursor counts every non-empty evidence entry.
pub(super) fn collect_guardian_context(
history: &dyn SectionHistory,
node_repl_result_token_limit: usize,