[Bug]: openai-chatgpt provider fails with 400 "encrypted content could not be verified" and does not retry
Description
With the openai-chatgpt provider, a code --init or code --update run sometimes stops with this response from the ChatGPT Codex backend:
Error 400 The encrypted content for item rs_… could not be verified. Reason: Encrypted content could not be decrypted or parsed.openwiki does not retry the request. The run ends, openwiki/.last-update.json records "status": "interrupted", and the process still exits 0.
Steps to Reproduce
- Log in with the wizard and choose the
openai-chatgptprovider. - Run
openwiki code --initoropenwiki code --updateon a mid-size repository (ours has about 550 Python source files). - Wait until a page worker or the planner reaches a large context. The error is intermittent, so several runs can be needed.
Expected Behavior
openwiki recovers from the rejected reasoning item, for example by one retry without the reasoning input items, and the run completes. If it cannot recover, the process exits non-zero so CI can detect the failure.
Actual Behavior
The request fails with the 400 above and the run is interrupted. We saw it with gpt-5.6-luna, gpt-5.6-sol, and gpt-5.6-terra, on 2 ChatGPT accounts, at roughly 62,000 to 295,000 tokens of context. The latest case happened in the planning phase of --update with gpt-5.6-luna and OPENWIKI_REASONING_EFFORT=max. Other runs with the same login and model complete, so the login itself is valid.
Environment
- openwiki 0.5.2 from npm,
@langchain/openai1.5.13 - Node v22.23.1, Linux x86_64
- Provider
openai-chatgpt, plan Pro
Additional Context
The provider sets zdrEnabled: true (dist/agent/index.js), so @langchain/openai stores reasoning.encrypted_content from each response and replays the reasoning item in the next request (convertReasoningSummaryToResponsesReasoningItem in converters/responses.js). The backend rejects one of those replayed items. createCodexFetch in dist/agent/openai-chatgpt-oauth.js already rewrites the payload for this backend and looks like the natural place for a recovery: on this specific 400, drop the type: "reasoning" items from payload.input and send the request once more.
A separate but related point: a run that ends as interrupted exits 0. We work around both in CI by rerunning --update until .last-update.json reports complete.
Source: langchain-ai/openwiki