Skip to content

OpenAI Responses reasoning item replay causes 400 (missing following item) #1126

Description

@vishalsachdev

Summary

OpenAI Responses reasoning turns can error with:

400 Item 'rs_…' of type 'reasoning' was provided without its required following item.

This happens after enabling reasoning/thinking for openai/gpt-5.2 and then sending a normal message (or /status) in WhatsApp sessions. Clearing session history fixes it temporarily.

Environment

  • Clawdbot version: 2026.1.16-2 (Homebrew global install)
  • OS: macOS
  • Provider: OpenAI
  • Model: openai/gpt-5.2
  • API mode: openai-responses
  • Channel: WhatsApp

Config (sanitized)

{
  "models": {
    "providers": {
      "openai": {
        "baseUrl": "https://api.openai.com/v1",
        "api": "openai-responses",
        "models": [
          {
            "id": "gpt-5.2",
            "reasoning": true
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": { "primary": "openai/gpt-5.2" },
      "thinkingDefault": "off"
    }
  }
}

Repro steps

  1. Configure OpenAI provider as above (openai-responses, gpt-5.2, reasoning true).
  2. Start a WhatsApp session.
  3. Set thinking to high (e.g. clawdbot agent --to <number> --thinking high ...).
  4. Send a normal message (or /status).

Result

400 error from OpenAI Responses:

400 Item 'rs_…' of type 'reasoning' was provided without its required following item.

Expected

Normal response (or status reply) without an error.

Notes

  • Clearing session history (~/.clawdbot/agents/main/sessions/*.jsonl and sessions.json) and restarting gateway resolves it temporarily until reasoning is used again.
  • Error appears to be linked to replaying reasoning items in session history for tool-only / status-like turns.

Relevant log excerpts

From ~/.clawdbot/agents/main/sessions/<session>.jsonl (trimmed):

... "thinkingSignature":{"id":"rs_091acb...","type":"reasoning", ... }
... errorMessage:"400 Item 'rs_091acb...' of type 'reasoning' was provided without its required following item."

If you want, I can provide the full JSONL and gateway logs privately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions