test(evals): fix overlapping act() deadlock in app-test-helper#23666
test(evals): fix overlapping act() deadlock in app-test-helper#23666
Conversation
Summary of ChangesHello, 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 addresses a critical deadlock issue in the Highlights
Using Gemini Code AssistThe 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
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 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request fixes a deadlock in the app-test-helper.ts test utility. The change correctly adds an await to the rig.render() call, which is an asynchronous function. This prevents overlapping act() calls in the React test environment, resolving the test timeouts as described. The fix is correct and I have no further comments.
|
Size Change: -4 B (0%) Total Size: 26.2 MB
ℹ️ View Unchanged
|
|
All evals pass with at least 67% https://github.com/google-gemini/gemini-cli/actions/runs/23494237019 |
|
|
||
| // Render the app! | ||
| rig.render(); | ||
| await rig.render(); |
There was a problem hiding this comment.
FWIW there's a 'no floating promises' linter I enabled in the rest of the codebase to catch issues like this. You could consider enabling in the evals directory as well.
Summary
This PR fixes a deadlock in
evals/app-test-helper.tsthat caused theask_userbehavioral evaluations to time out indefinitely while stuck on theInitializing...spinner.Details
The test helper
rig.render()is an async function that uses React'sact()internally. Because it was called synchronously (withoutawait), itsact()call overlapped with the immediateawait rig.waitForIdle()call that follows it. React 18's test renderer does not support overlappingact()calls and deadlocks the UI update queue, preventing state updates (likesetCommands()) from flushing to the simulated terminal.By adding
awaitbeforerig.render(), the UI queue resolves properly, the commands finish loading, and the tests run to completion.Related Issues
Fixes #23624
How to Validate
npm run test:always_passing_evals -- evals/ask_user.eval.tsPre-Merge Checklist