Skip to content

[BUG] OpenAI Responses 400: unpaired reasoning item_reference persists on @voltagent/core@2.3.3 #1019

Description

@chrisisagile

Describe the bug
A clear and concise description of what the bug is.

We still get missing/unpaired reasoning items in the OpenAI Responses input. The request includes an item_reference to a reasoning item without its required following item, which causes a 400 invalid_request_error and the stream fails. This happens even after the fixes in PRs #1011, #1014, #1016, and #1017.

Please provide the context in which the problem occur.

Local Cognos dev (WSL2). Memory enabled. Streaming via OpenAI Responses API with model gpt-5-mini. Observed after a normal user turn followed by a second user turn.

Steps To Reproduce
Steps to reproduce the behavior

  1. Run local Cognos with @voltagent/core@2.3.3 (OpenAI Responses API, streaming).
  2. Start a new conversation and send a short message (e.g., “hello”).
  3. Send a second request that triggers a follow-up action (e.g., summarize a document).
  4. Observe the stream failing with OpenAI Responses 400 and an error about an unpaired reasoning item.

Expected behavior
A clear and concise description of what you expected to happen.

The streaming request should succeed, and any reasoning item references should be paired correctly (or omitted) so the Responses API accepts the input.

Packages
Mention the Refine packages you are using and their versions.

  • @voltagent/core 2.3.3
  • @voltagent/server-hono 2.0.4
  • @voltagent/postgres 2.1.0
  • @voltagent/libsql 2.0.3
  • @voltagent/resumable-streams 2.0.1
  • @voltagent/voltagent-memory 1.0.3
  • @voltagent/logger 2.0.2
  • @voltagent/cli 0.1.21

Additional Context
Add any other context about the problem here.

Still occurs after PRs #1011, #1014, #1016, and #1017 (core 2.3.2/2.3.3 releases).

Redacted log excerpt:

  • Error:
    "Item 'rs_' of type 'reasoning' was provided without its required following item."

  • Request input (trimmed):
    [
    { role: "developer", content: "" },
    { role: "user", content: "hello" },
    { type: "item_reference", id: "rs_" },
    { type: "item_reference", id: "msg_" },
    { role: "user", content: "summarize <InternalLink ... />" }
    ]

Suspected cause (based on code review, not confirmed):

  • Reasoning parts are preserved even if the text is empty whenever provider metadata exists, which can keep a reasoning itemId in history without actual reasoning content.
  • Tool-part pruning removes incomplete tool calls but does not remove associated reasoning parts, which could leave an orphaned reasoning item_reference in the next request.
  • ConversationBuffer merges assistant parts by reasoning signature (including OpenAI itemId), which might collapse or retain reasoning metadata even when the paired message part is missing.

Activity

  1. chrisisagile commented on Feb 4, 2026

    @chrisisagile
    SponsorContributorAuthor

    I'm looking at it now to see if I can identify what might be left.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions