Skip to content

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

Open

Description

@codeofdusk

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

Activity

  1. added
    CLIIssues related to the Codex CLI
    azureIssues related to the Azure-hosted OpenAI models
    windows-osIssues related to Codex on Windows systems
    on Jan 26, 2026
  2. codeofdusk commented on Jan 26, 2026

    @codeofdusk
    Author
  3. etraut-openai commented on Jan 26, 2026

    @etraut-openai
    Contributor

    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.

  4. codeofdusk commented on Jan 26, 2026

    @codeofdusk
    Author

    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?

  5. etraut-openai commented on Jan 27, 2026

    @etraut-openai
    Contributor

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

  6. matys1 commented on Mar 5, 2026

    @matys1

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

  7. etraut-openai commented on Mar 5, 2026

    @etraut-openai
    Contributor

    @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.

  8. sgil-itglue commented on Mar 5, 2026

    @sgil-itglue

    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

  9. etraut-openai commented on Mar 5, 2026

    @etraut-openai
    Contributor

    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.

  10. mbartonftp commented on Mar 5, 2026

    @mbartonftp

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

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

  11. drew-simmons commented on Mar 11, 2026

    @drew-simmons

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

  12. mbartonftp commented on Mar 12, 2026

    @mbartonftp

    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!

  13. pauldinu10 commented on Mar 23, 2026

    @pauldinu10

    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.

  14. Hundsmuhlen commented on May 5, 2026

    @Hundsmuhlen

    same here with 5.5 - super annoying!

  15. OrhanYaz commented on May 6, 2026

    @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
  16. 6639835 commented on May 6, 2026

    @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

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

  17. 6639835 commented on May 6, 2026

    @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!

  18. jo-rum commented on Jun 17, 2026

    @jo-rum

    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.

  19. VABVAT commented on Jul 20, 2026

    @VABVAT

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

  20. KENILSHAHH commented on Jul 24, 2026

    @KENILSHAHH

    what vm it doesnt have this @VABVAT ?

  21. VABVAT commented on Jul 24, 2026

    @VABVAT

    @KENILSHAHH on jupyter notebook hosted on AWS (sagemaker)

  22. Alvi24 commented on Jul 31, 2026

    @Alvi24

    having the same issue

  23. markojak commented on Aug 4, 2026

    @markojak

    This is a constant issue for us as well through a HTTP Proxy -> hitting the Azure Foundry deployed endpoint. 5.6-sol and other models

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIazureIssues related to the Azure-hosted OpenAI modelsbugSomething isn't workingwindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions