Skip to content

fix(grpc): send the transport's default tenant when creating a push notification config - #1319

Merged
kabir merged 1 commit into
a2aproject:mainfrom
WMK666666:fix/grpc-push-config-default-tenant
Nov 24, 2026
Merged

kabir merged 1 commit into
a2aproject:mainfrom
WMK666666:fix/grpc-push-config-default-tenant

Conversation

@WMK666666

Copy link
Copy Markdown
Contributor

GrpcTransport takes a default tenant in its constructor (GrpcTransportProvider always passes agentInterface.tenant()) and applies it to every request it builds through resolveTenant(request.tenant()):

operation applies default tenant
sendMessage (via createRequestWithTenant) yes
getTask yes
cancelTask yes
listTasks yes
subscribeToTask yes
getExtendedAgentCard yes
getTaskPushNotificationConfiguration yes
listTaskPushNotificationConfigurations yes
deleteTaskPushNotificationConfigurations yes
createTaskPushNotificationConfiguration no

createTaskPushNotificationConfiguration mapped the domain config straight to proto, so the tenant field was populated only when the caller happened to set it on the TaskPushNotificationConfig itself. TaskPushNotificationConfig in the proto carries tenant as field 1 and is used as the request message of CreateTaskPushNotificationConfig, so the request went out with an empty tenant.

What that looks like

A client built from a tenant-scoped interface:

GrpcTransport transport = new GrpcTransport(channel, agentCard, "tenant-a", null);
transport.createTaskPushNotificationConfiguration(
        TaskPushNotificationConfig.builder().taskId(taskId).url(callbackUrl).build(), null);

sends tenant = "" with this call while every other call on the same transport carries tenant-a. Against a multi-tenant server the config is either rejected (TaskNotFoundError, because the task lives in tenant-a) or stored under the default tenant, where the push notification for that task never fires — the caller has no way to tell which happened.

Fix

The one-line version of what the other nine operations already do:

org.a2aproject.sdk.grpc.TaskPushNotificationConfig grpcRequest = ToProto.taskPushNotificationConfig(request)
        .toBuilder()
        .setTenant(resolveTenant(request.tenant()))
        .build();

resolveTenant keeps an explicitly requested tenant, so nothing changes for callers that set one.

Tests

Two cases added to GrpcTransportTest, using the existing in-process server (a createTaskPushNotificationConfig handler now records the received message):

  • testCreatePushNotificationConfigUsesDefaultTenant — transport built with default-tenant, config without a tenant.
  • testCreatePushNotificationConfigPrefersRequestTenant — request-tenant on the config wins over the transport default.

On main the first one fails with expected: <default-tenant> but was: <>; with the fix the module is green (18 tests, client/transport/grpc).

…otification config

GrpcTransport resolves a default tenant once, in its constructor, and
applies it to every request it builds: sendMessage, getTask, cancelTask,
listTasks, subscribeToTask, getExtendedAgentCard, get/delete/list push
notification configs all go through resolveTenant(request.tenant()).

createTaskPushNotificationConfiguration was the one exception. It mapped
the domain config straight to proto, so the tenant was only set when the
caller had passed one explicitly. GrpcTransportProvider always seeds the
transport with agentInterface.tenant(), which means a client built from a
tenant-scoped interface sent that tenant with every call except this one.
The proto carries tenant as field 1, so the request arrived with an empty
tenant and the config was created against the server's default tenant
instead of the requested one - a multi-tenant server either rejects it as
task-not-found or stores it where notifications for that task never fire.

Route the payload through resolveTenant as well, so all ten operations
agree on which tenant the request belongs to.
@WMK666666

Copy link
Copy Markdown
Contributor Author

Small nudge, no urgency intended.

This one is the single gRPC operation that does not apply the transport's configured default tenant when creating a push notification config, so the config lands under the empty tenant. 2 files / 43 lines, 14/14 checks green since Nov 11.

Glad to adjust the shape or add a test case you have in mind.

@kabir
kabir merged commit d4b1145 into a2aproject:main Nov 24, 2026
14 checks passed
@kabir

kabir commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Thanks @WMK666666 !

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