Commit 89f9491
fix(webhooks): add canceled/rejected/auth-required to A2A status map; fail fast on unknowns (#606)
Closes #603.
create_a2a_webhook_payload silently fell back to TASK_STATE_UNSPECIFIED
(proto3 integer 0) for any AdCP status not in the lookup map — canceled,
rejected, auth_required, and any genuinely unknown value. MessageToDict
omits proto3 zero-value fields entirely, so the wire shape became
``{"status": {}}`` with no ``state`` field. A2A v0.3 receivers that
validate against the schema reject this as a missing required field.
Changes:
- Add canceled, rejected, auth_required/auth-required to
adcp_to_task_state (each has a valid pb.TaskState constant).
- Raise ValueError for any unmapped status value with a directional
message naming the eight valid states. ``unknown`` has no a2a-sdk 1.0
protobuf constant, so it is explicitly rejected; callers needing
that wire state should build a Task manually and pass it through
to_wire_dict.
- Expand is_terminated to include canceled and rejected — both are
terminal states per A2A v0.3, returning Task with artifacts rather
than TaskStatusUpdateEvent.
- Tighten status.value access (no string fallback) — the function
signature is GeneratedTaskStatus and the docstring contract is enum
members.
- Update stale docstrings in create_a2a_webhook_payload and
extract_webhook_result_data to list all four terminal states.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 37d2cda commit 89f9491
3 files changed
Lines changed: 141 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
371 | | - | |
| 371 | + | |
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| |||
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
508 | | - | |
509 | | - | |
510 | | - | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
511 | 512 | | |
512 | 513 | | |
513 | 514 | | |
| |||
564 | 565 | | |
565 | 566 | | |
566 | 567 | | |
567 | | - | |
| 568 | + | |
| 569 | + | |
568 | 570 | | |
569 | 571 | | |
570 | 572 | | |
| 573 | + | |
| 574 | + | |
571 | 575 | | |
572 | 576 | | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
573 | 580 | | |
574 | | - | |
575 | 581 | | |
| 582 | + | |
| 583 | + | |
576 | 584 | | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
583 | 602 | | |
584 | | - | |
585 | | - | |
586 | | - | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
587 | 608 | | |
588 | | - | |
589 | 609 | | |
590 | 610 | | |
591 | 611 | | |
| |||
600 | 620 | | |
601 | 621 | | |
602 | 622 | | |
603 | | - | |
604 | | - | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
605 | 631 | | |
606 | 632 | | |
607 | 633 | | |
| |||
1111 | 1137 | | |
1112 | 1138 | | |
1113 | 1139 | | |
1114 | | - | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
1115 | 1143 | | |
1116 | 1144 | | |
1117 | 1145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
0 commit comments