Skip to content

fix: preserve nontransparent live resumption#5676

Open
he-yufeng wants to merge 1 commit into
google:mainfrom
he-yufeng:fix/non-vertex-live-resumption
Open

fix: preserve nontransparent live resumption#5676
he-yufeng wants to merge 1 commit into
google:mainfrom
he-yufeng:fix/non-vertex-live-resumption

Conversation

@he-yufeng
Copy link
Copy Markdown
Contributor

Summary

Fixes #5675.

BaseLlmFlow.run_live always set session_resumption.transparent = True when reconnecting with a saved live-session handle. That overwrote an explicit transparent=False config, which is the configuration needed for direct Gemini API live-session resumption because GoogleLLM.connect rejects transparent resumption on the Gemini API backend.

This keeps the existing default behavior for reconnects that have no session resumption config yet, but preserves a caller-provided non-transparent config.

Validation

python -m pytest tests/unittests/flows/llm_flows/test_base_llm_flow.py -q
# 29 passed

pyink --check src/google/adk/flows/llm_flows/base_llm_flow.py tests/unittests/flows/llm_flows/test_base_llm_flow.py
isort --check-only src/google/adk/flows/llm_flows/base_llm_flow.py tests/unittests/flows/llm_flows/test_base_llm_flow.py
python -m py_compile src/google/adk/flows/llm_flows/base_llm_flow.py tests/unittests/flows/llm_flows/test_base_llm_flow.py
git diff --check

@he-yufeng he-yufeng force-pushed the fix/non-vertex-live-resumption branch 2 times, most recently from 0862fa5 to 40d1f38 Compare May 15, 2026 05:56
@rohityan rohityan self-assigned this May 18, 2026
@rohityan rohityan added live [Component] This issue is related to live, voice and video chat request clarification [Status] The maintainer need clarification or more information from the author labels May 19, 2026
@he-yufeng he-yufeng force-pushed the fix/non-vertex-live-resumption branch from 39cad79 to cf3a10c Compare May 20, 2026 04:52
@rohityan
Copy link
Copy Markdown
Collaborator

Hi @he-yufeng ,Thank you for your contribution! We appreciate you taking the time to submit this pull request. Please fix formatting errors by running autoformat.sh

@he-yufeng he-yufeng force-pushed the fix/non-vertex-live-resumption branch from 735c935 to 69033ca Compare May 21, 2026 04:57
@he-yufeng
Copy link
Copy Markdown
Contributor Author

Rebased onto current upstream/main and re-ran the focused checks locally.

Validation:

PYTHONUTF8=1 .\.venv\Scripts\python.exe -m pytest tests\unittests\flows\llm_flows\test_base_llm_flow.py -q --basetemp .tmp\pytest-5676
# 29 passed, 1 warning

PYTHONUTF8=1 .\.venv\Scripts\python.exe -m pyink src\google\adk\flows\llm_flows\base_llm_flow.py tests\unittests\flows\llm_flows\test_base_llm_flow.py --check
PYTHONUTF8=1 .\.venv\Scripts\python.exe -m py_compile src\google\adk\flows\llm_flows\base_llm_flow.py tests\unittests\flows\llm_flows\test_base_llm_flow.py
git diff --check

The previous failure was the pre-commit formatting check; this branch is now a single commit on current main.

@he-yufeng he-yufeng force-pushed the fix/non-vertex-live-resumption branch from 69033ca to b4e1565 Compare May 22, 2026 14:25
@he-yufeng
Copy link
Copy Markdown
Contributor Author

Rebased this onto current main and reran the focused checks.

Validation:

PYTHONUTF8=1 .\.venv\Scripts\python.exe -m pytest tests\unittests\flows\llm_flows\test_base_llm_flow.py -q --basetemp .tmp\pytest-5676-rebase
# 31 passed, 1 warning

PYTHONUTF8=1 .\.venv\Scripts\python.exe -m pyink src\google\adk\flows\llm_flows\base_llm_flow.py tests\unittests\flows\llm_flows\test_base_llm_flow.py --check
PYTHONUTF8=1 .\.venv\Scripts\python.exe -m py_compile src\google\adk\flows\llm_flows\base_llm_flow.py tests\unittests\flows\llm_flows\test_base_llm_flow.py
git diff --check upstream/main..HEAD

@he-yufeng he-yufeng force-pushed the fix/non-vertex-live-resumption branch from b4e1565 to 0d359a6 Compare May 23, 2026 21:16
@he-yufeng
Copy link
Copy Markdown
Contributor Author

Rebased onto current main again; no code changes beyond the rebase.\n\nValidation on Windows:\n- uv run --no-sync pytest tests\unittests\flows\llm_flows\test_base_llm_flow.py -q --basetemp .tmp\pytest-5676-20260524 -p no:cacheprovider -> 31 passed, 1 existing experimental warning\n- uv run --no-sync pyink --check src\google\adk\flows\llm_flows\base_llm_flow.py tests\unittests\flows\llm_flows\test_base_llm_flow.py\n- uv run --no-sync python -m py_compile src\google\adk\flows\llm_flows\base_llm_flow.py tests\unittests\flows\llm_flows\test_base_llm_flow.py\n- git diff --check upstream/main..HEAD

