Skip to content

Commit e2fcb70

Browse files
Update src/a2a/utils/task.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 3eb4bf6 commit e2fcb70

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/a2a/utils/task.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,15 @@ def apply_history_length(
108108
Returns:
109109
A new task object with limited history
110110
"""
111-
if config is None:
111+
if config is None or not config.HasField('history_length'):
112112
return task
113113

114114
# See https://a2a-protocol.org/latest/specification/#324-history-length-semantics
115-
116-
if not config.HasField('history_length'):
117-
return task
118-
119115
history_length = config.history_length
120116

121117
if history_length == 0:
118+
if not task.history:
119+
return task
122120
task_copy = Task()
123121
task_copy.CopyFrom(task)
124122
task_copy.ClearField('history')

0 commit comments

Comments
 (0)