Skip to content

fix: enforce per-task push notification config limit - #1044

Open
ez-lbz wants to merge 1 commit into
a2aproject:mainfrom
ez-lbz:fix/push-config-limit
Open

fix: enforce per-task push notification config limit#1044
ez-lbz wants to merge 1 commit into
a2aproject:mainfrom
ez-lbz:fix/push-config-limit

Conversation

@ez-lbz

@ez-lbz ez-lbz commented Aug 10, 2026

Copy link
Copy Markdown

What changed

1. Enforce a per-task push notification config limit

Problem: InMemoryPushNotificationConfigStore.setInfo maintained an unbounded List<TaskPushNotificationConfig> per task. A client could register unlimited push notification configs for one task; each config consumes memory and can trigger an outbound HTTP request on every task event, enabling resource exhaustion and amplified outbound traffic.

Fix (server-common/src/main/java/org/a2aproject/sdk/server/tasks/InMemoryPushNotificationConfigStore.java):

  • Added MAX_PUSH_CONFIGS_PER_TASK = 100 (matching the Python SDK's cap).
  • setInfo now counts only new configs against the limit: re-registering/updating an already-registered config ID remains allowed. When a genuinely new config would exceed the limit, setInfo throws InvalidParamsError (code -32602), the same error family already used for push-config validation, which transports surface as a client error.

Fix (server-common/src/test/java/org/a2aproject/sdk/server/tasks/InMemoryPushNotificationConfigStoreTest.java):

  • testSetInfoAtLimitExactlyAllowed — the 100th config still succeeds.
  • testSetInfoRejectsExceedingPerTaskLimit — the 101st distinct config throws InvalidParamsError and the store is unchanged.
  • testSetInfoUpdateExistingConfigAtLimitAllowed — updating an existing config at the limit is still allowed.

Behavior change: registering more than 100 distinct push notification configs for a single task now fails with InvalidParamsError instead of succeeding. Updates to existing configs are unaffected.

Testing

  • mvn -pl server-common test450 tests run, 0 failures, 0 errors, 0 skipped (BUILD SUCCESS), including the 3 new regression tests.

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.

1 participant