codex - 💡(How to fix) Fix Resume session: stream disconnected before completion

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Unable to resume session after few days. I get error:

Fix Action

Fix / Workaround

  1. Snapshot rotation. Today's gateway response identifies the upstream as prod-japaneast-... That's an Azure deployment of OpenAI's gpt-5.4-2026-03-05 snapshot. Azure regularly redeploys with patched snapshots; each new snapshot has its own key set. Blobs encrypted under the old snapshot's key won't decrypt under the new one.
  2. Key TTL / rotation. Even within a single snapshot, the encryption keys are typically bound to a relatively short window (think hours/days — common practice with Fernet keys for forward secrecy). The server rotates keys; old ciphertexts become unreadable.
RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

v0.116.0

What subscription do you have?

vertex ai key based

Which model were you using?

gpt-5.4

What platform is your computer?

linux

What terminal emulator and version are you using (if applicable)?

bash

What issue are you seeing?

Unable to resume session after few days. I get error: ■ stream disconnected before completion: stream closed before response.completed

Here is what I found


When you send include: ["reasoning.encrypted_content"] (codex always does for reasoning models — core/src/client.rs:834), the upstream Responses API returns each reasoning item with an opaque blob:

"encrypted_content": "gAAAAABpxomMi1m..." ← Fernet ciphertext (Python cryptography lib)

The blob is the model's internal reasoning trace — chain-of-thought tokens, hidden state — encrypted with a server-side key. The client cannot read it. The contract is: hold it, send it back on the next turn, and the server decrypts it to give the model continuity of reasoning. This exists so clients can use store: false (no server-side conversation persistence) yet still get reasoning continuity across turns.

Why it works "in‑session" but not "on resume"

Nothing changes on the codex side. What changes is which key is alive on the server. Two ways that key dies:

  1. Snapshot rotation. Today's gateway response identifies the upstream as prod-japaneast-... That's an Azure deployment of OpenAI's gpt-5.4-2026-03-05 snapshot. Azure regularly redeploys with patched snapshots; each new snapshot has its own key set. Blobs encrypted under the old snapshot's key won't decrypt under the new one.
  2. Key TTL / rotation. Even within a single snapshot, the encryption keys are typically bound to a relatively short window (think hours/days — common practice with Fernet keys for forward secrecy). The server rotates keys; old ciphertexts become unreadable.

Your session was created 2026‑03‑27, ~24 days ago. By 2026‑04‑20, at minimum the keys have rotated; very likely the snapshot has also been redeployed at least once. Both effects make the historical encrypted_content blobs un-decryptable now.

Why nothing client-side can "fix" the encryption

The blob is opaque. There is no decryption key on your machine. There is no way to "renew" or "re-encrypt" it — only the original snapshot's server, with the keys that were live at 2026‑03‑27, could have read it. Those keys are gone.

That's why the only options are: drop the encrypted blobs (lose reasoning continuity, keep visible history), or abandon the conversation. There is no third path.

What steps can reproduce the bug?

Try resuming older session when using token based auth.

What is the expected behavior?

Session should continue to work as expected.

Additional information

No response

extent analysis

TL;DR

The issue is likely due to encryption key rotation, making it impossible to resume a session after a few days, and the only options are to drop the encrypted blobs or abandon the conversation.

Guidance

  • The error occurs because the encryption keys used to decrypt the encrypted_content blob have rotated, making it unreadable.
  • The issue is not client-side and cannot be fixed by renewing or re-encrypting the blob.
  • To mitigate the issue, consider dropping the encrypted blobs to lose reasoning continuity but keep visible history.
  • Alternatively, abandon the conversation and start a new session.
  • Be aware that this issue is inherent to the design of the system, which uses short-lived encryption keys for forward secrecy.

Notes

The provided information suggests that the issue is due to the natural rotation of encryption keys, which is a common practice for forward secrecy. There is no clear workaround that can be implemented on the client-side.

Recommendation

Apply workaround: Abandon the conversation and start a new session. This is because the encryption keys have rotated, making it impossible to resume the old session, and there is no way to renew or re-encrypt the encrypted_content blob.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Resume session: stream disconnected before completion