Skip to content

feat(server): add opt-in rejection of requests missing a required extension - #1482

Open
ConnorMoss02 wants to merge 1 commit into
a2aproject:mainfrom
ConnorMoss02:feat/required-extensions
Open

ConnorMoss02 wants to merge 1 commit into
a2aproject:mainfrom
ConnorMoss02:feat/required-extensions

Conversation

@ConnorMoss02

Copy link
Copy Markdown
Contributor

Fixes #1467

Adds validate_required_extensions to DefaultRequestHandler and the legacy handler, next to validate_input_modes (#1269). When it's on, a send or stream whose A2A-Extensions header leaves out an extension the card marks required raises ExtensionSupportRequiredError (spec §3.3.4), before the executor runs. It's off by default so existing servers don't start refusing traffic.

End to end with the flag on, a request without the header is rejected over JSON-RPC (-32008), REST (400) and gRPC (FAILED_PRECONDITION), and the same request with the header goes through. v0.3 clients are rejected too, but v0.3 has no code for this error, so JSON-RPC reports it as an internal error.

The new tests in test_extension_validator.py and both handler test files fail on main. tests/ passes apart from the cross-version tests, which fail the same way on main here.

@github-actions

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/server/request_handlers/default_request_handler.py 97.99% 98.02% 🟢 +0.03%
src/a2a/server/request_handlers/default_request_handler_v2.py 88.78% 88.92% 🟢 +0.14%
src/a2a/utils/extension_validator.py (new) — 100.00% —
Total 93.67% 93.68% 🟢 +0.01%

Generated by coverage-comment.yml

This branch has not been deployed

No deployments
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.

Required extensions aren't enforced, so ExtensionSupportRequiredError is never raised

1 participant