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
{{ message }}
Repository navigation
contents rearrange still raises on id-less / unmatched trailing function responses (follow-up to orphan FR prune) #6751
#6582 / 73e8625 added _drop_orphaned_function_responses, which correctly prunes id'd function responses with no matching function call before contents assembly.
Two gaps remain and can still permanently poison a session (raise happens in request preprocessing, before any user callback):
_rearrange_events_for_latest_function_response still raisesValueError: No function call event found for function responses ids: ... when it cannot pair the trailing FR event. @GWeale noted on #6587 that this rearrange-path drop is still worth having as defense in depth (main only prunes responses that carry an id).
Id-less / empty-id trailing FRs are intentionally skipped by the prune helper (if response.id), but then rearrange adds None / '' into the id set and raises — so sessions with stripped or missing FR ids still die on the next turn.
Related hole: when rearrange finds a matching FC event but the trailing FR event also carries unmatched ids (Last response event should only contain the responses...), it still raises instead of dropping the unmatched parts.
@a2105z The id=None trailing response slips past the orphan-prune's if response.id check and blows up in rearrange exactly as you traced.
Tried the same drop-unpairable-trailing-FRs approach and it resolved cleanly here, id-less pairs and unmatched-extras included. #6752 looks like it's built the same way, could you confirm it holds against your original edge cases before this goes up for merge?
trailing id=None after valid FC/FR history (the prune slip you called out)
trailing empty-string id
multiple consecutive id-less trailing FRs
id’d orphan via the existing prune path
rearrange defense-in-depth when prune is bypassed
unmatched extras on a matched call event (strip, don’t raise)
id-less adjacent FC/FR pair still kept (stripped-id model families)
prior valid history preserved after dropping a trailing id-less orphan
All 8 held, plus pytest tests/unittests/flows/llm_flows/test_contents_function.py tests/unittests/flows/llm_flows/test_contents.py → 56 passed. No further changes needed on this branch from what I can see.
Hi maintainers — could someone take another look when you have a moment, and drop the request clarification label?
@surajksharma07 asked last week to confirm #6752 against the original edge cases before this goes up for merge. That confirmation is already on this thread (the 8 cases plus pytest tests/unittests/flows/llm_flows/test_contents_function.py tests/unittests/flows/llm_flows/test_contents.py → 56 passed). Nothing else is outstanding from the author side.
This is the rearrange-path follow-up @GWeale requested on #6587: id-less / unmatched trailing FRs still raise after the id-only orphan prune and can poison the session.
@a2105z That covers exactly what I asked for. Re-checked #6752's diff too, the new drop-unmatched-trailing-FR helper plus the id-less-pair carve-out matches your description cleanly and the underlying raise is still live on current main so this is still needed.
Dropping request clarification, over to @DeanChensj / @GWeale for a merge look, nothing further needed from your side.
Activity
a2105z commentedon Aug 16, 2026
Taking this — follow-up PR: #6752
surajksharma07 commentedon Aug 17, 2026
@a2105z The id=None trailing response slips past the orphan-prune's if response.id check and blows up in rearrange exactly as you traced.
Tried the same drop-unpairable-trailing-FRs approach and it resolved cleanly here, id-less pairs and unmatched-extras included.
#6752 looks like it's built the same way, could you confirm it holds against your original edge cases before this goes up for merge?
a2105z commentedon Aug 17, 2026
@surajksharma07 Thanks for double-checking — confirmed locally against #6752.
Re-ran the original edge cases on the PR branch:
id=Noneafter valid FC/FR history (the prune slip you called out)All 8 held, plus
pytest tests/unittests/flows/llm_flows/test_contents_function.py tests/unittests/flows/llm_flows/test_contents.py→ 56 passed. No further changes needed on this branch from what I can see.a2105z commentedon Aug 26, 2026
Hi maintainers — could someone take another look when you have a moment, and drop the
request clarificationlabel?@surajksharma07 asked last week to confirm #6752 against the original edge cases before this goes up for merge. That confirmation is already on this thread (the 8 cases plus
pytest tests/unittests/flows/llm_flows/test_contents_function.py tests/unittests/flows/llm_flows/test_contents.py→ 56 passed). Nothing else is outstanding from the author side.This is the rearrange-path follow-up @GWeale requested on #6587: id-less / unmatched trailing FRs still raise after the id-only orphan prune and can poison the session.
PR: #6752
cc @GWeale @wuliang229 @DeanChensj @surajksharma07
surajksharma07 commentedon Aug 27, 2026
@a2105z That covers exactly what I asked for. Re-checked #6752's diff too, the new drop-unmatched-trailing-FR helper plus the id-less-pair carve-out matches your description cleanly and the underlying raise is still live on current main so this is still needed.
Dropping request clarification, over to @DeanChensj / @GWeale for a merge look, nothing further needed from your side.
fix: drop unpairable trailing FRs in rearrange
fix(plugins): record error-bearing tool results as TOOL_ERROR in BigQ…
fix(plugins): record content_formatter failure class in BigQuery anal…