mirror of
https://github.com/openai/codex.git
synced 2026-10-31 19:28:49 +00:00
## What changed Add `PreparedElasticContext::enforce_budget` to reserve existing context, required evidence, history, and an omission notice before allocating remaining tokens across optional evidence groups. Scale minimum reservations to fit, favor recent whole entries, and redistribute unused capacity while preserving retained content and order. Account for shared section framing and keep images whole. Record omitted entries and reject requests when required evidence cannot fit. Supply defaults for unconfigured groups and rename allocation groups to match their source sections, retaining previous serialized names as aliases. ## Testing Add unit tests for recent-entry selection, redistribution of packing gaps, whole-image retention, shared framing, default limits, and preservation of required instructions and historical approvals under tight budgets. GitOrigin-RevId: a3c789a5936ec3f22893a31a0014c0902197a281