Skip to content

fix(grpc): avoid NPE when listTasks is called without a tenant - #1240

Merged
kabir merged 2 commits into
a2aproject:mainfrom
Emryswu:fix/list-tasks-null-tenant
Oct 23, 2026
Merged

kabir merged 2 commits into
a2aproject:mainfrom
Emryswu:fix/list-tasks-null-tenant

Conversation

@Emryswu

@Emryswu Emryswu commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Calling JSON-RPC listTasks without a tenant throws an NPE before the request is sent: the MapStruct-generated ListTasksParamsMapperImpl.toProto calls setTenant(null) on the protobuf builder. This happens with both ListTasksParams.builder().build() and new ListTasksParams().

The fix adds the same conditionExpression null check already used for the other nullable fields in ListTasksParamsMapper, and for tenant in the neighboring request mappers (TaskQueryParamsMapper, TaskIdParamsMapper, etc.). Non-null tenants are still mapped as before.

REST and gRPC are not affected: both build ListTasksRequest manually and already guard the tenant.

Tests cover the default builder, the no-arg constructor and a non-null tenant, both at the mapper level and through JSONRPCTransport (checking the actual wire request). All 585 tests in the affected modules pass. The changed files pass strict Checkstyle; the 478 pre-existing violations on main are unchanged.

Related to #1207

@Emryswu
Emryswu force-pushed the fix/list-tasks-null-tenant branch from aa163a9 to c899da6 Compare October 21, 2026 12:40
Convert an empty protobuf tenant back to null so that a null tenant
survives a toProto/fromProto round trip.
@kabir
kabir merged commit 4e98c62 into a2aproject:main Oct 23, 2026
14 checks passed
@ehsavoie

Copy link
Copy Markdown
Collaborator

Thanks @Emryswu

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.

3 participants