Repository navigation
Conversation
Grok on Bedrock returns reasoningContent with its tool calls but rejects it when
replayed on the next step ("This model doesn't support the
reasoningContent.reasoningText.text field for assistant messages"), so every tool
loop failed. Treat xAI like OpenAI in replaysBedrockReasoning(), and use that in
convertToConverseMessages() and the non-streaming converter choice.
Fixes LibreChat-AI#728
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016zWwhp1WwhMm7guDzQPSEc
danny-avila
pushed a commit
that referenced
this pull request
Nov 23, 2026
Grok 4.7 on Bedrock returns reasoningContent with its tool calls and rejects it when replayed, so every tool loop failed on its second request. Omit the replay on the streaming and non-streaming Converse paths, including named inference profiles and application profiles. Other families, Grok 4.6 and opaque resources keep the existing behavior. Design credit: umzcio (#729; reported #728). Co-authored-by: Lia <lia@librechat.ai>
This branch has not been deployed
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 #728.
Grok on Bedrock (
us.xai.grok-4.7) returns areasoningContentblock with its tool calls, then rejects that block when it is replayed on the next step:So every tool loop (web search, MCP, code) fails on its second request. The library already suppresses replay for OpenAI models on Bedrock; this adds xAI to that rule.
Changes
utils/message_inputs.ts: factor the ARN and inference-profile parsing out ofisBedrockOpenAIModelintobedrockModelId(), addisBedrockXAIModel(), and makereplaysBedrockReasoning()return false for OpenAI or xAI.convertToConverseMessages()now usesreplaysBedrockReasoning(). Harmony handling stays OpenAI-only.index.ts: the non-streaming path picks the local converter when!replaysBedrockReasoning(model), so xAI gets the same treatment there.reasoning-replay.test.ts: xAI cases for a cross-region profile ID, an inference-profile ARN, and an application inference profile.Testing
CustomChatBedrockConversefailed with the error above before the change and completed after it, including when Grok made parallel tool calls. Converter output for Claude, GPT and Mistral models was unchanged. It has also been running in a LibreChat v0.8.9 deployment, where Grok web search now completes.🤖 Generated with Claude Code
https://claude.ai/code/session_016zWwhp1WwhMm7guDzQPSEc