@he-yufeng
Copy link
Copy Markdown
Contributor Author

Rebased onto current main and force-pushed fe58e74. Local validation: py_compile passed; focused live reconnection regression test passed; pyink, isort, and git diff --check passed.

@he-yufeng he-yufeng force-pushed the fix/non-vertex-live-resumption branch from 0d359a6 to fe58e74 Compare May 27, 2026 10:22
@rohityan
Copy link
Copy Markdown
Collaborator

Hi @he-yufeng , could you please resolve the branch conflicts.

@he-yufeng he-yufeng force-pushed the fix/non-vertex-live-resumption branch from fe58e74 to d6a117f Compare May 30, 2026 07:30
@he-yufeng
Copy link
Copy Markdown
Contributor Author

Rebased onto current main and resolved the live resumption conflict. I kept upstream's Vertex-only transparent=True behavior and preserved this branch's existing-session-resumption regression coverage. Validation on Windows: uv run --no-sync pytest tests\unittests\flows\llm_flows\test_base_llm_flow.py -q --basetemp .tmp\pytest-5676-20260530 -p no:cacheprovider -> 35 passed, 5 warnings; uv run --no-sync pyink src\google\adk\flows\llm_flows\base_llm_flow.py tests\unittests\flows\llm_flows\test_base_llm_flow.py --check; uv run --no-sync python -m py_compile src\google\adk\flows\llm_flows\base_llm_flow.py tests\unittests\flows\llm_flows\test_base_llm_flow.py; git diff --check upstream/main..HEAD.

@he-yufeng he-yufeng force-pushed the fix/non-vertex-live-resumption branch from d6a117f to 018065a Compare June 4, 2026 03:54
@he-yufeng
Copy link
Copy Markdown
Contributor Author

Rebased onto current upstream/main again and fixed the pyink formatting drift in the touched test file.

Validation on Windows:

PYTHONUTF8=1 uv run --no-sync pytest tests\unittests\flows\llm_flows\test_base_llm_flow.py -q --basetemp .tmp\pytest-5676-20260604 -p no:cacheprovider
# 38 passed, 5 warnings

PYTHONUTF8=1 uv run --no-sync pyink src\google\adk\flows\llm_flows\base_llm_flow.py tests\unittests\flows\llm_flows\test_base_llm_flow.py --check
PYTHONUTF8=1 uv run --no-sync python -m py_compile src\google\adk\flows\llm_flows\base_llm_flow.py tests\unittests\flows\llm_flows\test_base_llm_flow.py
git diff --check upstream/main..HEAD

@he-yufeng he-yufeng force-pushed the fix/non-vertex-live-resumption branch from 018065a to 8fb354f Compare June 6, 2026 19:37
@he-yufeng
Copy link
Copy Markdown
Contributor Author

Rebased this branch onto current upstream/main and force-pushed the cleaned head.

Validation on Windows:

python -m py_compile src\google\adk\flows\llm_flows\base_llm_flow.py tests\unittests\flows\llm_flows\test_base_llm_flow.py
PYTHONUTF8=1 PYTHONPATH=src C:\dev\GITHUB-clean\adk-python\.venv\Scripts\python.exe -m pytest tests\unittests\flows\llm_flows\test_base_llm_flow.py -q --basetemp .tmp\pytest-5676-20260607 -p no:cacheprovider
# 38 passed, 5 warnings
PYTHONUTF8=1 uv run --no-sync pyink src\google\adk\flows\llm_flows\base_llm_flow.py tests\unittests\flows\llm_flows\test_base_llm_flow.py --check
# 2 files would be left unchanged
git diff --check upstream/main..HEAD

@adk-bot
Copy link
Copy Markdown
Collaborator

adk-bot commented Jun 6, 2026

I have completed a thorough, read-only analysis of Pull Request #5676 according to the established ADK triage principles.

The details have been compiled into a premium PR Analysis Report. Please review the artifact here:

  • analysis_results.md

Key Highlights of the Triage

  1. Google CLA Verification: Verified successfully. The contributor @he-yufeng has signed the Google CLA (cla/google status is SUCCESS).
  2. Problem & Root Cause: Fixes Issue #5675, which previously blocked live-session resumption on the direct Gemini API backend. BaseLlmFlow.run_live unconditionally overrode retry connections with transparent=True, causing a crash on the direct Gemini API backend since transparent resumption is only supported by Vertex AI.
  3. Elegant Implementation: Correctly scopes the transparent=True fallback only to the Vertex AI backend on line 544-555 of base_llm_flow.py.
  4. Testing & Validation: High-quality regression tests were added in test_base_llm_flow.py verifying behavior parity between both backends.
  5. Recommendation: Approve and Merge. No open architectural nits or style violations were found.

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

Labels

live [Component] This issue is related to live, voice and video chat 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.

Session resumption crashes on non-Vertex AI backend — blocks usage of Gemini 3.1 Flash Live

3 participants