Repository navigation
Description
What happened?
Summary
When SendMessage is called with configuration.historyLength set to 0, the a2a-java SDK still includes the user's message in the history array of the response task. This fails on all three transports (JSON-RPC, gRPC, HTTP+JSON).
Requirement
- ID: CORE-HIST-003
- Section: 3.2.4 — History Length Semantics
- Level: SHOULD
- Spec: https://github.com/a2aproject/A2A/blob/173695755607e884aa9acf8ce4feed90e32727a1/docs/specification.md#324-history-length-semantics
Specification
The
historyLengthparameter appears in multiple operations and controls how much task history is returned in responses. This parameter follows consistent semantics across all operations:
- 0: No history should be returned; the
historyfield SHOULD be omitted
Expected behavior
When SendMessage is called with configuration.historyLength set to 0, the response task should have no history field, or an empty history array.
Actual behavior
The response task includes the user's message in the history array (1 message), ignoring the historyLength=0 configuration.
Reproducer
# Step 1: Create a task in input_required state
RESP=$(curl -s -X POST http://localhost:9999/ \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":"1","method":"SendMessage","params":{"message":{"messageId":"tck-input-required-repro","role":"ROLE_USER","parts":[{"text":"Hello"}]}}}')
TASK_ID=$(echo "$RESP" | python3 -c "import sys,json; print(json.load(sys.stdin)['result']['task']['id'])")
# Step 2: Send follow-up with historyLength=0
# Expected: history should be empty or omitted
# Actual: history contains 1 message
curl -s -X POST http://localhost:9999/ \
-H 'Content-Type: application/json' \
-d "{\"jsonrpc\":\"2.0\",\"id\":\"2\",\"method\":\"SendMessage\",\"params\":{\"message\":{\"messageId\":\"tck-complete-task-repro\",\"role\":\"ROLE_USER\",\"parts\":[{\"text\":\"Follow-up\"}],\"taskId\":\"$TASK_ID\"},\"configuration\":{\"historyLength\":0}}}" | python3 -m json.toolTCK test
tests/compatibility/core_operations/test_task_history.py::TestHistoryLengthZeroSendMessage::test_send_message_history_length_zero[jsonrpc]
tests/compatibility/core_operations/test_task_history.py::TestHistoryLengthZeroSendMessage::test_send_message_history_length_zero[grpc]
tests/compatibility/core_operations/test_task_history.py::TestHistoryLengthZeroSendMessage::test_send_message_history_length_zero[http_json]
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
fix: Apply historyLength from MessageSendConfiguration in SendMessage…
fix: Apply historyLength from MessageSendConfiguration in SendMessage…
fix: Apply historyLength from MessageSendConfiguration in SendMessage…
wushunhao commentedon Jun 30, 2026
Hello, did this also fix for sendStreamingMessage?