Facing frequent stream disconnection issue while using Codex CLI

Resolved 💬 28 comments Opened Jan 7, 2026 by D951516 Closed Apr 5, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.77.0

What subscription do you have?

Using Azure Microsoft Foundry Open AI Models

Which model were you using?

gpt-5-codex , gpt-5.1-codex

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64

What issue are you seeing?

We are repeatedly experiencing streaming failures while executing commands using OpenAI models.
Users consistently encounter the following error:

stream disconnected before completion: response.failed event received

This occurs even for simple prompts, and the response stream fails before completion.

We also intermittently receive the following error:

"Item with id 'rs_06b3ecdc79f7f90b006957c907543438197a56565d3b3ff2278' not found."
"type": "invalid_request_error"
"param": "input"

Actions Taken So Far

To mitigate the streaming issue, we have already:

> Increased the quota limits
> Added stream retry logic/parameters to allow session continuation

→ This prevents the session from dropping immediately, but causes extreme slowness during execution

Even after these changes, the stream continues to disconnect intermittently.

What steps can reproduce the bug?

It is occurring randomly even for simple Hello message.

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

28 Comments

github-actions[bot] contributor · 6 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #8854
  • #8838

Powered by Codex Action

etraut-openai contributor · 6 months ago

Have you reached out to the Azure team and reported this problem to them?

If this is something you can repro, please use the /feedback slash command to upload your logs and session details and post the thread ID here. This will help us provide additional diagnosis.

D951516 · 6 months ago

Yes, I have reached out to the Azure team, and they have done some troubleshooting. They advised contacting OpenAI and also checked and told me there are no quota-related issues.

Here is the thread ID: 019ba0ff-abfa-7de1-ae95-6ccd46017244

<img width="1307" height="273" alt="Image" src="https://github.com/user-attachments/assets/ae7c6a33-6fad-4a53-938d-f5ba73f72ef9" />

D951516 · 6 months ago

@etraut-openai Do you have any updates on this issue??

etraut-openai contributor · 6 months ago

This appears to be the same issue as #8371 and #8302. We're testing a fix for this internally and will roll it out once we're confident that it addresses the issue and doesn't cause any regressions.

D951516 · 6 months ago

Any ETA?? Please let us know once this is resolved.

etraut-openai contributor · 6 months ago

We think we have mitigated this issue. The more recent models (like 5.2) sometimes take longer to generate the next batch of tokens during streaming, and this can sometimes exceed an HTTP timeout value, which resulted in a stream disconnect.

I'm going to mark this bug as closed, but if you see this again in the next few days, please use /feedback to upload your logs and post your thread ID here.

D951516 · 6 months ago

Hi @etraut-openai, thanks for the update.
We generally use GPT-5.1-Codex or GPT-5-Codex. I will ask my team to try this out, but could you please confirm which Codex CLI version includes the fix so we can update accordingly?

etraut-openai contributor · 6 months ago

@D951516, make sure you're using the latest published version of the CLI (0.80.0).

cvietor · 6 months ago

I am using 0.80.0 since yesterday and still face the same issue.
My thread id: 019bb884-e9de-7b81-a560-2132765632e1
I am also using gpt-5.1-codex, also gpt-5.1-codex-max

etraut-openai contributor · 6 months ago

Thanks for the report @cvietor. Reopening the issue.

cvietor · 6 months ago
The more recent models (like 5.2) sometimes take longer to generate the next batch of tokens during streaming, and this can sometimes exceed an HTTP timeout value, which resulted in a stream disconnect.

I added this to my config.toml

[model_providers.azure]
# ...
stream_max_retries = 10

and with that increased retry count, codex manages to reconnect (mostly continuing after 7th or 8th try).
I could finish my task with this, which always failed before, sometimes directly in the beginning, sometimes after a couple of minutes in.

D951516 · 6 months ago

@cvietor We tried the Stream_max_retries workaround earlier and were able to proceed, but users reported issues due to frequent stream disconnects. Each disconnect triggers 7–8 reconnection attempts, which increases latency and becomes time-consuming while running long-running jobs.

etraut-openai contributor · 6 months ago

If you are using the Azure model provider, please report this issue to the Azure team. The error you're seeing appears to be specific to their implementation.

I suspect that the underlying problem is the same as the issue we recently fixed in the OpenAI endpoint, but the error message and the way it is manifested is different, and we can't say for sure that it's the same problem. If it is, you should see it go away when the Azure team picks up the code changes from OpenAI over the next few days.

I will also reach out to my Azure contacts to see if we can figure out a solution.

D951516 · 6 months ago

@etraut-openai Have you received any updates or a solution on this? I see that many other OpenAI users have also reported this issue.

Our team is still experiencing the problem and has not received any confirmation from the Azure team indicating that the issue is on their end.

etraut-openai contributor · 6 months ago

@D951516, no I haven't received any response or update from the Azure team either.

p-clements · 5 months ago

This occurs for us when using GPT5.2 primarily, even on the latest 0.91 version. For now we are sticking with 5.1 Max which seems to be affected far less often, if at all.

D951516 · 5 months ago

Here are the recent error messages and the thread ID shared by our team. They are using GPT-5-Codex and GPT-5.1-Codex Max

<img width="1316" height="343" alt="Image" src="https://github.com/user-attachments/assets/a54e6f60-8aeb-45b1-87df-9dc4674bf3a0" />

tosokr · 5 months ago

I am experiencing the same issues with gpt-5.2-codex via Azure

mhkwm · 5 months ago

I am also experiencing the same issue with gpt-5.1-codex via Azure

olthierie · 5 months ago

I am also experiencing the same issue with gpt-5.1-codex via Azure

etraut-openai contributor · 5 months ago

Please report these problems to the Azure team. There's not much the Codex team can do about this.

neurostream · 5 months ago

I'm experiencing this several times a day, even outside of Azure

matys1 · 4 months ago

I am also experiencing the same issue with gpt-5.3-codex via Azure

attilaolah · 4 months ago

Oddly enough, since GPT-5.4 has been out, I haven't seen this issue much in gpt-5.3-codex any more. In any case, bumping retries up to 30 mostly tosses this under the rug.

pauldinu10 · 3 months ago

I kept running into this on Azure with gpt-5.3-codex and 5.4. Built a workaround that auto-retries on stream disconnect and splits large tasks into separate sessions to avoid context overflow and compaction errors.
https://github.com/pauldinu10/codex-smart
It's a PowerShell wrapper that runs each task from a tasks.md file as a fresh codex exec --full-auto session. If the stream drops, it retries automatically up to N times. Not a fix, but makes Codex usable for long migrations.

etraut-openai contributor · 3 months ago

If you're still seeing this issue, please report it to the Azure team.

OrhanYaz · 2 months ago

Hey all, are you still having the issues using azure ai foundry through codex ? If yes I managed to fix the issue (I think). I was experiencing the issue everyday and then I thought about a parameter in azure AI foundry.
When you create a deployment (basically deploy gpt 5.4 or 5.5 model in Azure AI Foundry), you can control the token per minute rate and by default it is set to 250k. I increased it to a million token per minute and it solved the issue.
I think the issue was that once codex reach the limit, it get rate alerte from azure ai foundry which leads to the reconnecting.

<img width="711" height="171" alt="Image" src="https://github.com/user-attachments/assets/df4d8815-fe6b-4720-9bd3-31cc7c2fff87" />