HTTP+JSON CancelTask returns 409 Conflict instead of 400 Bad Request for TaskNotCancelableError

オープン 初心者向け
#1,298 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java
領域
api

調査の方向性

まず、HTTP+JSONトランスポートがTaskNotCancelableErrorをどのようにHTTPステータスに対応付けているかをたどり、その対応付けを仕様の3.3.2節にあるエラーテーブルと比較します。問題を再現するには tests/compatibility/core_operations/test_task_lifecycle.py::TestCancelTask::test_cancel_terminal_task_returns_error[http_json] を実行します。期待される結果は、コード400、理由TASK_NOT_CANCELABLEを含むHTTP 400のレスポンスです。

索引モデルが issue の本文から書いたものです。

説明

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

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]

主要言語
Java
スター
510
フォーク
196
平均マージ
2日 4時間
マージ済み PR(30日)
57

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

a2aproject/a2a-java のほかの issue

a2aproject/a2a-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。