mirror of
https://github.com/openai/codex.git
synced 2026-09-13 11:47:17 +00:00
## Why Structured output can be complete before the Responses stream emits its terminal events. Waiting for those events unnecessarily delays the sampler and can leave it waiting after usable output has arrived. ## What changed - Return a Luna sample as soon as accumulated text deltas parse as a complete JSON object. - Continue draining the remaining response events in the background so the authenticated WebSocket stays reusable for subsequent samples. - Enforce the output-size limit while accumulating deltas on the early-return path. ## Testing - Cover returning complete JSON without terminal response events. - Verify that early return still allows the authenticated WebSocket to be reused. GitOrigin-RevId: 80c9963f1540f7862356aaad3503e3071a8fb92a