Repository navigation
Conversation
Author
|
Hi @supreme-gg-gg @dimetron, could you take a look at this PR when you get a chance? The CI workflows are also waiting for maintainer approval to run. Thanks! |
|
This pull request has been marked as stale because of no activity in the last 15 days. It will be closed in the next 5 days unless it is tagged "no stalebot" or other activity occurs. |
The plain-text branch of genaiContentsToAnthropicMessages hardcoded the user role, so a prior assistant text turn in multi-turn history was replayed to the provider as a user turn. Use the incoming role the same way the tool-call branch already does. Fixes kagent-dev#3026 Signed-off-by: hairuiyang <hairuiyang@deeproute.ai>
halcyon-r
force-pushed
the
fix/anthropic-assistant-text-role
branch
from
November 10, 2026 11:59
888c0e2 to
3179a74
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3026
genaiContentsToAnthropicMessagescomputed the incoming role once but only used iton the tool-call branch; the plain-text branch hardcoded
anthropic.MessageParamRoleUser, so a prior assistant text turn in multi-turnhistory was replayed to the provider labelled as the user.
Since the Messages API merges consecutive same-role messages into a single turn,
affected sessions don't error out — the model just sees its own earlier replies as
user speech, which silently degrades multi-turn response quality.
branch mapping (
model/assistant→ assistant role; anything else keeps theuserdefault).TestGenaiContentsToAnthropicMessagesKeepsAssistantTextRolecovering auser/model/user/assistant plain-text history — the reproduction case from [BUG] Go ADK Anthropic adapter labels a prior assistant text turn as "user" in multi-turn history #3026,
including the
assistantrole spelling alongsidemodel.Testing:
go test ./pkg/models/...ingo/adk(all pass) andgo vetclean.