Skip to content

Conversation

@Moumouls
Copy link

@Moumouls Moumouls commented Jan 9, 2026

  • Closes No issues

Additional details

ON CI envs ( like github actions ), processs exit can terminate the process before stdout/stderr are properly flushed.
It lead to a cropped result summary table


Note

Prevents truncated terminal output in CI by guaranteeing buffered streams flush before exit.

  • Adds waitForStreamDrain() and awaits it for process.stdout and process.stderr in packages/server/lib/cypress.ts exit()
  • Includes a 5s safety timeout and debug logs while waiting
  • Updates cli/CHANGELOG.md with 15.8.3 bugfix entry describing the CI output cut-off fix

Written by Cursor Bugbot for commit 3a128d6. This will update automatically on new commits. Configure here.

Steps to test

Create a lot of specs files, run Cypress on Ci env like Github Action, the result summary table is cropped.

How has the user experience changed?

No change

PR Tasks

Not sure how to add tests for this one.

@CLAassistant
Copy link

CLAassistant commented Jan 9, 2026

CLA assistant check
All committers have signed the CLA.

@cypress-app-bot
Copy link
Collaborator

@Moumouls
Copy link
Author

Moumouls commented Jan 9, 2026

not sure why semantic PR is not happy, i added the suggested line to line 4

@MikeMcC399

This comment was marked as resolved.

@jennifer-shehane
Copy link
Member

@Moumouls Do you have an example output / screenshot of what this looks like? I can't say that I've seen this exactly before.

} else {
setImmediate(resolve)
}
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stream drain event may not fire causing unnecessary delay

Medium Severity

The waitForStreamDrain function waits for the 'drain' event when writableLength > 0. However, Node.js only emits the 'drain' event after a write() call returns false (indicating the buffer was full). If there's buffered data but all writes succeeded (returned true), the 'drain' event will never fire, causing the code to always wait for the 5-second safety timeout. This could add significant delays to CI builds. A more reliable approach would be to poll writableLength until it reaches 0, or use setImmediate to allow the event loop to flush pending writes.

Fix in Cursor Fix in Web

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Moumouls Could you address whether this comment is relevant?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not 100% sure about the correct approach here. The issue is very “low-level,” and I’m not an expert in that area. I was helped by Opus on this task, and the code seems logically sound. Does anyone on the Cypress team have expertise in this kind of stuff?

The 5-second timeout at the end of a full spec run doesn’t seem like an issue to me.

However, I’m not sure what the best approach is to ensure things happen ASAP and to verify that all logs are properly flushed.

If I were coding it myself, I’d probably go with a 1–3 second timeout. I believe that should be sufficient, since this feels more like a millisecond or nanosecond-level issue.

@Moumouls
Copy link
Author

Moumouls commented Jan 9, 2026

sure @jennifer-shehane

Here an example :
image

image

We tried a patch like this to capture the exit code, because we thought it was a GitHub Actions issue (and it still might be). That’s why, in my screenshot, you can see the coverage summary, but it’s cropped.

yarn cypress:run --browser chrome --config-file cypress.config.ts; EXIT_CODE=$?; sleep 3; nyc report --reporter=text-summary; exit $EXIT_CODE

I asked Opus 4.5, and it seems that nothing guarantees a process will wait for all standard streams to be fully flushed before exiting. In GitHub Actions, this means the exit code can be received and log streaming can be shut down before the full log has been transmitted.

The issue seems also random sometimes we have the full report, so it sounds there is a race between the exit code and the STD.

Example of a good working one ( with same scripts)

image

So my conclusion is: cypress seems to exit a little bit too fast, and it should wait a little bit to ensure in CI envs all the logs are correctly flushed

@Moumouls
Copy link
Author

@jennifer-shehane don't hesitate to tell me what i can do to help this PR to move forward !

The issue is quite annoying on our CI ahahha

@coratgerl
Copy link

coratgerl commented Jan 20, 2026

I have the same issue @jennifer-shehane, do you have any ETA for this one 🙏 ?

@Moumouls
Copy link
Author

Hi @jennifer-shehane, we’re still experiencing this issue. What can we do to help get this PR into the next release?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants