mirror of
https://github.com/openai/codex.git
synced 2026-11-20 22:40:37 +00:00
## Why Tool schema budget checks cloned the schema and allocated a JSON buffer just to measure its size. Building a Responses Lite catalog also cloned tool definitions before serializing them. ## What changed - Deserialize schemas from borrowed JSON during compaction, count serialized bytes without allocating a buffer, and reuse the parsed schema when it fits the budget. - Serialize borrowed tool specs and namespace members directly, and pass filtered specs as an iterator. Preserve the serialized namespace field order because the bytes contribute to the `additional_tools` item ID. ## Testing - Compare the exact serialized Responses Lite catalog against the expected namespace layout. - Add a `tool_catalog` benchmark for connector schema preparation and Responses Lite catalog encoding with 1 and 64 tool specs. GitOrigin-RevId: 6bd03a12fcedd4abfa8c3a03f298243483e98c63