Commit 770b5db
committed
fix(openai): suppress native image_generation tool for Codex models
In ChatGPT mode, build_response_request unconditionally pushed
{ "type": "image_generation" } onto the request's tool array. The
OpenAI Responses API rejects that tool for codex-family models
(gpt-5.x-codex*, including the [1m] long-context suffix variants)
with HTTP 400 ("unsupported tool image_generation for model …"),
which aborted the entire session for ChatGPT-mode codex users.
Add Self::supports_native_image_generation(model_id) returning false
for any model id whose lower-cased / [1m]-stripped form contains
"codex". Gate the tools.push site by that helper. Non-codex ChatGPT
models (gpt-5.x non-codex, gpt-4o, etc.) still receive the tool.
Two regression tests in src/provider/openai_tests/payloads.rs:
- test_chatgpt_payload_includes_native_image_generation_for_non_codex_models
- test_chatgpt_payload_excludes_native_image_generation_for_codex_models
iterating gpt-5.3-codex, gpt-5.3-codex-spark, and gpt-5.3-codex-spark[1m].
Ports upstream PR 1jehuang#148.
Closes #1151 parent e1886bb commit 770b5db
2 files changed
Lines changed: 79 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
702 | 702 | | |
703 | 703 | | |
704 | 704 | | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
705 | 719 | | |
706 | 720 | | |
707 | 721 | | |
| |||
720 | 734 | | |
721 | 735 | | |
722 | 736 | | |
723 | | - | |
| 737 | + | |
724 | 738 | | |
725 | 739 | | |
726 | 740 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
20 | 84 | | |
21 | 85 | | |
22 | 86 | | |
| |||
0 commit comments