fix(flows): drop unpairable trailing FRs in rearrange - #6752
Open
a2105z wants to merge 1 commit into
Open
Conversation
The id-based orphan prune left rearrange raising on id-less/empty-id trailing responses and on unmatched extras, which still poisoned sessions.
This was referenced Aug 16, 2026
Contributor
Author
|
Hi @GWeale @DeanChensj @llalitkumarrr — this is the follow-up from #6587. After Ready for review whenever you have a chance — thank you! |
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.
Summary
Follow-up to the orphan-FR prune that landed in
73e8625/ discussion on #6587._drop_orphaned_function_responsesonly removes responses that carry an id. Trailing id-less / empty-id FRs, and rearrange itself when the prune is bypassed, could still raise during contents assembly and permanently poison the session.This change:
_rearrange_events_for_latest_function_responsedrop unpairable trailing FRs instead of raising (defense in depth requested on fix(flows): Drop orphaned FRs instead of poisoning sessions #6587)ValueError)Fixes #6751
Related: #6582, #6587
Test plan
uv run pytest tests/unittests/flows/llm_flows/test_contents_function.py tests/unittests/flows/llm_flows/test_contents.py -q→ 56 passedid=None,id="", multi trailing id-less, rearrange bypass, unmatched extras) no longer raise