HTTP+JSON CancelTask returns 409 Conflict instead of 400 Bad Request for TaskNotCancelableError
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 76/100
Rechercherichtung
Verfolge zunächst, wie der HTTP+JSON-Transport TaskNotCancelableError einem HTTP-Status zuordnet, und vergleiche diese Zuordnung anschließend mit der Fehlertabelle der Spezifikation in Abschnitt 3.3.2. Führe tests/compatibility/core_operations/test_task_lifecycle.py::TestCancelTask::test_cancel_terminal_task_returns_error[http_json] aus, um das Problem zu reproduzieren; erfolgreich ist der Test, wenn die Antwort HTTP 400 mit Code 400 und dem Grund TASK_NOT_CANCELABLE enthält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
When canceling a task that is already in a terminal state (TASK_STATE_COMPLETED), the HTTP+JSON transport returns 409 Conflict instead of 400 Bad Request as required by the A2A specification's error mapping table.
Requirement
- ID: CORE-CANCEL-002
- Section: 3.1.5 — CancelTask returns TaskNotCancelableError for terminal tasks
- Level: MUST
- Spec: https://github.com/a2aproject/A2A/blob/3303592588e388e62e0f69f701af531d2f4e3991/docs/specification.md#315-cancel-task
Specification
CancelTask MUST return TaskNotCancelableError when the task is not in a cancelable state (already completed, failed, or canceled).
The error mapping table in section 3.3.2 specifies:
| Error Name | JSON-RPC | gRPC | HTTP |
|---|---|---|---|
TaskNotCancelableError |
-32002 |
FAILED_PRECONDITION |
400 Bad Request |
Expected behavior
The HTTP+JSON transport should return HTTP status 400 Bad Request with an AIP-193 error body containing "code": 400 and an ErrorInfo detail with "reason": "TASK_NOT_CANCELABLE".
Actual behavior
The SUT returns HTTP 409 Conflict with "code": 409 and "status": "FAILED_PRECONDITION":
{
"error": {
"code": 409,
"status": "FAILED_PRECONDITION",
"message": "Task cannot be canceled - current state: TASK_STATE_COMPLETED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "TASK_NOT_CANCELABLE",
"domain": "a2a-protocol.org",
"metadata": {}
}
]
}
}
Note: The reason and error structure are correct — only the HTTP status code is wrong.
Reproducer
# 1. Create a task that completes immediately
TASK_ID=$(curl -s -X POST "http://localhost:9999/message:send" \
-H "Content-Type: application/json" \
-H "A2A-Version: 1.0" \
-d '{"message":{"role":"ROLE_USER","parts":[{"text":"TCK prerequisite task creation"}],"messageId":"tck-complete-task-repro"},"configuration":{"acceptedOutputModes":["text"]}}' \
| python3 -c "import sys,json; d=json.load(sys.stdin); print(d['task']['id'])")
# 2. Verify the task is completed
curl -s -X GET "http://localhost:9999/tasks/$TASK_ID" \
-H "A2A-Version: 1.0" \
| python3 -c "import sys,json; d=json.load(sys.stdin); print(d['status']['state'])"
# → TASK_STATE_COMPLETED
# 3. Attempt to cancel the completed task (expect 400, get 409)
curl -s -w "\nHTTP Status: %{http_code}\n" -X POST "http://localhost:9999/tasks/$TASK_ID:cancel" \
-H "A2A-Version: 1.0"
# → HTTP Status: 409 (should be 400)
TCK test
tests/compatibility/core_operations/test_task_lifecycle.py::TestCancelTask::test_cancel_terminal_task_returns_error[http_json]
- Vorherrschende Sprache
- Java
- Sterne
- 510
- Forks
- 196
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 57
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus a2aproject/a2a-java
-
fix: handle blank push notification config id consistently across transportsEvtl. vergeben @prachisinghal-1 hat das vor 15 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
a2aproject/a2a-java#1012 · 2 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
a2aproject/a2a-java#464 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Create a sample that demonstrates how to use a shared contextId across multiple tasksEvtl. wieder frei @tanish111 hat das vor 382 Tagen übernommen, und es ist kein Pull Request offen. Offensample
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
a2aproject/a2a-java#375 · 5 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
a2aproject/a2a-java#1299 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Task state transitions are not trackedEvtl. wieder frei @sumitvairagar hat das vor 21 Tagen übernommen, und es ist kein Pull Request offen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
a2aproject/a2a-java#1222 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in a2aproject/a2a-java
Ähnliche Issues
-
getRawTextContent() returns the lines of every page in reverse order (bottom to top) since 4.0.3Offen
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 90/100
-
bug subsystem:agent-harness triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
ShaftHQ/SHAFT_ENGINE#7797 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
NationalSecurityAgency/ghidra#10155 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
area:data coverage
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 67/100
reacher-z/Awesome-CUA#4864 ·
Maintainer antworten meist innerhalb von 19 Tagen
-
bug web-ui
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
jenkinsci/jenkins#27705 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag