Commit df56905
fix(openai): raise on empty chat completion instead of clean end_turn
The Chat Completions path guarded an empty `choices` array but not an
empty message: a choice whose `message.content` is None/empty with no
`tool_calls` returned a clean `end_turn` carrying no content. For a
security tool an empty end_turn reads as a passing verdict, so a blank
completion became a silent false-negative.
Add the no-usable-content guard the three sibling paths already have --
the Responses path, the Anthropic adapter, and the Gemini adapter all
raise `LLMResponseError` on empty content. A tool-use-only response stays
valid (content_blocks is non-empty); refusal/content_filter still raises
first as the more specific signal.
Regression test: a choice with content=None and no tool_calls now raises
`LLMResponseError` (was a clean end_turn).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent fad4b01 commit df56905
2 files changed
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
175 | 192 | | |
176 | 193 | | |
177 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
797 | 797 | | |
798 | 798 | | |
799 | 799 | | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
800 | 814 | | |
801 | 815 | | |
802 | 816 | | |
| |||
0 commit comments