mirror of
https://github.com/openai/codex.git
synced 2026-10-18 17:18:52 +00:00
## Why Truncating the preview alone can leave the serialized MCP tool result above its byte budget because JSON escaping and the result wrapper add bytes. ## What changed Measure the complete serialized replacement and progressively reduce the preview budget until the result fits or the preview is empty. ## Testing Strengthen the regression test with quotes, backslashes, and newlines. Assert that the serialized result fits within the 1,024-byte budget and that truncating it again returns the existing result unchanged. GitOrigin-RevId: ebd97b1a6ca71343941a96e472cb313028ac680c