Repository navigation
fix: Drop the whole AFC exchange from curated chat history when the final model turn is invalid - #3315
Open
copybara-service[bot] wants to merge 1 commit into
Open
fix: Drop the whole AFC exchange from curated chat history when the final model turn is invalid#3315copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
copybara-service
Bot
force-pushed
the
copybara/1016479900
branch
from
November 8, 2026 01:28
0c48891 to
1ffa74f
Compare
chrikrah
reviewed
Nov 8, 2026
chrikrah
left a comment
There was a problem hiding this comment.
The live AFC half fixes #3314. The rebuild half, which I asked for there, splits from the live path.
# git archive 1ffa74f (base afb10e8), uv venv, Python 3.12, genai.__file__ printed per tree
$ python -I afc_tail.py # the script from #3314
afb10e8 curated: ['user:text', 'model:function_call']
1ffa74f curated: []
$ python -m pytest google/genai/tests/chats/test_get_history.py -q
27 passed in 0.11s # 1ffa74f
7 failed, 20 passed in 0.29s # chats.py from afb10e8, tests kept
# not run: the replay tests in tests/chats, which need credentials
non-blocking: a stored history can't tell AFC from manual calls. Send a function_response by hand, get a blocked answer, and only the rebuild drops the call:
$ python -I manual_fc.py # FunctionDeclaration tool, send_message(Part.from_function_response(...)), SAFETY reply
afb10e8 live: ['user:text', 'model:function_call'] rebuilt via chats.create(history=...): same
1ffa74f live: ['user:text', 'model:function_call'] rebuilt via chats.create(history=...): []
The caller can resend that response, and 2580638 ends turns on a call on purpose. My pick: drop _drop_rejected_input and its hand-built test and accept the #3314 tail on a restored AFC history. Or should the live manual path drop the call too?
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fix: Drop the whole AFC exchange from curated chat history when the final model turn is invalid
fixes #3314
FUTURE_COPYBARA_INTEGRATE_REVIEW=#3249 from googleapis:release-please--branches--main 4b4b0f3