Bug Description
When switching to GPT-5.4 (Responses API) mid-session after using a Claude model, the API rejects requests with:
400 The encrypted content for item rs_XXXX could not be verified.
Reason: Encrypted content item_id did not match the target item id.
This happens consistently and the session becomes stuck in an error loop - every subsequent GPT-5.4 request fails with the same error until the session is cleared.
Root Cause
GPT-5.4 uses the Responses API with reasoning.encrypted_content. When conversation history contains compacted/restructured content from a prior model (e.g. Claude), the encrypted reasoning item references become stale. The Responses API validates that encrypted_content item IDs match their target items, and compaction or cross-model history restructuring breaks this invariant.
The existing downgradeOpenAIReasoningBlocks and downgradeOpenAIFunctionCallReasoningPairs functions handle some orphaned reasoning scenarios, but do not cover the case where encrypted content item IDs are invalidated by compaction or model switching.
Reproduction
- Start a session on
claude-opus-4.6 with thinking enabled
- Have a multi-turn conversation (long enough to trigger compaction)
- Switch to
gpt-5.4 via /gpt or /model gpt
- Send any message → 400 error
- Every subsequent GPT-5.4 message in this session also fails
Expected Behavior
OpenClaw should strip encrypted_content reasoning items from conversation history when:
- Switching between model families (Claude ↔ GPT)
- After compaction restructures the conversation history
- When the target model uses a different API format (chat/completions vs Responses API)
Workaround
Send /clear before switching to GPT-5.4 to reset the session history.
Environment
- OpenClaw: 2026.4.21
- Provider: github-copilot (enterprise)
- Source model: claude-opus-4.6 (thinking: high)
- Target model: gpt-5.4 (Responses API, xhigh)
- Compaction: triggered before model switch
Gateway Logs
embedded run agent end: isError=true model=gpt-5.4 provider=github-copilot
error=LLM request failed: provider rejected the request schema or tool payload.
rawError=400 The encrypted content for item rs_933f7a8c9f6dc069 could not be verified.
Reason: Encrypted content item_id did not match the target item id.
embedded run failover decision: stage=assistant decision=surface_error reason=format
from=github-copilot/gpt-5.4
Related Issues
Bug Description
When switching to GPT-5.4 (Responses API) mid-session after using a Claude model, the API rejects requests with:
This happens consistently and the session becomes stuck in an error loop - every subsequent GPT-5.4 request fails with the same error until the session is cleared.
Root Cause
GPT-5.4 uses the Responses API with
reasoning.encrypted_content. When conversation history contains compacted/restructured content from a prior model (e.g. Claude), the encrypted reasoning item references become stale. The Responses API validates thatencrypted_contentitem IDs match their target items, and compaction or cross-model history restructuring breaks this invariant.The existing
downgradeOpenAIReasoningBlocksanddowngradeOpenAIFunctionCallReasoningPairsfunctions handle some orphaned reasoning scenarios, but do not cover the case where encrypted content item IDs are invalidated by compaction or model switching.Reproduction
claude-opus-4.6with thinking enabledgpt-5.4via/gptor/model gptExpected Behavior
OpenClaw should strip
encrypted_contentreasoning items from conversation history when:Workaround
Send
/clearbefore switching to GPT-5.4 to reset the session history.Environment
Gateway Logs
Related Issues