a2aproject / a2aproject/a2a-tck
create_test_task helper requires WORKING state — all ListTasks tests fail on synchronous agents
- Ngôn ngữ chính
- Python
- Star
- 50
- Fork
- 40
- Merge trung bình
- 7 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 1
Mô tả
## Problem
The `create_test_task()` helper in `tests/mandatory/protocol/test_tasks_list_method.py` polls for WORKING state:
```python
while time.time() - start_time < max_wait_seconds:
current_state = get_task(task_id)
if current_state == 'TASK_STATE_WORKING':
return current_task
time.sleep(0.1)
raise AssertionError(f'Task {task_id} did not reach WORKING state within {max_wait_seconds} seconds.')
```
If the SUT agent processes tasks synchronously (SUBMITTED → COMPLETED in one shot), the task never passes through WORKING. The helper raises AssertionError and ALL 12+ ListTasks tests fail at setup — **before** even calling ListTasks.
## Root Cause
The helper assumes asynchronous agents. Synchronous agents are completely valid per spec. The spec says nothing about when a task must be in WORKING state.
## Impact
12 mandatory tests and 12+ optional tests all fail with:
```
AssertionError: Task did not reach WORKING state within 5 seconds. Last state: TASK_STATE_COMPLETED
```
This is a cascading false-negative — the tests don't even test ListTasks, they fail in the setup fixture.
## Repro
Run a v1.0 agent that completes tasks synchronously:
```bash
uv run pytest tests/mandatory/protocol/test_tasks_list_method.py --sut-url http://localhost:9997 -v
```
All tests fail with WORKING state assertion error, not with ListTasks-related errors.
## Fix
The helper should accept tasks in any valid state, or use a different mechanism to ensure tasks exist:
```python
def create_test_task(client, message):
resp = transport_send_message(client, ...)
task = resp['result']['task']
# Any state is acceptable — task was created
# Do NOT require WORKING state
return task
```
Alternatively, the tests should use a long-running message pattern (e.g., prefix `test-resubscribe-message-id`) to ensure the task stays in WORKING state.
## Spec Reference
A2A v1.0 spec has no requirement that ListTasks can only be called for tasks in WORKING state. `ListTasksResponse.tasks` includes tasks in any state.
## Note on Issue #141
Issue #141 claims the SDK doesn't return pagination fields. This is NOT the root cause. The SDK (1.0.0a0 `InMemoryTaskStore`) correctly returns `pageSize`, `totalSize`, and `nextPageToken`. The failures all come from this WORKING state assertion in the test helper.
Hướng dẫn đóng góp
Hướng nghiên cứu
Helper bị lỗi nằm trong `tests/mandatory/protocol/test_tasks_list_method.py`. Hãy xem hàm `create_test_task` và vòng lặp polling của nó. Cách sửa là thay đổi helper để chấp nhận các task ở bất kỳ trạng thái hợp lệ nào (như COMPLETED) thay vì yêu cầu WORKING. Chạy file test cụ thể bằng một agent đồng bộ để tái hiện lỗi, rồi sau khi thay đổi, xác minh rằng các test ListTests tiếp tục chạy qua bước setup.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Lĩnh vực
- testing-qa
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 70/100