Skip to content

feat: Support multi-tenancy#419

Merged
bartek-gralewicz merged 19 commits intoepic/1.0_breaking_changesfrom
bgralewicz/support_multi_tenancy
Apr 23, 2026
Merged

feat: Support multi-tenancy#419
bartek-gralewicz merged 19 commits intoepic/1.0_breaking_changesfrom
bgralewicz/support_multi_tenancy

Conversation

@bartek-gralewicz
Copy link
Copy Markdown
Contributor

@bartek-gralewicz bartek-gralewicz commented Apr 21, 2026

Description

Added support for multi-tenancy.

Multi-Tenancy

This handler supports multi-tenant deployments through the tenant field present
on all request objects (per A2A spec Sections 3.1.x and 4.4.6). The tenant value
flows through the system as follows:

  1. Transport layer extracts tenant from the protocol-specific source:

    • REST: URL path prefix (/:tenant/...)
    • JSON-RPC: params.tenant in the request body
    • gRPC: tenant field in the request message
  2. ServerCallContext.tenant carries the tenant to all downstream components,
    including TaskStore, PushNotificationStore, and AgentExecutor.

  3. InMemoryTaskStore and InMemoryPushNotificationStore use context.tenant
    to scope data with composite keys ({tenant}:{id}), providing tenant isolation.

Similar PR done in Python SDK: a2aproject/a2a-python#758

Fixes #325 🦕

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

🧪 Code Coverage

⬇️ Download Full Report

Base PR Delta
src/client/factory.ts 95.58% 95.62% 🟢 +0.04%
src/client/transports/grpc/grpc_transport.ts 91.07% 91.16% 🟢 +0.09%
src/client/transports/json_rpc_transport.ts 59.17% 58.65% 🔴 -0.52%
src/client/transports/rest_transport.ts 75.29% 85.55% 🟢 +10.26%
src/server/express/rest_handler.ts 88.97% 84.79% 🔴 -4.18%
src/server/grpc/grpc_service.ts 73.25% 73.41% 🟢 +0.16%
src/server/push_notification/push_notification_store.ts 85.36% 87.3% 🟢 +1.94%
src/server/request_handler/default_request_handler.ts 79.64% 80.06% 🟢 +0.42%
src/server/store.ts 64.83% 70.09% 🟢 +5.26%
src/server/transports/jsonrpc/jsonrpc_transport_handler.ts 72.8% 75.42% 🟢 +2.62%
src/server/transports/rest/rest_transport_handler.ts 98.81% 98.87% 🟢 +0.06%
src/client/transports/tenant_transport_decorator.ts (new) 100%
Total 83.54% 84.8% 🟢 +1.26%

Generated by coverage-comment.yml

gemini-code-assist[bot]

This comment was marked as outdated.

@bartek-gralewicz

This comment was marked as outdated.

gemini-code-assist[bot]

This comment was marked as outdated.

@bartek-gralewicz
Copy link
Copy Markdown
Contributor Author

/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 introduces comprehensive multi-tenancy support across the client and server components. Key updates include the addition of a tenant field to the ServerCallContext, the implementation of tenant-aware routing in REST, gRPC, and JSON-RPC transports, and the introduction of tenant-scoped data isolation in the in-memory task and push notification stores. While the implementation successfully enables multi-tenant workflows, the review identifies a critical vulnerability in the composite key generation logic used for storage. Specifically, the current key structure is susceptible to collisions between tenanted and global-scope identifiers, which could lead to unintended data overwrites and loss of isolation.

Comment thread src/server/store.ts Outdated
Comment thread src/server/push_notification/push_notification_store.ts Outdated
@bartek-gralewicz bartek-gralewicz marked this pull request as ready for review April 22, 2026 14:30
@bartek-gralewicz bartek-gralewicz requested a review from a team as a code owner April 22, 2026 14:30
Comment thread src/server/grpc/grpc_service.ts Outdated
Comment thread src/server/push_notification/push_notification_store.ts
Comment thread src/client/multitransport-client.ts
Comment thread src/server/express/rest_handler.ts Outdated
Comment thread src/server/express/rest_handler.ts Outdated
@bartek-gralewicz bartek-gralewicz merged commit 1877877 into epic/1.0_breaking_changes Apr 23, 2026
10 checks passed
@bartek-gralewicz bartek-gralewicz deleted the bgralewicz/support_multi_tenancy branch April 23, 2026 11:28
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