Skip to content

[Fix] interrupted sometimes didn't work#4461

Open
Wu-Jiayang wants to merge 4 commits intogoogle:mainfrom
Wu-Jiayang:wjy/fix-interrupted
Open

[Fix] interrupted sometimes didn't work#4461
Wu-Jiayang wants to merge 4 commits intogoogle:mainfrom
Wu-Jiayang:wjy/fix-interrupted

Conversation

@Wu-Jiayang
Copy link

@Wu-Jiayang Wu-Jiayang commented Feb 12, 2026

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

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

2. Or, if no issue exists, describe the change:

If applicable, please follow the issue templates to provide as much detail as
possible.

Problem:
A clear and concise description of what the problem is.
#4460

Solution:
A clear and concise description of what you want to happen and why you choose
this solution.

#4460

Testing Plan

Please describe the tests that you ran to verify your changes. This is required
for all PRs that are not small documentation or typo fixes.

Unit Tests:

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

Please include a summary of passed pytest results.

Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
Wu Jiayang@DESKTOP-0BHILLU /d/p/adk-python (wjy/fix-interrupted)> source d:/py/adk-python/.venv/Scripts/activate.fish
(.venv) Wu Jiayang@DESKTOP-0BHILLU /d/p/adk-python (wjy/fix-interrupted)> pytest tests/unittests/models/test_gemini_llm_connection.py -n auto
======================================================================= test session starts ======================================================================= 
platform win32 -- Python 3.11.14, pytest-9.0.2, pluggy-1.6.0
rootdir: D:\py\adk-python
configfile: pyproject.toml
plugins: anyio-4.12.1, langsmith-0.7.1, asyncio-1.3.0, mock-3.15.1, xdist-3.8.0
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
12 workers [25 items]
.........................                                                                                                                                    [100%] 
======================================================================= 25 passed in 5.81s ======================================================================== 
(.venv) Wu Jiayang@DESKTOP-0BHILLU /d/p/adk-python (wjy/fix-interrupted)>

Manual End-to-End (E2E) Tests:

Please provide instructions on how to manually test your changes, including any
necessary setup or configuration. Please provide logs or screenshots to help
reviewers better understand the fix.

pytest tests/unittests/models/test_gemini_llm_connection.py -n auto

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.

Additional context

Add any other context or screenshots about the feature request here.

@google-cla
Copy link

google-cla bot commented Feb 12, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Wu-Jiayang, 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 bug in the GeminiLlmConnection where the interrupted flag within LlmResponse was not always correctly yielded. The change ensures that the interrupted status is always emitted when received from the server, preventing scenarios where this crucial status might be missed by the client.

Highlights

  • Interrupted Status Fix: Corrected an issue in the receive async generator where the interrupted status from LLM responses was not consistently propagated, particularly when text content was also present in the same message.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/google/adk/models/gemini_llm_connection.py
    • Ensured that the interrupted status is always yielded from the receive async generator, even when text content is present.
Activity
  • No specific review comments or activity have 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.

@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Feb 12, 2026
@adk-bot
Copy link
Collaborator

adk-bot commented Feb 12, 2026

Response from ADK Triaging Agent

Hello @Wu-Jiayang, thank you for creating this PR!

To help us review your contribution, could you please address the following points from our contribution guidelines?

  • Sign our Contributor License Agreement (CLA): It looks like the CLA check has failed. Please visit https://cla.developers.google.com/ to sign it.
  • Complete the PR Template: Could you please fill out the "Solution" and "Problem" sections in the PR description to provide more context for the change?
  • Provide a Testing Plan: Please describe the unit tests or manual end-to-end (E2E) tests you ran to verify your changes. If you added unit tests, please include a summary of the pytest results.

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

The logical change in this pull request is correct. It fixes a bug where an interrupted signal could be dropped if there was pending text to be sent. By removing the else condition, you ensure that both the pending text and the interrupted signal are yielded. However, a crucial part of a bug fix is to include a test that prevents regressions. This PR is missing a unit test that specifically covers the scenario of a non-empty text buffer followed by an interruption. Please add a test case that would have failed before this fix and passes now.

@Wu-Jiayang
Copy link
Author

@hangfei

…ntent and test_receive_interrupted_with_content
@ryanaiagent ryanaiagent self-assigned this Feb 13, 2026
@ryanaiagent
Copy link
Collaborator

Hi @Wu-Jiayang, Thank you for your contribution! We appreciate you taking the time to submit this pull request. Your PR has been received by the team and is currently under review. We will provide feedback as soon as we have an update to share.

@ryanaiagent ryanaiagent added the needs review [Status] The PR/issue is awaiting review from the maintainer label Feb 13, 2026
@ryanaiagent
Copy link
Collaborator

Hi @wyf7107 , can you please review this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core [Component] This issue is related to the core interface and implementation needs review [Status] The PR/issue is awaiting review from the maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants