You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Go ADK OpenAI adapter sends prior assistant text turns as user messages in multi-turn history #3367
In the Go ADK OpenAI adapter (go/adk/pkg/models/openai_adk.go), genaiContentsToOpenAIMessages only turns a model turn into an assistant message when it has function calls. A model turn with plain text falls into the else branch, which always builds a user message. So in a multi-turn chat, the model's own earlier replies get sent back to the provider as if the user said them.
This affects the Chat Completions format, which is the default for the OpenAI provider and is also used by Azure OpenAI. The Python runtime's OpenAI adapter already sends these as assistant. The Anthropic adapter had the same problem in #3026.
Steps To Reproduce
I pointed an OpenAIModel at a local test server, sent a user/model/user history through GenerateContent, and logged the request body.
Request sent today:
user -> What is 2+2?
user -> 4
user -> And times 3?
Expected Behavior
user -> What is 2+2?
assistant -> 4
user -> And times 3?
Additional Context
Checked on main at 4f373d1. The line has been like this since the file was added in #1284. I have a small fix with a unit test ready and will open a PR.
Seeing this on v1.0.0-rc3 too, end to end, with an OpenAI-compatible stub that logs each request: turn 2 of a Session arrives as [system, user, user, user] with the agent's first reply as the middle user message, and turn 3 as [system, user×5], streamed or not. Mistral and the Foundry OpenAI path go through the same function, so #3368 covers those too, and #3289 is the same fix for Anthropic. Would be great to get both reviewed.
Activity
mandipadk commentedon Oct 26, 2026
/assign
AlbertDoesProgramming commentedon Nov 9, 2026
Seeing this on v1.0.0-rc3 too, end to end, with an OpenAI-compatible stub that logs each request: turn 2 of a Session arrives as
[system, user, user, user]with the agent's first reply as the middleusermessage, and turn 3 as[system, user×5], streamed or not. Mistral and the Foundry OpenAI path go through the same function, so #3368 covers those too, and #3289 is the same fix for Anthropic. Would be great to get both reviewed.