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
Legacy handler ignores history_length on message/stream #1363
With the legacy request handler, message/stream with history_length=0 still returns the full history on Task events, and history_length=-1 is not rejected. message/send trims and rejects both correctly.
Why
LegacyRequestHandler.on_message_send calls validate_history_length and apply_history_length (default_request_handler.py), but on_message_send_stream calls neither. The v2 handler already applies it on streams.
Hi @ConnorMoss02, thanks for reporting this and opening the fix PR #1364. Your approach for the fix looks correct.
In src/a2a/server/request_handlers/default_request_handler.py, LegacyRequestHandler.on_message_send_stream fails to validate history_length at request start and never truncates task.history on emitted Task events via apply_history_length. As a result, negative values are not rejected, and streamed tasks return their full history regardless of configuration.
Assigning this issue to you until the PR is reviewed. Meanwhile, clients can manually slice task.history[-history_length:] if history_length > 0 else [] on received Task objects and guard outbound requests against negative history_length values.
Activity
rohityan commentedon Oct 22, 2026
Hi @ConnorMoss02, thanks for reporting this and opening the fix PR #1364. Your approach for the fix looks correct.
In
src/a2a/server/request_handlers/default_request_handler.py,LegacyRequestHandler.on_message_send_streamfails to validatehistory_lengthat request start and never truncatestask.historyon emittedTaskevents viaapply_history_length. As a result, negative values are not rejected, and streamed tasks return their full history regardless of configuration.Assigning this issue to you until the PR is reviewed. Meanwhile, clients can manually slice
task.history[-history_length:] if history_length > 0 else []on receivedTaskobjects and guard outbound requests against negativehistory_lengthvalues.fix(server): apply history_length to legacy streaming sends (a2aproje…