Files
codex/codex-rs
ioanbudea-OAI 76cf0f45ec Reserve item ID overhead before elastic context allocation (#61347)
## Why

Elastic request allocation did not account for item IDs added after evidence selection. Their token cost could push the completed request over its input limit instead of allowing optional evidence to be dropped.

## What changed

Reserve IDs for the possible new request items before allocating evidence, including their JSON escaping and field overhead in the global request budget. Assign the same reserved IDs to the selected items while preserving existing IDs and committed history.

## Testing

Add coverage for escaped IDs and native tool call outputs, and a regression test with long IDs that verifies optional images are omitted while committed history and new transcript text are retained within budget. Update budget boundary tests to distinguish fixed rejection from elastic evidence reduction.

GitOrigin-RevId: 621d6d83e3cc95efb9eef4976dff9b7799a6e7c8
2026-11-13 18:47:46 +00:00
..
…
…
…
…