Skip to content

fix: gracefully handle missing function calls during context compaction#496

Merged
kalenkevich merged 2 commits into
google:mainfrom
AmaadMartin:bugfix-compacted-function-responses
Jul 15, 2026
Merged

fix: gracefully handle missing function calls during context compaction#496
kalenkevich merged 2 commits into
google:mainfrom
AmaadMartin:bugfix-compacted-function-responses

Conversation

@AmaadMartin

Copy link
Copy Markdown
Collaborator

This fixes an integration test regression introduced in PR #430 where a newly tightened safety check around functionResponse matching causes a crash if context compaction executes and strips away the parent functionCall from the history. By returning events.slice(0, -1), we gracefully ignore the orphaned response instead of throwing a fatal error.

@kalenkevich
kalenkevich merged commit da24221 into google:main Jul 15, 2026
12 checks passed

@ScottMansfield ScottMansfield left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems dangerous to remove a thrown error and just silently drop function events. Instead of fixing the new compaction here, the compaction should properly adjust history so it does not happen.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants