Skip to content

ci: browser mode less flaky#932

Merged
fi3ework merged 1 commit intomainfrom
b-f
Feb 3, 2026
Merged

ci: browser mode less flaky#932
fi3ework merged 1 commit intomainfrom
b-f

Conversation

@fi3ework
Copy link
Copy Markdown
Member

@fi3ework fi3ework commented Feb 3, 2026

Summary

  • Wait for stdout/stderr streams to close before asserting exit code
  • Fix race condition in E2E tests causing flaky failures
  • Update expectExecSuccess and expectExecFailed helpers

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings February 3, 2026 08:30
@fi3ework fi3ework enabled auto-merge (squash) February 3, 2026 08:30
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @fi3ework, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the stability of end-to-end tests by addressing a common source of flakiness: race conditions between process termination and output stream completion. By ensuring that all standard output and error streams are fully processed before evaluating a command's exit code, the changes make test assertions more robust and reliable, leading to a more consistent CI pipeline.

Highlights

  • Stream Completion Tracking: Introduced stdoutEnded and stderrEnded promises within the Cli class to reliably track when the standard output and error streams of a child process have fully closed.
  • New Utility Method: Added a waitForStreamsEnd() method to the Cli class, which allows callers to asynchronously wait for both stdout and stderr streams to complete their output.
  • Flakiness Fix in E2E Tests: Integrated the waitForStreamsEnd() method into the expectExecSuccess and expectExecFailed helper functions. This ensures that exit code assertions in E2E tests only occur after all process output has been captured, mitigating race conditions and reducing test flakiness.
Changelog
  • e2e/scripts/index.ts
    • Added stdoutEnded and stderrEnded properties to the Cli class to manage stream completion promises.
    • Implemented logic in the Cli constructor to initialize stdoutEnded and stderrEnded promises, resolving upon stream 'end' events.
    • Introduced a new public method waitForStreamsEnd() in Cli to await the completion of both stdout and stderr streams.
    • Modified expectExecSuccess() to call await cli.waitForStreamsEnd() before checking the process exit code.
    • Modified expectExecFailed() to call await cli.waitForStreamsEnd() before checking the process exit code.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses flaky E2E tests by ensuring that stdout and stderr streams are fully closed before asserting process exit codes. This is achieved by introducing promises that resolve on the 'end' event of these streams and awaiting them in the test helper functions expectExecSuccess and expectExecFailed. The changes are logical and directly address the race condition described. I have one suggestion to improve code maintainability by reducing duplication.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses race conditions in E2E tests that were causing flaky failures in browser mode by ensuring that stdout and stderr streams have fully closed before asserting exit codes.

Changes:

  • Added stream end tracking with stdoutEnded and stderrEnded promises in the Cli class constructor
  • Implemented waitForStreamsEnd() method to wait for both streams to finish
  • Updated expectExecSuccess and expectExecFailed helpers to wait for stream completion before checking exit codes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fi3ework fi3ework merged commit 1a7d274 into main Feb 3, 2026
9 checks passed
@fi3ework fi3ework deleted the b-f branch February 3, 2026 08:51
@9aoy 9aoy mentioned this pull request Feb 5, 2026
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.

2 participants