Files
codex/codex-rs/core/tests/suite
tongzhou wang ce82e38b16 Gate new rollout work on shared budget exhaustion (#61582)
## Why

A budget can be exhausted while another thread waits to start work. New requests, tools, and automatic turns must observe that stop without discarding an already-consumed response whose cost exhausted the budget.

## What changed

- Share a work gate across the rollout tree while preserving native and host accounting ownership.
- Recheck the budget before HTTP and WebSocket requests, hook execution, tool dispatch, and compaction. Prevent automatic wakeups and late input from restarting stopped work, leaving pending input queued.
- Record response costs without rejecting the consumed response solely because its bill exhausts the budget, and stop new work when enforced accounting overflows.
- Expose a thread-registration receipt that remains committed after unload.

## Testing

Extend rollout-budget coverage to verify that accepted response text remains in history after exhaustion and that waiting tools observe the shared stop while completed tools retain their results.

GitOrigin-RevId: e583d657c6f29e374d374cdb014bf23fd6c28614
2026-11-15 00:03:23 +00:00
..