openclaw - 💡(How to fix) Fix GPT-5.4 Responses API: encrypted_content item_id mismatch after model switch or compaction [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#70654Fetched 2026-04-24 05:55:08
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Error Message

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. 4. Send any message → 400 error error=LLM request failed: provider rejected the request schema or tool payload.

  • #1540 - OpenAI reasoning block causes 400 error after model switch from Anthropic

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.

Fix Action

Workaround

Send /clear before switching to GPT-5.4 to reset the session history.

Code Example

400 The encrypted content for item rs_XXXX could not be verified.
Reason: Encrypted content item_id did not match the target item id.

---

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
RAW_BUFFERClick to expand / collapse

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

  1. Start a session on claude-opus-4.6 with thinking enabled
  2. Have a multi-turn conversation (long enough to trigger compaction)
  3. Switch to gpt-5.4 via /gpt or /model gpt
  4. Send any message → 400 error
  5. 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

  • #45558 - Compaction fails with thinking/redacted_thinking blocks (Anthropic)
  • #21782 - Azure OpenAI Responses API: Item with id rs_... not found when store is false
  • #1540 - OpenAI reasoning block causes 400 error after model switch from Anthropic

extent analysis

TL;DR

Send /clear before switching to GPT-5.4 to reset the session history and avoid the 400 error caused by stale encrypted content item IDs.

Guidance

  • When switching between model families (e.g., Claude to GPT), consider resetting the conversation history to prevent encrypted content item ID mismatches.
  • Verify that the issue is resolved by checking the Gateway Logs for the absence of the "400 The encrypted content for item rs_XXXX could not be verified" error after sending /clear and switching to GPT-5.4.
  • To mitigate the issue, ensure that the downgradeOpenAIReasoningBlocks and downgradeOpenAIFunctionCallReasoningPairs functions are updated to handle cases where encrypted content item IDs are invalidated by compaction or model switching.
  • Test the workaround in different scenarios, such as switching between models with and without compaction, to ensure its effectiveness.

Example

No code snippet is provided as the issue is related to the interaction between models and APIs, and the solution involves sending a specific command (/clear) to reset the session history.

Notes

The provided workaround may not be a permanent solution, and further updates to the downgradeOpenAIReasoningBlocks and downgradeOpenAIFunctionCallReasoningPairs functions may be necessary to fully resolve the issue. Additionally, this workaround may have implications for conversation history and context, which should be considered when implementing the solution.

Recommendation

Apply the workaround by sending /clear before switching to GPT-5.4, as it provides a temporary solution to the issue and allows for continued use of the model while a more permanent fix is developed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING