Skip to content

[Bug]: SendMessage ignores historyLength=0 — returns history when none was requested #816

Closed

Description

@jmesnil

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

Specification

The historyLength parameter 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 history field 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.tool

TCK 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

  1. added this to the 1.0.0 milestone on Apr 28, 2026
  2. self-assigned this
    on Apr 28, 2026
  3. added
    compatibility
    on Apr 28, 2026
  4. added a commit that references this issue on Apr 28, 2026
    17a29be
  5. added a commit that references this issue on Apr 29, 2026
    925aedb
  6. added a commit that references this issue on Jun 19, 2026
    13eebe7
  7. wushunhao commented on Jun 30, 2026

    @wushunhao

    Hello, did this also fix for sendStreamingMessage?

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

Metadata

Metadata

Assignees

Labels

compatibility

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions