codex icon indicating copy to clipboard operation
codex copied to clipboard

Azure: stream disconnected before completion: response.failed event received

Open codeofdusk opened this issue 10 months ago • 23 comments

What version of Codex is running?

codex-cli 0.91.0

What subscription do you have?

Azure (Visual Studio Enterprise)

Which model were you using?

gpt-5.2-codex

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

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

Windows Terminal 1.23.13503.0

What issue are you seeing?

Codex runs for a while, then gives me the error:

stream disconnected before completion: response.failed event received

What steps can reproduce the bug?

Sadly no clear str, but it often happens in /review or long-running loops with high reasoning effort.

Uploaded thread: 019bfc27-dd66-7431-96e3-881df4751b68

What is the expected behavior?

Stream completes normally.

Additional information

No response

codeofdusk avatar Jan 26 '26 21:01 codeofdusk

CC @etraut-openai.

codeofdusk avatar Jan 26 '26 21:01 codeofdusk

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

  • #9635
  • #8865
  • #4347

Powered by Codex Action

github-actions[bot] avatar Jan 26 '26 21:01 github-actions[bot]

This looks like it's an issue that we fixed (or at least mitigated) a couple of weeks ago. Under certain circumstances, the latest models are taking a long time to stream responses, and this can trigger a timeout at the HTTP layer. The fix was to introduce a keepalive on the server side. It's quite possible that the Azure team has not yet integrated this change on their side. You might want to report the issue to them.

etraut-openai avatar Jan 26 '26 21:01 etraut-openai

Under certain circumstances, the latest models are taking a long time to stream responses, and this can trigger a timeout at the HTTP layer.

In the meantime, could the tiemout (on the Codex CLI side) be made configurable, or is it already?

codeofdusk avatar Jan 26 '26 22:01 codeofdusk

A client-side fix isn't possible for this. It need to be fixed on the server.

etraut-openai avatar Jan 27 '26 02:01 etraut-openai

Still facing this issue with gpt-5.3-codex on Azure

matys1 avatar Mar 05 '26 12:03 matys1

@matys1, make sure you're reporting these issues to Azure as well. If it's a connectivity issue on their side, they won't know that you're facing issues if you report it here.

etraut-openai avatar Mar 05 '26 15:03 etraut-openai

Still getting this and I am using gpt-5.1-codex-mini high. this is frustrating. These issues dont happen on claude code. so to come here and experience it, really defeats the purpose of using codex at all

sgil-itglue avatar Mar 05 '26 17:03 sgil-itglue

Most of these the "disconnected before completion" issues turn out to be network connectivity issues — often related to VPNs, proxies, and firewalls. We receive a lot of these bug reports and don't have time to investigate them all. We are working on a connectivity analyzer tool to help users self-diagnose these issues.

As I mentioned above, if you have not already done so, I recommend reporting these issues to Azure as well. If this is a connectivity issue on their side, they will not know about it if you don't report it to them.

etraut-openai avatar Mar 05 '26 17:03 etraut-openai

Still facing this issue with gpt-5.3-codex on Azure

same here with xhigh - @etraut-openai where do we report this to Azure?

mbartonftp avatar Mar 05 '26 20:03 mbartonftp

I was running into this issue and resolved it by increasing the capacity on the Azure deployed model (e.g. 300).

drew-simmons avatar Mar 11 '26 11:03 drew-simmons

I was running into this issue and resolved it by increasing the capacity on the Azure deployed model (e.g. 300).

This worked for us, thanks!

mbartonftp avatar Mar 12 '26 16:03 mbartonftp

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.

pauldinu10 avatar Mar 23 '26 22:03 pauldinu10

same here with 5.5 - super annoying!

Hundsmuhlen avatar May 05 '26 00:05 Hundsmuhlen

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.

Image

OrhanYaz avatar May 06 '26 05:05 OrhanYaz

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.

Image

Which account are you in? I can't do that...

6639835 avatar May 06 '26 15:05 6639835

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.

Image

It works, thanks!

6639835 avatar May 06 '26 15:05 6639835

Changing the token limit from 250k to 1 million solved the issue for me as well. Previously at 250k token limit, I would get the error: "■ stream disconnected before completion: response.failed event received." Following my change to 1 million, it did not happen again.

jo-rum avatar Jun 17 '26 14:06 jo-rum

Using gpt 5.6, still having this issue, on one of the VM it works fine, on the other it does not

VABVAT avatar Jul 20 '26 09:07 VABVAT

what vm it doesnt have this @VABVAT ?

KENILSHAHH avatar Jul 24 '26 04:07 KENILSHAHH