Files
codex/codex-rs/core/src/utils
Tamir Duberstein 46aa019e80 Count serialized JSON bytes without allocating strings (#40604)
## Why

History estimation and executed-tool-call limits only need the size of serialized JSON, not the serialized output itself.

## What changed

- Add a shared `serialized_json_bytes` helper that streams JSON into a byte counter.
- Use it for response-item size estimates and executed-tool-call argument limits.
- Preserve serialization errors so callers can apply their existing fallback behavior.

## Testing

- Cover response-item sizing with escaped characters, newlines, and multibyte text.

GitOrigin-RevId: a4417996df96df5c51cae62830adc496912f69c7
2026-08-25 13:10:24 +00:00
..