opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Using `GPT 5.1 Codex` via OpenAI fails on the 2nd request

Open V4G4X opened this issue 1 month ago • 15 comments

Description

  ┃ # Summarizing provided text to summarize                                                                                                                                              14,515/4% ($0.02) ┃

  ┃
  ┃  Hi
  ┃  varungawande (12:46:42 PM)
  ┃

     Hello! How can I help today?

     Build gpt-5.1-codex

  ┃
  ┃  Hello
  ┃  varungawande (12:46:44 PM)
  ┃

  ┃
  ┃  Item with id 'rs_04819b77d3ae6f3101691c1d5bb4508190a6bff984579fc868' not found. Items are not persisted when `store` is set to false. Try again with `store` set to true, or remove this item from your
  ┃  input.
  ┃
Item with id 'rs_04819b77d3ae6f3101691c1d5bb4508190a6bff984579fc868' not found. Items are not persisted when `store` is set to false. Try again with `store` set to true, or remove this item from your input.

When I use this model via OpenRouter it works properly.

OpenCode version

1.0.72

Steps to reproduce

Using GPT-5.1 Codex via OpenAI

  1. Send "Hi" -> Works
  2. Send "Hello" next -> Fails

Note: My config has nothing related to this model:

{
  "$schema": "https://opencode.ai/config.json",
  "share": "disabled",
  "permission": {
    "bash": {
      "git commit": "ask",
      "git status*": "allow",
      "git log*": "allow",
      "git diff*": "allow",
      "git push": "deny",
      "git reset": "ask",
      "git rebase": "ask",
      "git merge": "ask",
      "git cherry-pick": "ask",
      "sudo": "ask",
      "rm": "ask",
      "mv": "ask",
      "chmod": "ask",
      "chown": "ask"
    }
  }

Screenshot and/or share link

Image

Operating System

Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:39 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T8103 arm64

Terminal

Ghostty 1.2.3

V4G4X avatar Nov 18 '25 07:11 V4G4X

Hm I can't replicate...

rekram1-node avatar Nov 18 '25 07:11 rekram1-node

Any particular logs I could fetch which will help?

V4G4X avatar Nov 18 '25 14:11 V4G4X

maybe try setting:

store: false

in your opencode config for the model

rekram1-node avatar Nov 18 '25 17:11 rekram1-node

Like this?

Didn't work:

  "provider": {
    "openai": {
      "models": {
        "gpt-5.1-codex": {
          "name": "GPT-5.1 Codex (high)",
          "options": {
            "reasoningEffort": "high",
            "store": false
          }
        }
      }
    }
    }
  }

Or if you meant this, that didn't work either:

        "gpt-5.1-codex": {
          "name": "GPT-5.1 Codex (high)",
          "options": {
            "reasoningEffort": "high"
          },
          "store": false
        },

V4G4X avatar Nov 20 '25 04:11 V4G4X

@V4G4X try this one: "gpt-5.1-codex": { "name": "GPT-5.1 Codex (high)", "options": { "include": ["reasoning.encrypted_content"], "store": false, }, },

rekram1-node avatar Nov 20 '25 04:11 rekram1-node

u can set reasoningEffort too but try these settings as a base

rekram1-node avatar Nov 20 '25 04:11 rekram1-node

I'm also running into this: "Item with id rs_* not found" I've tried the store false change and seeing it show up randomly still.

I'm trying this with azure/gpt-5.1-codex-max. Since the fix didn't work for me and it's impacted almost every session at some point, figured I'd make sure it was brought up again.

sheldonhull avatar Dec 17 '25 23:12 sheldonhull

@sheldonhull can u share a session by chance?

opencode export > session.json

rekram1-node avatar Dec 17 '25 23:12 rekram1-node

Hopefully this is enough, since otherwise it's a lot of stuff to obfuscate ...

