Skip to content

fix(webhooks): reject unknown AdCP status in create_a2a_webhook_payload#605

Merged
bokelley merged 1 commit intomainfrom
bokelley/a2a-task-state-unknown
May 8, 2026
Merged

fix(webhooks): reject unknown AdCP status in create_a2a_webhook_payload#605
bokelley merged 1 commit intomainfrom
bokelley/a2a-task-state-unknown

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

@bokelley bokelley commented May 8, 2026

Closes #603.

Summary

  • create_a2a_webhook_payload previously fell back to TASK_STATE_UNSPECIFIED for any AdCP status not in its mapping table. _normalize_a2a_task_state_to_v03 then rewrote that to "unspecified" on the wire — not a valid A2A v0.3 TaskState, so buyer receivers validating against the schema reject the webhook mid-delivery.
  • Now raises ValueError at the builder boundary with the closed list of valid statuses. The AdCP→A2A mapping is closed; an unknown value is always a caller bug.
  • One new test in tests/test_webhooks_to_wire_dict.py asserts the new failure path.

Test plan

  • New test_a2a_unknown_status_raises_value_error covers the failure path.
  • Full unit suite: 3767 passed, 17 skipped, 1 xfailed — no regressions from this builder change.
  • ruff check + mypy clean.

🤖 Generated with Claude Code

The builder previously fell back to ``TASK_STATE_UNSPECIFIED`` when the
caller's status didn't match the AdCP→A2A mapping table. The wire
normalizer then rewrote that to the literal string ``"unspecified"``,
which is not a valid A2A v0.3 ``TaskState`` (the spec enum is submitted
| working | input-required | completed | canceled | failed | rejected
| auth-required | unknown). Buyer receivers validating against the
schema reject the webhook — silent wire-level breakage.

Raise ``ValueError`` at the builder boundary instead. The AdCP→A2A
mapping is closed, so an unknown value is always a caller bug; failing
loud beats producing a payload buyers will reject mid-delivery.

Closes #603.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley bokelley merged commit 37d2cda into main May 8, 2026
16 checks passed
@bokelley bokelley deleted the bokelley/a2a-task-state-unknown branch May 8, 2026 19:09
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.

A2A webhook builder emits invalid 'unspecified' state when status is unknown

1 participant