-
Notifications
You must be signed in to change notification settings - Fork 140
Description
What happened?
Summary
When SendMessage includes a taskId that does not correspond to an existing task, the SUT creates a new task using the provided taskId instead of returning TaskNotFoundError. This affects all three transports.
Additionally, the status message in the response contains empty contextId and taskId fields, which should either be omitted or populated.
Requirement
- ID: CORE-MULTI-004, CORE-SEND-002 (parametrized test only)
- Section: 3.4.2 — Task Identifier Semantics
- Level: MUST
- Spec: https://github.com/a2aproject/A2A/blob/173695755607e884aa9acf8ce4feed90e32727a1/docs/specification.md#342-task-identifier-semantics
Specification
When a client includes a
taskIdin a Message, it MUST reference an existing task.
Agents MUST return aTaskNotFoundErrorif the providedtaskIddoes not correspond to an existing task.
Client-providedtaskIdvalues for creating new tasks is NOT supported.
Expected behavior
SendMessage with a non-existent taskId should return TaskNotFoundError:
- JSON-RPC: error code
-32001 - gRPC: status
NOT_FOUND - HTTP+JSON: status
404 Not Found
Actual behavior
The SUT creates a new task using the client-provided taskId, processes it (reaching TASK_STATE_COMPLETED), and returns success. The status message in the response also contains empty contextId and taskId fields:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"task": {
"id": "does-not-exist-99999",
"contextId": "b37f0cf9-5daf-4e98-a9d8-c05e1cb54eea",
"status": {
"state": "TASK_STATE_COMPLETED",
"message": {
"messageId": "30714123-0f06-477a-a81f-239fb97e1b5b",
"contextId": "",
"taskId": "",
"role": "ROLE_AGENT",
"parts": [{"text": "Unhandled messageId prefix: test-repro-001"}],
...
}
}
}
}
}On subsequent calls with the same taskId, it returns UnsupportedOperationError because the task is now terminal.
Reproducer
# Send a message with a nonexistent taskId
# Expected: TaskNotFoundError (-32001)
# Actual: SUT creates a new task with the client-provided taskId and returns success
curl -s -X POST http://localhost:9999/ \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":"1","method":"SendMessage","params":{"message":{"messageId":"test-repro-001","taskId":"does-not-exist-99999","role":"ROLE_USER","parts":[{"text":"Hello"}]}}}'
# Response: 200 OK with task created using id "does-not-exist-99999"
# - task.status.message.contextId is empty ("")
# - task.status.message.taskId is empty ("")
# Expected: {"jsonrpc":"2.0","id":1,"error":{"code":-32001,"message":"Task not found"}}TCK test
tests/compatibility/core_operations/test_requirements.py::test_must_requirement[CORE-MULTI-004-grpc]
tests/compatibility/core_operations/test_requirements.py::test_must_requirement[CORE-MULTI-004-jsonrpc]
tests/compatibility/core_operations/test_requirements.py::test_must_requirement[CORE-MULTI-004-http_json]
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct