openclaw - 💡(How to fix) Fix OpenAI Responses 400 'message' missing required 'reasoning' item on cross-provider failover from Gemini [1 comments, 2 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#80452Fetched 2026-05-11 03:14:28
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
2
Timeline (top)
commented ×1

When OpenClaw's failover ladder routes a conversation that originated on a Gemini reasoning model into openai/gpt-5.4 (or other OpenAI Responses reasoning model), every attempt fails with:

400 Item 'msg_007a7ea07cbd38270069f3e02378448196b5d1d1af3815dfb9' of type 'message'
was provided without its required 'reasoning' item:
'rs_007a7ea07cbd38270069f3e021f60c8196884f5632b96248e3'.

The fallback safety net silently does not catch — every Gemini → OpenAI cross-provider replay in the affected conversation cascades to "all models failed."

This is structurally adjacent to #1126 (closed COMPLETED 2026-01-28), which fixed the inverse direction: Item 'rs_…' of type 'reasoning' was provided without its required following item. The fix from #1126 evidently doesn't cover the path where a message item references a reasoning parent that was never propagated. Either the existing fix has a gap, or this is a regression introduced by a later cross-provider replay change.

Error Message

The (format) classification means the failover policy treats this as a transient format error and attempts the next sibling, but the next sibling on the chain is also a Gemini model and hits the same upstream condition. The OpenAI fallback, which should be the safety net, never recovers the conversation.

  • Surface a typed error earlier so the failover policy can short-circuit without retrying siblings that share the same upstream conversation.

Root Cause

When OpenClaw's failover ladder routes a conversation that originated on a Gemini reasoning model into openai/gpt-5.4 (or other OpenAI Responses reasoning model), every attempt fails with:

400 Item 'msg_007a7ea07cbd38270069f3e02378448196b5d1d1af3815dfb9' of type 'message'
was provided without its required 'reasoning' item:
'rs_007a7ea07cbd38270069f3e021f60c8196884f5632b96248e3'.

The fallback safety net silently does not catch — every Gemini → OpenAI cross-provider replay in the affected conversation cascades to "all models failed."

This is structurally adjacent to #1126 (closed COMPLETED 2026-01-28), which fixed the inverse direction: Item 'rs_…' of type 'reasoning' was provided without its required following item. The fix from #1126 evidently doesn't cover the path where a message item references a reasoning parent that was never propagated. Either the existing fix has a gap, or this is a regression introduced by a later cross-provider replay change.

Code Example

400 Item 'msg_007a7ea07cbd38270069f3e02378448196b5d1d1af3815dfb9' of type 'message'
was provided without its required 'reasoning' item:
'rs_007a7ea07cbd38270069f3e021f60c8196884f5632b96248e3'.

---

model_stack:
     - google/gemini-3.1-pro-preview
     - openai/gpt-5.4
     - google/gemini-2.5-flash

---

openai/gpt-5.4: 400 Item 'msg_<sanitized>' of type 'message' was provided without its
required 'reasoning' item: 'rs_<sanitized>'. (format)
RAW_BUFFERClick to expand / collapse

Summary

When OpenClaw's failover ladder routes a conversation that originated on a Gemini reasoning model into openai/gpt-5.4 (or other OpenAI Responses reasoning model), every attempt fails with:

400 Item 'msg_007a7ea07cbd38270069f3e02378448196b5d1d1af3815dfb9' of type 'message'
was provided without its required 'reasoning' item:
'rs_007a7ea07cbd38270069f3e021f60c8196884f5632b96248e3'.

The fallback safety net silently does not catch — every Gemini → OpenAI cross-provider replay in the affected conversation cascades to "all models failed."

This is structurally adjacent to #1126 (closed COMPLETED 2026-01-28), which fixed the inverse direction: Item 'rs_…' of type 'reasoning' was provided without its required following item. The fix from #1126 evidently doesn't cover the path where a message item references a reasoning parent that was never propagated. Either the existing fix has a gap, or this is a regression introduced by a later cross-provider replay change.

Build under test

OpenClaw 2026.5.3 (06d46f7) (the version that produced the captured journal lines below).

The maintainer is asked to confirm reproducibility on current main, since 2026-05-07 includes the closure of #77566 (Gemini cross-provider replay — opposite direction) and prior fixes #76832 (Codex Responses replay state, merged 2026-05-04) and #71684 (Copilot Codex reasoning IDs, merged 2026-04-25). None of those fixes obviously target the messagereasoning direction documented here, but I haven't built main to verify.

Reproduction

  1. Configure a failover chain that includes a Gemini reasoning model first and an OpenAI Responses reasoning model second:
    model_stack:
      - google/gemini-3.1-pro-preview
      - openai/gpt-5.4
      - google/gemini-2.5-flash
  2. Run conversation turns on the Gemini model that produce reasoning blocks (any nontrivial agent task).
  3. Force a failover from Gemini (e.g., simulate a 429 from Gemini, or rely on a real billing-cap event).
  4. Observe each openai/gpt-5.4 failover attempt's response.

Observed

Excerpt from Embedded agent failed before reply: All models failed (4) lines, repeated across many runs in the affected window:

openai/gpt-5.4: 400 Item 'msg_<sanitized>' of type 'message' was provided without its
required 'reasoning' item: 'rs_<sanitized>'. (format)

The (format) classification means the failover policy treats this as a transient format error and attempts the next sibling, but the next sibling on the chain is also a Gemini model and hits the same upstream condition. The OpenAI fallback, which should be the safety net, never recovers the conversation.

Expected

When forwarding a conversation to an OpenAI Responses reasoning model, the OpenAI provider should propagate both the message item and its referenced reasoning item, preserving the parent-child invariant that OpenAI's API enforces.

If the conversation history was authored by a Gemini model and the reasoning item is not available in the persisted form expected by OpenAI, the OpenAI provider should either:

  • Synthesize a placeholder reasoning item matching OpenAI's schema (analogous to Gemini's "skip_thought_signature_validator" fallback approach for the inverse direction), OR
  • Strip the message's reasoning reference before sending, accepting some loss of context, OR
  • Surface a typed error earlier so the failover policy can short-circuit without retrying siblings that share the same upstream conversation.

Why filing

The Gemini → OpenAI fallback is the documented safety net for users who configure OpenAI as a failover for Gemini billing/quota. With this bug, the safety net silently does not catch, leading to "all models failed" results that surprise users who assumed configured fallbacks would work.

In one captured 7-day window of a real OpenClaw deployment, this bug defeated the OpenAI fallback for every Gemini → OpenAI failover attempt during a billing-cap cascade — contributing to a multi-hour cascade-failure pattern. (Same source incident motivates a separate sibling-billing-account failover bug; the two together compound.)

Related

  • #1126 — OpenAI Responses reasoning item replay 400 (inverse direction). Closed COMPLETED 2026-01-28. The fix from #1126 doesn't cover the direction documented here.
  • #76832fix(openai-codex): avoid stale Responses replay state. Merged 2026-05-04. Different surface (Codex-specific).
  • #71684fix(github-copilot): preserve reasoning IDs for Copilot Codex models. Merged 2026-04-25. Different surface (Copilot Codex).
  • #77566 — Gemini 3.x silent hang, thoughtSignature dropped on cross-provider replay. Closed COMPLETED 2026-05-07. Inverse direction (Gemini receiving from another provider).

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

openclaw - 💡(How to fix) Fix OpenAI Responses 400 'message' missing required 'reasoning' item on cross-provider failover from Gemini [1 comments, 2 participants]