Closed
Description
The iterator returned by SendMessageStream
doesn't respect a false
return value from the callback function, leading to a panic if the callback breaks the loop.
Line 151 in ebca052
Environment details
- Programming language: Go
- OS: Linux
- Language runtime version: 1.24.3
- Package version: v1.4.0
Steps to reproduce
for res, err := range chat.SendMessageStream(ctx, parts...) {
break
}
panic: runtime error: range function continued iteration after function for loop body returned false
goroutine 2932889 [running]:
github.com/dagger/dagger/core.(*GenaiClient).SendQuery.(*GenaiClient).processStreamResponse-range1(0xc06dbc7808?, {0x37a0160?, 0xc0add48850?})
/app/core/llm_google.go:138 +0xa71
google.golang.org/genai.(*Chat).SendMessageStream.func1-range1(0x0, {0x37a0160?, 0xc0add48850?})
/go/pkg/mod/google.golang.org/[email protected]/chats.go:135 +0x1ab