Skip to content

Responses multi-turn fails on strict gateways: replayed reasoning items drop provider id (input.N.id: expected a value) #48441

Closed as not planned

Description

@chaos-318

Description

Fresh session, first turn works (reasoning summary streams back); any second turn fails with 400 — but only against Responses gateways that strictly validate input items. Same two turns succeed against lenient upstreams.

Root cause (verified below): on turn 2, opencode replays the previous turn's typed items (type: reasoning / type: message) without the provider-side ids (rs_* / msg_*). Gateways requiring id on typed items reject the request:

Opencode failed to send message with error: Invalid value for 'input.2.id': expected a value.

Minimal repros against the gateway (POST /v1/responses, stream: true):

# reasoning item WITHOUT id -> 400, same error template as the client
{"input":[
  {"role":"user","content":"hi"},
  {"type":"reasoning","summary":[{"type":"summary_text","text":"..."}]},
  {"type":"message","id":"msg_real123","role":"assistant","status":"completed",
   "content":[{"type":"output_text","text":"hi!"}]},
  {"role":"user","content":"what can you do?"}]}
# -> {"param":"input.1.id","message":"Invalid value for 'input.1.id': expected a value."}

# message item WITHOUT id -> 400 as well
{"input":[
  {"role":"user","content":"hi"},
  {"type":"message","role":"assistant","status":"completed",
   "content":[{"type":"output_text","text":"hi!"}]},
  {"role":"user","content":"why?"}]}
# -> {"message":"Invalid value for 'input.1': Responses output message status requires an item id."}

Control cases (all 200): role-based messages, typed items with id, function_call_output replays.

Related but distinct from #5104: in Dec 2025 (v1.0.133) the replay carried id + encrypted_content and died on crypto verification; now it carries no id and dies on id validation. Lenient upstreams accept the id-less replay, which is likely why this went unnoticed.

Possible fixes (maintainer's call): preserve provider item ids when round-tripping typed items, skip replaying id-less/empty reasoning items, or put it behind an option.

Provider/model config (keys redacted; same failure via two different baseURLs with identical model options, so it's not gateway-specific):

"experientiallabs": {
  "npm": "@ai-sdk/openai",
  "name": "ExperientialLabs Direct",
  "options": {
    "baseURL": "https://api.experientiallabs.ai/v1",
    "apiKey": "<redacted>"
  },
  "models": {
    "gpt-5.6-luna": {
      "name": "GPT-5.6 Luna",
      "modalities": { "input": ["text", "image"], "output": ["text"] },
      "options": {
        "reasoningEffort": "max",
        "reasoningSummary": "detailed",
        "include": ["reasoning.encrypted_content"],
        "maxTokens": 32000
      },
      "variants": {
        "max": { "reasoningEffort": "max", "reasoningSummary": "detailed", "include": ["reasoning.encrypted_content"] },
        "xhigh": { "reasoningEffort": "xhigh", "reasoningSummary": "detailed", "include": ["reasoning.encrypted_content"] },
        "high": { "reasoningEffort": "high", "reasoningSummary": "detailed", "include": ["reasoning.encrypted_content"] },
        "medium": { "reasoningEffort": "medium", "reasoningSummary": "detailed", "include": ["reasoning.encrypted_content"] },
        "low": { "reasoningEffort": "low", "reasoningSummary": "detailed", "include": ["reasoning.encrypted_content"] }
      },
      "limit": { "context": 256000, "input": 224000, "output": 32000 }
    }
  }
}

Plugins

opencode-mem

OpenCode version

1.18.30 (running inside OpenChamber)

Steps to reproduce

  1. Point @ai-sdk/openai at any strict Responses gateway (reasoningSummary: detailed so turn 1 yields a reasoning item).
  2. New session, send hi → works.
  3. Send a second message → Invalid value for 'input.2.id': expected a value. (see screenshot).
  4. Same two turns against a lenient upstream → both succeed.

Screenshot and/or share link

Screenshot attached below (turn 1 streams reasoning summary + answer; turn 2 errors; bottom bar shows the direct-gateway model in use).

Operating System

Windows 11 (WSL backend)

Terminal

OpenChamber desktop v1.22.2 (hosting opencode web UI)

Activity

  1. chaos-318 commented on Sep 11, 2026

    @chaos-318
    Author

    Here is the screenshot

    Image
  2. github-actions commented on Sep 11, 2026

    @github-actions
    Contributor

    This issue might be related to existing issues tracking reasoning item replay problems. Please check:

    These are distinct root causes but may share a fix area in the reasoning-item serialization/replay path.

  3. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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

Metadata

Metadata

Assignees

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