Conversation
d2daf84 to
ac598ec
Compare
Contributor
Author
|
Rebased on main now that #605 is merged. Reconciled the following:
3771 unit tests pass; ruff + mypy clean. |
Contributor
Author
|
Thanks for the reconciliation notes — the rebase decisions look sound. Keeping the Generated by Claude Code |
ac598ec to
37d2cda
Compare
Contributor
Author
|
Acknowledged — thanks for the sign-off, @bokelley. _Generated by Claude Code Generated by Claude Code |
… fail fast on unknowns 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #603
Summary
create_a2a_webhook_payloadsilently fell back toTASK_STATE_UNSPECIFIED(proto3 integer 0) for any status not in the lookup map —canceled,rejected,auth_required, and any genuinely unknown value.MessageToDictomits proto3 zero-value fields entirely, so the wire shape became{"status": {}}with nostatefield. A2A v0.3 receivers that validate against the schema reject this as a missing required field.Changes:
canceled,rejected,auth_required/auth-requiredtoadcp_to_task_state(each has a validpb.TaskStateconstant)ValueErrorfor any unmapped status value (fail-closed;unknownmaps toTASK_STATE_UNSPECIFIEDwhich produces an invalid wire shape, so it is explicitly rejected with a diagnostic message)is_terminatedto includecanceledandrejected— both are terminal states per A2A v0.3, returningTaskwithartifactsrather thanTaskStatusUpdateEventmypy no-any-returnon_payload_to_dict(cast())create_a2a_webhook_payloadandextract_webhook_result_datato list all four terminal statesTASK_STATE_UNSPECIFIED(0) is the proto3 default and is silently omitted byMessageToDict, so it never reaches the normalization branchNot in scope (noted by issue author):
_normalize_a2a_task_state_to_v03spec-walking gap forTask.artifacts[].parts[]— protocol expert confirmed there are noMessage.rolefields nested inside artifact parts in the current A2A proto schema, so no normalization gap exists there.What tested
ruff check src/adcp/webhooks.py tests/test_a2a_webhook_payload.py— cleanmypy src/adcp/webhooks.py— no issues (also fixes pre-existing error)pytest tests/test_a2a_webhook_payload.py tests/test_webhooks_deliver.py tests/test_webhook_handling.py— 141 passed, 15 skippedNew tests (
tests/test_a2a_webhook_payload.py):test_canceled_returns_task_with_canceled_state—canceled→Task+"canceled"wire statetest_rejected_returns_task_with_rejected_state—rejected→Task+"rejected"wire statetest_auth_required_returns_event_with_auth_required_state—auth_required→TaskStatusUpdateEvent+"auth-required"wire statetest_unknown_status_value_raises_value_errortest_unknown_status_error_message_names_known_statesPre-PR review:
Session: https://claude.ai/code/session_01S9cLUGz9Ws7FKqbeLUXxrA
Generated by Claude Code