Skip to content

Facing frequent stream disconnection issue while using Codex CLI #8865

Closed

Description

@D951516

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

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 7, 2026
  2. github-actions commented on Jan 7, 2026

    @github-actions
    Contributor

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

    Powered by Codex Action

  3. etraut-openai commented on Jan 7, 2026

    @etraut-openai
    Contributor

    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.

  4. D951516 commented on Jan 9, 2026

    @D951516
    Author

    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

    Image
  5. D951516 commented on Jan 12, 2026

    @D951516
    Author

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

  6. etraut-openai commented on Jan 12, 2026

    @etraut-openai
    Contributor

    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.

  7. D951516 commented on Jan 12, 2026

    @D951516
    Author

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

  8. etraut-openai commented on Jan 13, 2026

    @etraut-openai
    Contributor

    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.

  9. D951516 commented on Jan 13, 2026

    @D951516
    Author

    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?

  10. etraut-openai commented on Jan 13, 2026

    @etraut-openai
    Contributor

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

  11. cvietor commented on Jan 13, 2026

    @cvietor

    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

  12. 8 remaining items

  13. D951516 commented on Jan 26, 2026

    @D951516
    Author

    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

    Image
  14. tosokr commented on Feb 6, 2026

    @tosokr

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

  15. mhkwm commented on Feb 12, 2026

    @mhkwm

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

  16. olthierie commented on Feb 12, 2026

    @olthierie

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

  17. etraut-openai commented on Feb 12, 2026

    @etraut-openai
    Contributor

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

  18. neurostream commented on Feb 14, 2026

    @neurostream

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

  19. removed
    windows-osIssues related to Codex on Windows systems
    CLIIssues related to the Codex CLI
    on Feb 18, 2026
  20. matys1 commented on Mar 5, 2026

    @matys1

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

  21. attilaolah commented on Mar 17, 2026

    @attilaolah

    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.

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

  23. etraut-openai commented on Apr 5, 2026

    @etraut-openai
    Contributor

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

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

    azureIssues related to the Azure-hosted OpenAI modelsbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions