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 }}
This repository was archived by the owner on May 15, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on May 15, 2026. It is now read-only.
[BUG] xAI Responses API path replays persisted Anthropic thinking blocks as plain assistant text #12128
When a persisted conversation contains Anthropic thinking blocks and that history is replayed through the xAI Responses API path, Roo converts the hidden reasoning into ordinary assistant text ([Thinking] ...) instead of preserving or safely dropping it.
Context (who is affected and when)
This affects users who switch providers or resume existing conversations where earlier turns were produced by an Anthropic reasoning model and later turns are sent through the xAI provider.
Persisted Anthropic thinking blocks should either:
be dropped for the xAI Responses replay path, or
be preserved only in a provider-safe/native hidden reasoning format.
They should not be flattened into normal assistant-visible text.
Actual result
thinking is converted into a normal assistant output_text entry prefixed with [Thinking], which changes the semantics of the conversation history and can leak previously hidden reasoning into later prompt context.
Variations tried (optional)
Related local source inspection on current main:
src/core/task/Task.ts:904-924 persists Anthropic reasoning as type: "thinking"
src/api/providers/xai.ts:93-104 routes xAI history through convertToResponsesApiInput(messages)
src/api/transform/responses-api-input.ts:55-63 converts thinking into [Thinking] ... text
App Version
main (cb83656718)
API Provider (optional)
xAI
Model Used (optional)
Grok / xAI Responses path
Roo Code Task Links (optional)
No response
Relevant logs or errors (optional)
This seems best categorized as a provider interoperability / reasoning round-trip bug rather than a general crash. The regression appears adjacent to the xAI Responses migration in #11961 / #11962, but I could not find an existing issue that tracks this exact replay behavior.
I did not open a PR for this yet because the fix direction seems policy-sensitive: I can see at least two plausible behaviors (drop unsupported hidden reasoning for xAI replay, or preserve it in a provider-specific hidden format if available). Once maintainers confirm the preferred fallback, I can follow up with a narrow patch and regression test.
Claiming. I prepared a minimal follow-up patch that keeps the scope narrow: it stops convertToResponsesApiInput() from flattening persisted Anthropic thinking blocks into assistant-visible text and adds a regression test for the replay behavior.
Activity
shaun0927 commentedon Apr 16, 2026
I did not open a PR for this yet because the fix direction seems policy-sensitive: I can see at least two plausible behaviors (drop unsupported hidden reasoning for xAI replay, or preserve it in a provider-specific hidden format if available). Once maintainers confirm the preferred fallback, I can follow up with a narrow patch and regression test.
shaun0927 commentedon Apr 16, 2026
Claiming. I prepared a minimal follow-up patch that keeps the scope narrow: it stops
convertToResponsesApiInput()from flattening persisted Anthropicthinkingblocks into assistant-visible text and adds a regression test for the replay behavior.shaun0927 commentedon Apr 16, 2026
Follow-up PR opened: #12131