Repository navigation
feat(server): add opt-in rejection of requests missing a required extension - #1482
Open
ConnorMoss02 wants to merge 1 commit into
Open
ConnorMoss02 wants to merge 1 commit into
ConnorMoss02 wants to merge 1 commit into
Conversation
🧪 Code Coverage (vs
|
| 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
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.
Fixes #1467
Adds
validate_required_extensionstoDefaultRequestHandlerand the legacy handler, next tovalidate_input_modes(#1269). When it's on, a send or stream whoseA2A-Extensionsheader leaves out an extension the card marksrequiredraisesExtensionSupportRequiredError(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.pyand both handler test files fail on main. tests/ passes apart from the cross-version tests, which fail the same way on main here.