-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Bug]: Reasoning model thinking blocks (<thinking> tags) in conversation history cause HTTP 400 on GitHub Copilot provider #81520
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingbug:crashProcess/app exits unexpectedly or hangsProcess/app exits unexpectedly or hangsclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingbug:crashProcess/app exits unexpectedly or hangsProcess/app exits unexpectedly or hangsclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Bug type
Crash (process/app exits or hangs)
Beta release blocker
No
Summary
When a reasoning model generates blocks, they get stored in conversation history and sent back to GitHub Copilot on the next turn, which rejects them with HTTP 400 — breaking every multi-turn conversation.
Steps to reproduce
First message works fine every time. It breaks on the second, without exception.
Expected behavior
Thinking blocks are internal model state — they should never appear in the history sent to the API. The context sanitization pipeline should strip them before any request goes out.
Actual behavior
HTTP 400 from the GitHub Copilot API on every second turn of any conversation with a reasoning model. The request payload shows the assistant message from turn 1 with a content array that includes {type: "thinking", thinking: "..."} — Copilot rejects this. Single-turn conversations are completely unaffected.
OpenClaw version
OpenClaw version: v2026.5.7
Operating system
Kali Linux
Install method
npm global (npm install -g openclaw)
Model
claude-sonnet-4.6 (also confirmed with claude-opus-4)
Provider / routing chain
OpenClaw → GitHub Copilot provider → Claude Sonnet 4.6
Additional provider/model setup details
No response
Logs, screenshots, and evidence
Impact and severity
Additional information
The fix is in dist/model-context-tokens*.js, in the sanitizedWithProvider function before the final return. Filter out any assistant message content blocks with type === "thinking" or type === "redacted_thinking":
content = content.filter(b => b.type !== 'thinking' && b.type !== 'redacted_thinking')
One line, applied in the right place — fully resolves the issue in production.