Skip to content

fix(tck): resolve capability test failures for extensions and push notifications#804

Open
sherryfox wants to merge 1 commit intoa2aproject:0.3.x-compatfrom
sherryfox:tck-fixes-for-gson
Open

fix(tck): resolve capability test failures for extensions and push notifications#804
sherryfox wants to merge 1 commit intoa2aproject:0.3.x-compatfrom
sherryfox:tck-fixes-for-gson

Conversation

@sherryfox
Copy link
Copy Markdown

  • Default extensions to an empty list in AgentCapabilities to ensure it serializes as an array, fixing test_capabilities_structure.
  • Save pushNotificationConfig in onMessageSend for non-streaming messages, fixing test_send_message_with_push_notification_config

Failures before the fixes:

========================================================= FAILURES ==========================================================
________________________________________________ test_capabilities_structure ________________________________________________
tests/optional/capabilities/test_agent_card_optional.py:87: in test_capabilities_structure
    assert isinstance(extensions, list), "extensions must be an array"
E   AssertionError: extensions must be an array
E   assert False
E    +  where False = isinstance(None, list)
______________________________________________ test_agent_extensions_structure ______________________________________________
tests/optional/capabilities/test_agent_card_optional.py:153: in test_agent_extensions_structure
    assert isinstance(extensions, list), "extensions must be an array"
E   AssertionError: extensions must be an array
E   assert False
E    +  where False = isinstance(None, list)
______________________________________ test_send_message_with_push_notification_config ______________________________________
tests/optional/capabilities/test_push_notification_config_methods.py:511: in test_send_message_with_push_notification_config
    assert found_config, (
E   AssertionError: Push notification config from SendMessageConfiguration was not found in task configs. Expected URL: http://localhost:8888/webhook. Retrieved 0 config(s): []. This indicates the pushNotificationConfig in SendMessageConfiguration was ignored.
E   assert False
----------------------------------------------------- Captured log call -----------------------------------------------------
ERROR    tests.optional.capabilities.test_push_notification_config_methods:test_push_notification_config_methods.py:507 ❌ Push notification config from SendMessageConfiguration was NOT found!
ERROR    tests.optional.capabilities.test_push_notification_config_methods:test_push_notification_config_methods.py:508 Expected URL: http://localhost:8888/webhook
ERROR    tests.optional.capabilities.test_push_notification_config_methods:test_push_notification_config_methods.py:509 Available configs: []
================================================== short test summary info ==================================================
FAILED tests/optional/capabilities/test_agent_card_optional.py::test_capabilities_structure - AssertionError: extensions must be an array
FAILED tests/optional/capabilities/test_agent_card_optional.py::test_agent_extensions_structure - AssertionError: extensions must be an array
FAILED tests/optional/capabilities/test_push_notification_config_methods.py::test_send_message_with_push_notification_config - AssertionError: Push notification config from SendMessageConfiguration was not found in task configs. Expected URL: http...
3 failed, 33 passed, 39 skipped, 1 xfailed in 14.86s

After the fixes all tests are passing:

================================================================================
📊 COMPREHENSIVE TEST RESULTS SUMMARY
================================================================================

🔴 Mandatory Tests:           ✅ PASSED (p:31/f:0/x:0/e:0/s:2)
🔄 Capability Tests:          ✅ PASSED (p:36/f:0/x:1/e:0/s:39)
🚀 Transport Equivalence:     ✅ PASSED (p:12/f:0/x:0/e:0/s:4)
🛡️  Quality Tests:             ✅ PASSED (p:14/f:0/x:0/e:0/s:0)
🎨 Feature Tests:             ✅ PASSED (p:15/f:0/x:0/e:0/s:1)

🎉 A2A COMPLIANCE: ✅ PASSED
Your implementation meets A2A specification requirements!
🔄 CAPABILITY HONESTY: ✅ EXCELLENT
All declared capabilities work correctly!
🛡️  PRODUCTION QUALITY: ✅ HIGH
Implementation is robust and production-ready!
🎨 FEATURE COMPLETENESS: ✅ COMPREHENSIVE
Implementation includes valuable optional features!

🏆 OUTSTANDING A2A IMPLEMENTATION!

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates Kafka to version 4.2.0, enhances the deployment scripts with a PostgreSQL pod creation wait loop, and refactors JSON-RPC handling to improve validation and spec compliance. It introduces check() methods for request validation and a custom TypeAdapterFactory to ensure JSON-RPC 2.0 compliance for responses. Feedback was provided regarding the inconsistent validation of the mandatory jsonrpc field in streaming requests and potential precision loss when serializing numeric IDs.

Comment thread spec/src/main/java/io/a2a/spec/SendStreamingMessageRequest.java Outdated
Comment thread spec/src/main/java/io/a2a/json/JsonUtil.java Outdated
…tifications

- Default `extensions` to an empty list in `AgentCapabilities` to ensure it serializes as an array, fixing `test_capabilities_structure`.
- Save `pushNotificationConfig` in `onMessageSend` for non-streaming messages, fixing `test_send_message_with_push_notification_config`
@sherryfox sherryfox force-pushed the tck-fixes-for-gson branch from 2c46514 to bd65c70 Compare April 21, 2026 14:25
@kabir
Copy link
Copy Markdown
Collaborator

kabir commented Apr 22, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements push notification configuration storage within DefaultRequestHandler and adds a null-safety check for extensions in the AgentCapabilities record. Review feedback identifies a potential NullPointerException risk when taskId is null due to its use as a key in a ConcurrentHashMap. Additionally, it is recommended to use List.copyOf in the AgentCapabilities constructor to ensure the list is unmodifiable and defensively copied.

if (shouldAddPushInfo(params)) {
pushConfigStore.setInfo(taskResult.getId(), params.configuration().pushNotificationConfig());
}
if (taskId != null && !taskId.equals(taskResult.getId())) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While adding the taskId != null check prevents a NullPointerException during the comparison, taskId being null (which occurs for new tasks) still poses a significant risk. Specifically, taskId is used as a key for runningAgents (a ConcurrentHashMap) at lines 242, 256, and 342. Since ConcurrentHashMap does not allow null keys, these operations will throw a NullPointerException before this line is even reached. Consider ensuring a non-null task ID is available (e.g., by generating a temporary one) before interacting with runningAgents.

List<AgentExtension> extensions) {

public AgentCapabilities {
extensions = extensions == null ? List.of() : extensions;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using List.copyOf is preferred here to ensure the extensions list is unmodifiable and to provide a defensive copy if a mutable list was passed to the constructor. This maintains the immutability of the record and aligns with the pattern used in other classes like Task.

Suggested change
extensions = extensions == null ? List.of() : extensions;
extensions = extensions == null ? List.of() : List.copyOf(extensions);

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.

2 participants