TestEmptyTurnEmitsWarning verifies that a wholly empty turn (no content, no reasoning, no tool calls) - e.g. a rate-limited or token-capped provider that returns a bare [DONE] stream, the dominant cause of empty replies on OVHcloud's free tier in #3145 - is surfaced as a Warning instead of terminati
(t *testing.T)
| 4210 | // returns a bare [DONE] stream, the dominant cause of empty replies on OVHcloud's |
| 4211 | // free tier in #3145 - is surfaced as a Warning instead of terminating silently. |
| 4212 | func TestEmptyTurnEmitsWarning(t *testing.T) { |
| 4213 | stream := newStreamBuilder(). |
| 4214 | AddStopWithUsage(5, 0). |
| 4215 | Build() |
| 4216 | |
| 4217 | sess := session.New(session.WithUserMessage("hello")) |
| 4218 | events := runSession(t, sess, stream) |
| 4219 | |
| 4220 | var warn *WarningEvent |
| 4221 | for _, ev := range events { |
| 4222 | if w, ok := ev.(*WarningEvent); ok { |
| 4223 | warn = w |
| 4224 | } |
| 4225 | } |
| 4226 | |
| 4227 | require.NotNil(t, warn, "expected a Warning event for an empty turn") |
| 4228 | assert.Contains(t, warn.Message, "empty response") |
| 4229 | } |
| 4230 | |
| 4231 | // TestEmptyTrailingTurnAfterToolCallsIsSilent verifies that a natural empty |
| 4232 | // stop immediately following a tool-call turn does NOT emit the empty-response |
nothing calls this directly
no test coverage detected