You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add an explicit language-anchor requirement to the default LlmEventSummarizer prompt
preserve the conversation language and response-language convention when they are evident from the compacted history
add a regression test covering an English user turn followed by a foreign-language tool response
Why
The issue reports long-lived sessions drifting to another language after repeated event compaction plus large retrieved tool payloads. This is a narrow prompt-contract mitigation: it makes the compaction summary request preserve the conversation language signal instead of producing a language-neutral summary that later turns can overrun.
This does not claim to fully solve every long-context language drift case; it only hardens the default summarizer behavior at the compaction boundary.
Verification
RED: uv run --extra test pytest tests/unittests/apps/test_llm_event_summarizer.py::TestLlmEventSummarizer::test_default_prompt_preserves_conversation_language_anchor -q failed before the prompt change because the default prompt lacked the language-anchor instruction
GREEN: uv run --extra test pytest tests/unittests/apps/test_llm_event_summarizer.py::TestLlmEventSummarizer::test_default_prompt_preserves_conversation_language_anchor -q
uv run --extra test pytest tests/unittests/apps/test_llm_event_summarizer.py -q
uv run --extra dev ruff check src/google/adk/apps/llm_event_summarizer.py tests/unittests/apps/test_llm_event_summarizer.py
uv run --extra dev pyink --check src/google/adk/apps/llm_event_summarizer.py tests/unittests/apps/test_llm_event_summarizer.py
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).
Hi @Sehlani042 , Thank you for your contribution! We appreciate you taking the time to submit this pull request.
While this PR cleanly addresses the language drift aspect, another pull request #6329 was submitted shortly after that implements structured CRITICAL INSTRUCTIONS headers to solve both the language drift and the tool grounding loss in a single prompt update.
To ensure we completely cover both aspects of Issue #6273 with structured metadata anchors, we are going to consolidate the resolution into #6329 and close this PR as superseded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
core[Component] This issue is related to the core interface and implementation
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #6273
Summary
LlmEventSummarizerpromptWhy
The issue reports long-lived sessions drifting to another language after repeated event compaction plus large retrieved tool payloads. This is a narrow prompt-contract mitigation: it makes the compaction summary request preserve the conversation language signal instead of producing a language-neutral summary that later turns can overrun.
This does not claim to fully solve every long-context language drift case; it only hardens the default summarizer behavior at the compaction boundary.
Verification
uv run --extra test pytest tests/unittests/apps/test_llm_event_summarizer.py::TestLlmEventSummarizer::test_default_prompt_preserves_conversation_language_anchor -qfailed before the prompt change because the default prompt lacked the language-anchor instructionuv run --extra test pytest tests/unittests/apps/test_llm_event_summarizer.py::TestLlmEventSummarizer::test_default_prompt_preserves_conversation_language_anchor -quv run --extra test pytest tests/unittests/apps/test_llm_event_summarizer.py -quv run --extra dev ruff check src/google/adk/apps/llm_event_summarizer.py tests/unittests/apps/test_llm_event_summarizer.pyuv run --extra dev pyink --check src/google/adk/apps/llm_event_summarizer.py tests/unittests/apps/test_llm_event_summarizer.pygit diff --check