log details
 {
      "info": {
        "id": "msg_b2e9f755d0017W7BiVIhsSw62C",
        "sessionID": "ses_4d1693c9bffeNyPRnoPsGaMcks",
        "role": "assistant",
        "time": {
          "created": 1766013760861,
          "completed": 1766013765998
        },
        "parentID": "msg_b2e96c3670015vDk5DIyVf3US9",
        "modelID": "gpt-5.1-codex-max",
        "providerID": "azure",
        "mode": "build",
        "path": {
          "cwd": "/Users/{PATH}daggerverse",
          "root": "/Users/{PATH}daggerverse"
        },
        "cost": 0.01465175,
        "tokens": {
          "input": 219,
          "output": 193,
          "reasoning": 128,
          "cache": {
            "read": 89344,
            "write": 0
          }
        },
        "finish": "tool-calls"
      },
      "parts": [
        {
          "id": "prt_b2e9f78f4001eZ6xqb510jYtSM",
          "sessionID": "ses_4d1693c9bffeNyPRnoPsGaMcks",
          "messageID": "msg_b2e9f755d0017W7BiVIhsSw62C",
          "type": "step-start",
          "snapshot": "ccde326bfdf64c680e2095f16e7447131bcefe1c"
        },
        {
          "id": "prt_b2e9f7eaf001FpKAFHxuVWOknu",
          "sessionID": "ses_4d1693c9bffeNyPRnoPsGaMcks",
          "messageID": "msg_b2e9f755d0017W7BiVIhsSw62C",
          "type": "reasoning",
          "text": "",
          "metadata": {
            "openai": {
              "itemId": "rs_0f6b4bc48d7a18620069433b433f1081968699460f3a33bde6",
              "reasoningEncryptedContent": null
            }
          },
          "time": {
            "start": 1766013763247,
            "end": 1766013764899
          }
        },
        {
          "id": "prt_b2e9f8524001wwVUiK6u7zkAPD",
          "sessionID": "ses_4d1693c9bffeNyPRnoPsGaMcks",
          "messageID": "msg_b2e9f755d0017W7BiVIhsSw62C",
          "type": "tool",
          "callID": "call_aZPOp47XEn1LhZRpgDeaQvda",
          "tool": "bash",
          "state": {
            "status": "completed",
            "input": {
              "command": "cd /Users/{PATH}daggerverse/pr-reviewer && gofmt -w main.go suggestion.go azdo.go",
              "description": "Formats updated Go files"
            },
            "output": "",
            "title": "Formats updated Go files",
            "metadata": {
              "output": "",
              "exit": 0,
              "description": "Formats updated Go files"
            },
            "time": {
              "start": 1766013765720,
              "end": 1766013765933
            }
          },
          "metadata": {
            "openai": {
              "itemId": "fc_0f6b4bc48d7a18620069433b44e0d8819690142f18bda9c485"
            }
          }
        },
        {
          "id": "prt_b2e9f89300019OV7BALuD2yoEK",
          "sessionID": "ses_4d1693c9bffeNyPRnoPsGaMcks",
          "messageID": "msg_b2e9f755d0017W7BiVIhsSw62C",
          "type": "step-finish",
          "reason": "tool-calls",
          "snapshot": "ccde326bfdf64c680e2095f16e7447131bcefe1c",
          "cost": 0.01465175,
          "tokens": {
            "input": 219,
            "output": 193,
            "reasoning": 128,
            "cache": {
              "read": 89344,
              "write": 0
            }
          }
        }
      ]
    },
    {
      "info": {
        "id": "msg_b2e9f8991001VU6D1XgdY8xVKs",
        "sessionID": "ses_4d1693c9bffeNyPRnoPsGaMcks",
        "role": "assistant",
        "time": {
          "created": 1766013766033,
          "completed": 1766013766804
        },
        "error": {
          "name": "APIError",
          "data": {
            "message": "Item with id 'rs_0f6b4bc48d7a18620069433b433f1081968699460f3a33bde6' not found.",
            "statusCode": 400,
            "isRetryable": false,
            "responseHeaders": {
              "apim-request-id": "{GUID}",
              "content-length": "194",
              "content-type": "application/json",
              "date": "Wed, 17 Dec 2025 23:22:46 GMT",
              "strict-transport-security": "max-age=31536000; includeSubDomains; preload",
              "x-content-type-options": "nosniff",
              "x-ms-region": "East US 2",
              "x-request-id": "{GUID}"
            },
            "responseBody": "{\n  \"error\": {\n    \"message\": \"Item with id 'rs_0f6b4bc48d7a18620069433b433f1081968699460f3a33bde6' not found.\",\n    \"type\": \"invalid_request_error\",\n    \"param\": \"input\",\n    \"code\": null\n  }\n}"
          }
        },
        "parentID": "msg_b2e96c3670015vDk5DIyVf3US9",
        "modelID": "gpt-5.1-codex-max",
        "providerID": "azure",
        "mode": "build",
        "path": {
          "cwd": "/Users/{PATH}daggerverse",
          "root": "/Users/{PATH}daggerverse"
        },
        "cost": 0,
        "tokens": {
          "input": 0,
          "output": 0,
          "reasoning": 0,
          "cache": {
            "read": 0,
            "write": 0
          }
        }
      },
      "parts": []
    },

sheldonhull avatar Dec 17 '25 23:12 sheldonhull

hm interesting

rekram1-node avatar Dec 18 '25 02:12 rekram1-node

For me this has been seriously impactful to using Opencode so I rely more on other tools right now. Nearly every conversation has this experience with gpt-5 models.

Thankfully I've been able to just use export and start in a new session easily enough but it essentially ends up blocking a current session requiring me to start a new one.
I get it with gpt 5.1 mini, max, normal, codex.

Just wanted to make sure you knew it's not just an occasional annoyance but makes it a bit rough.

sheldonhull avatar Dec 20 '25 18:12 sheldonhull

I think I'd need an entire session export to actually debug this, I never run into it msyelf,

Is this happening if you abort mid session?

rekram1-node avatar Dec 20 '25 19:12 rekram1-node