fix: flaky Agent to Agent tests#672
Conversation
Summary of ChangesHello @kabir, 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 resolves flakiness in Agent-to-Agent tests by overhauling the internal delegation mechanism. The previous asynchronous, callback-driven approach, which was prone to race conditions, has been replaced with a simplified synchronous blocking client call. This ensures that the test reliably receives the final state of delegated tasks, significantly improving test stability and providing better diagnostics for unexpected states. Highlights
Changelog
Activity
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. 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
|
There was a problem hiding this comment.
Code Review
This pull request refactors the agent-to-agent delegation test logic to use a blocking client call instead of an asynchronous one with a CountDownLatch. This change aims to eliminate flakiness in the tests by simplifying the synchronization logic. The new implementation also includes a helpful diagnostic check to ensure the blocking call returns a final task state as expected. The overall change is a good improvement for test stability. No issues were found that contradict the repository's rules.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request effectively addresses flaky agent-to-agent tests by refactoring the delegation logic to use a synchronous, blocking client call instead of an asynchronous, latch-based approach. This simplification in AgentExecutorProducer makes the code more robust and easier to follow. The corresponding change to use a non-streaming client in AbstractA2AServerTest is consistent and correct. I particularly appreciate the addition of the diagnostic check to verify that the blocking call returns a final task state, which is an excellent safeguard against future regressions.
| if (event instanceof TaskEvent te) { | ||
| taskRef.set(te.getTask()); | ||
| } else if (event instanceof TaskUpdateEvent tue) { | ||
| taskRef.set(tue.getTask()); | ||
| } |
There was a problem hiding this comment.
The consumer lambda for sendMessage includes a check for TaskUpdateEvent. However, since this sendMessage call is on a non-streaming client (streaming=false), the client will only invoke the consumer with a final TaskEvent or MessageEvent after the blocking call completes. It will not receive intermediate TaskUpdateEvents. Therefore, the else if (event instanceof TaskUpdateEvent tue) branch is effectively dead code in this context. Removing it would make the code clearer and more accurately reflect the behavior of a non-streaming client call.
if (event instanceof TaskEvent te) {
taskRef.set(te.getTask());
}
No description provided.