镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

fix(compat): get a v0.3 push config by task id alone - #1380

Merged
mykytanetipa merged 3 commits into
a2aproject:mainfrom
ConnorMoss02:fix/v03-push-config-get-by-task-id
Oct 30, 2026
Merged

mykytanetipa merged 3 commits into
a2aproject:mainfrom
ConnorMoss02:fix/v03-push-config-get-by-task-id

Conversation

@ConnorMoss02

@ConnorMoss02 ConnorMoss02 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A v0.3 pushNotificationConfig/get with only a task id failed validation, because the v1.0 request had no config id.

Fix

When no config id is given, list the task's configs and return the one stored under the task id, otherwise the first. This matches v0.3.

Tests

test_on_get_task_push_notification_config_by_task_id runs through DefaultRequestHandlerV2 and InMemoryPushNotificationConfigStore. It covers a set with and without an id and fails on main. 2329 passed.

Fixes #1379

@ConnorMoss02
ConnorMoss02 requested a review from a team as a code owner October 26, 2026 03:03
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/compat/v0_3/request_handler.py 96.97% 97.40% 🟢 +0.43%
Total 93.42% 93.42% 🟢 +0.01%

Generated by coverage-comment.yml

@mykytanetipa mykytanetipa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only fixes configs that were created without an id. v0.3 clients can also set their own config id, and then get by task id alone still fails:

set:  {"taskId": "task-1", "pushNotificationConfig": {"id": "cfg-1", "url": "https://..."}}
get:  {"id": "task-1"}

The get looks up config "task-1", finds nothing, and the v1.0 handler raises TaskNotFoundError even though the task exists. v0.3.26 returned the task's first config here.

When no id is given, list the task's configs instead. Prefer the one stored under the task id, otherwise take the first:

if not v10_req.id:
    resp = await self.request_handler.on_list_task_push_notification_configs(
        ListTaskPushNotificationConfigsRequest(task_id=v10_req.task_id),
        context,
    )
    configs = list(resp.configs)
    chosen = next(
        (c for c in configs if c.id == v10_req.task_id),
        configs[0] if configs else None,
    )
    if chosen is None:
        raise TaskNotFoundError
    return conversions.to_compat_task_push_notification_config(chosen)

Please also add a test that goes through DefaultRequestHandlerV2 with InMemoryPushNotificationConfigStore, covering set with and without an id. The current test mocks the core handler, so it doesn't catch this.

@ConnorMoss02

Copy link
Copy Markdown
Contributor Author

Thanks, you're right. It now lists the task's configs when no id is given and prefers the one stored under the task id, otherwise the first. Swapped the mocked test for one through DefaultRequestHandlerV2 and InMemoryPushNotificationConfigStore that covers set with and without an id.

@mykytanetipa
mykytanetipa merged commit aa8e966 into a2aproject:main Oct 30, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v0.3 pushNotificationConfig/get by task id fails with Validation failed

2 participants