fix: apply historyLength to SendStreamingMessage responses#983
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements task history limiting in the streaming message path within DefaultRequestHandler and adds a corresponding integration test to verify that setting historyLength to zero returns an empty history. A review comment points out a potential bug in the underlying limitTaskHistory method where a negative historyLength (representing unlimited history) can cause an IllegalArgumentException due to out-of-bounds indices in subList. It is recommended to update limitTaskHistory to safely handle negative values.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
The streaming path (onMessageSendStream) was not applying limitTaskHistory to Task events, causing historyLength to be silently ignored for streaming calls. Added the same limitTaskHistory call used in the non-streaming path to the streaming subscriber's onNext method. This fixes a2aproject#982 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The streaming path (onMessageSendStream) was not applying limitTaskHistory to Task events, causing historyLength to be silently ignored for streaming calls. Added the same limitTaskHistory call used in the non-streaming path to the streaming subscriber's onNext method.
This fixes #982