Skip to content

test(evals): fix overlapping act() deadlock in app-test-helper#23666

Merged
Adib234 merged 2 commits intomainfrom
adibakm/fix-ask-user-eval-hang-v2
Mar 24, 2026
Merged

test(evals): fix overlapping act() deadlock in app-test-helper#23666
Adib234 merged 2 commits intomainfrom
adibakm/fix-ask-user-eval-hang-v2

Conversation

@Adib234
Copy link
Contributor

@Adib234 Adib234 commented Mar 24, 2026

Summary

This PR fixes a deadlock in evals/app-test-helper.ts that caused the ask_user behavioral evaluations to time out indefinitely while stuck on the Initializing... spinner.

Details

The test helper rig.render() is an async function that uses React's act() internally. Because it was called synchronously (without await), its act() call overlapped with the immediate await rig.waitForIdle() call that follows it. React 18's test renderer does not support overlapping act() calls and deadlocks the UI update queue, preventing state updates (like setCommands()) from flushing to the simulated terminal.

By adding await before rig.render(), the UI queue resolves properly, the commands finish loading, and the tests run to completion.

Related Issues

Fixes #23624

How to Validate

  1. Check out the branch.
  2. Run npm run test:always_passing_evals -- evals/ask_user.eval.ts
  3. Verify that the 4 evaluation tests pass successfully without timing out.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@Adib234 Adib234 requested a review from a team as a code owner March 24, 2026 13:31
@Adib234 Adib234 self-assigned this Mar 24, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 evals/app-test-helper.ts file, specifically affecting the ask_user behavioral evaluations. By ensuring that rig.render() is awaited, the UI queue resolves correctly, preventing timeouts and allowing the tests to complete successfully. This change enhances the stability and reliability of the evaluation tests.

Highlights

  • Deadlock Fix: This PR resolves a deadlock issue in evals/app-test-helper.ts that was causing ask_user behavioral evaluations to time out.
  • Overlapping act() Calls: The deadlock was due to overlapping act() calls in React 18's test renderer when rig.render() was called synchronously before await rig.waitForIdle().
  • Asynchronous Rendering: The fix involves adding await before rig.render() to ensure the UI queue resolves properly, allowing state updates to flush to the simulated terminal.
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.

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

@github-actions
Copy link

github-actions bot commented Mar 24, 2026

Size Change: -4 B (0%)

Total Size: 26.2 MB

Filename Size Change
./bundle/chunk-BO5OMHCM.js 0 B -14.6 MB (removed) 🏆
./bundle/chunk-RIATJBWG.js 0 B -3.64 MB (removed) 🏆
./bundle/core-ULBUIBVT.js 0 B -43.4 kB (removed) 🏆
./bundle/devtoolsService-GTMTZD5U.js 0 B -27.7 kB (removed) 🏆
./bundle/interactiveCli-6R3MGUGO.js 0 B -1.62 MB (removed) 🏆
./bundle/oauth2-provider-VIGTE2G7.js 0 B -9.16 kB (removed) 🏆
./bundle/chunk-EYH6P5WP.js 14.6 MB +14.6 MB (new file) 🆕
./bundle/chunk-VLMKZXKG.js 3.64 MB +3.64 MB (new file) 🆕
./bundle/core-VAMD7W2A.js 43.4 kB +43.4 kB (new file) 🆕
./bundle/devtoolsService-UZXMOYXI.js 27.7 kB +27.7 kB (new file) 🆕
./bundle/interactiveCli-D77ZYYKZ.js 1.62 MB +1.62 MB (new file) 🆕
./bundle/oauth2-provider-SVDSR4HH.js 9.16 kB +9.16 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
./bundle/chunk-34MYV7JD.js 2.45 kB
./bundle/chunk-5AUYMPVF.js 858 B
./bundle/chunk-664ZODQF.js 124 kB
./bundle/chunk-DAHVX5MI.js 206 kB
./bundle/chunk-IUUIT4SU.js 56.5 kB
./bundle/chunk-PVQN7ZVP.js 1.96 MB
./bundle/chunk-RJTRUG2J.js 39.8 kB
./bundle/devtools-36NN55EP.js 696 kB
./bundle/dist-T73EYRDX.js 356 B
./bundle/gemini.js 522 kB
./bundle/getMachineId-bsd-TXG52NKR.js 1.55 kB
./bundle/getMachineId-darwin-7OE4DDZ6.js 1.55 kB
./bundle/getMachineId-linux-SHIFKOOX.js 1.34 kB
./bundle/getMachineId-unsupported-5U5DOEYY.js 1.06 kB
./bundle/getMachineId-win-6KLLGOI4.js 1.72 kB
./bundle/memoryDiscovery-WPGC7DAZ.js 922 B
./bundle/multipart-parser-KPBZEGQU.js 11.7 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB
./bundle/sandbox-macos-strict-open.sb 4.82 kB
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB
./bundle/src-QVCVGIUX.js 47 kB
./bundle/tree-sitter-7U6MW5PS.js 274 kB
./bundle/tree-sitter-bash-34ZGLXVX.js 1.84 MB

compressed-size-action

@gemini-cli gemini-cli bot added the area/platform Issues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmt label Mar 24, 2026
@Adib234 Adib234 requested a review from a team as a code owner March 24, 2026 14:12
@Adib234
Copy link
Contributor Author

Adib234 commented Mar 24, 2026

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();
Copy link
Member

Choose a reason for hiding this comment

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

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.

@Adib234 Adib234 added this pull request to the merge queue Mar 24, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 24, 2026
@Adib234 Adib234 added this pull request to the merge queue Mar 24, 2026
Merged via the queue into main with commit bf80e27 Mar 24, 2026
46 checks passed
@Adib234 Adib234 deleted the adibakm/fix-ask-user-eval-hang-v2 branch March 24, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/platform Issues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

evals: ask_user behavioral evaluations hang indefinitely on Initializing screen

2 participants