Tighten image_generation defaults and refuse streaming requests
Code review surfaced four real problems with the new image_gen path: * Default `enable_image_gen` was True, which silently injected the image_generation tool into every chat completion. That let the model choose to draw a picture for prompts that never asked for one — 25s extra latency and subscription quota burn for what should have been plain text. Default is now False; opt in with CODEX_ENABLE_IMAGE_GEN=1. * The streaming chat_completions consumer only handles response.output_text events. With image_gen enabled and stream=true, the model emits image_generation_call events the streaming loop drops on the floor — the client gets an empty stream. Refuse the combination at the entry point with HTTP 400 + a clear error message. * `revised_prompt` from the model was used as markdown alt text without escaping. A `]` or `)` in there would break the `` syntax and let the base64 payload leak out as visible text. Escape `[]()\` and clamp alt to 200 chars. * `_truncate_for_log` now replaces `data:image/...;base64,...` URIs with a short `<image/png NNN B base64 omitted>` placeholder before length truncation. Without that, every full/qa-mode response log starts with 3.9KB of useless base64 prefix and the actual text gets clipped.
L
leeguooooo committed
ee52daeeaf731a26af843dfaebc5541706fa8c8b
Parent: e418700