MCPcopy Index your code
hub / github.com/docker/docker-agent / TestEmptyTurnEmitsWarning

Function TestEmptyTurnEmitsWarning

pkg/runtime/runtime_test.go:4212–4229  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
4212func 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

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
WithUserMessageFunction · 0.92
newStreamBuilderFunction · 0.85
runSessionFunction · 0.85
AddStopWithUsageMethod · 0.80
BuildMethod · 0.45

Tested by

no test coverage detected