Skip to content

Conversation

@AriYusa
Copy link

@AriYusa AriYusa commented Dec 8, 2025

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

Problem:
disallow_transfer_to_peers=True only affected the instruction prompt. Subagents could still transfer tasks directly to sibling agents by inferring their names from conversation history or the user’s prompt.

Solution:
Added a check in _get_agent_to_run. When disallow_transfer_to_peers=True, the function now raises an error if a transfer to a sibling agent is attempted. I placed the check here because _get_agent_to_run already contains a closely related validation for transfers to non-existent agents.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

Manual End-to-End (E2E) Tests:

Manually tested before and after fix with adk web by prompting subagents to transfer directly to sibling and getting newly added error after fix

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules. (not applicable)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @AriYusa, 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 an inconsistency in the disallow_transfer_to_peers setting, which previously failed to prevent direct task transfers between sibling subagents. By introducing a robust validation check in the _get_agent_to_run method, the change ensures that this setting is fully enforced, preventing unintended agent interactions and enhancing control over agent behavior. The update includes new unit tests to verify the fix and maintain system integrity.

Highlights

  • Enforced Peer Transfer Restriction: Implemented a new check within the _get_agent_to_run method to prevent subagents from transferring tasks directly to sibling agents when the disallow_transfer_to_peers setting is enabled. This closes a loophole where the restriction previously only applied to instruction prompts.
  • New Unit Tests: Added a new test file, test_base_llm_flow_transfer.py, with comprehensive unit tests to validate the correct behavior of the _get_agent_to_run method, specifically covering scenarios where transfers to sibling agents are both allowed and disallowed.
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.

@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Dec 8, 2025
@adk-bot
Copy link
Collaborator

adk-bot commented Dec 8, 2025

Response from ADK Triaging Agent

Hello @AriYusa, thank you for creating this PR!

This is a great fix and the testing plan is very clear. To help reviewers better understand the result of the manual E2E test, could you please provide a screenshot of the error that is raised in adk web after the fix is applied?

This information will help reviewers to review your PR more efficiently. Thanks!

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 correctly adds a check to prevent task transfers to sibling agents when disallow_transfer_to_peers is enabled. The implementation is straightforward and includes relevant unit tests. I've added one suggestion to refine the logic to correctly handle self-transfers, which should not be considered a transfer to a peer.

@ryanaiagent ryanaiagent self-assigned this Dec 9, 2025
@ryanaiagent ryanaiagent added the a2a [Component] This issue is related a2a support inside ADK. label Dec 11, 2025
@ryanaiagent
Copy link
Collaborator

Hi @thank you for your contribution! We appreciate you taking the time to submit this pull request.
Can you also fix the failing unit tests before we proceed with the review.

@ryanaiagent ryanaiagent added the request clarification [Status] The maintainer need clarification or more information from the author label Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a2a [Component] This issue is related a2a support inside ADK. core [Component] This issue is related to the core interface and implementation request clarification [Status] The maintainer need clarification or more information from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

disallow_transfer_to_peers=True can be bypassed

3 participants