Skip to content

feat(jsonrpc): use regex named group for path-tenant routing - #1067

Open
ehsavoie wants to merge 2 commits into
a2aproject:mainfrom
ehsavoie:issue_1034
Open

feat(jsonrpc): use regex named group for path-tenant routing#1067
ehsavoie wants to merge 2 commits into
a2aproject:mainfrom
ehsavoie:issue_1034

Conversation

@ehsavoie

Copy link
Copy Markdown
Collaborator
  • Replace fixed POST / route with wildcard regex carrying (?...) so multi-segment paths (e.g. /org/team) are captured without string manipulation
  • Validate consistency: URL tenant ≠ body tenant → InvalidParamsError
  • Add @priority(1) to test helper routes so Vert.x evaluates them before the A2AServerRoutes catch-all (priority 20)

Fixes #1034 🦕

@ehsavoie
ehsavoie requested a review from kabir August 14, 2026 05:44
@ehsavoie
ehsavoie force-pushed the issue_1034 branch 4 times, most recently from 9b33f74 to 7bb34c5 Compare August 14, 2026 16:44
@omatheusmesmo

omatheusmesmo commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Hi @ehsavoie , thanks.

Ran the paths from the issue against this branch and against main, same probes both times.

Request main this PR
POST /tenant1/ 405 tenant "tenant1"
GET /.well-known/agent-card.json 200 200
GET /some-unmatched-path 404 405
DELETE /some-unmatched-path 404 405

Behaves as expected. Path tenant, multi-segment, trailing slash and the body/URL mismatch validation all work.

One thing worth a look: the catch-all ^/(?<tenant>.*)$ matches every path and is POST only, so any non-POST request to any unmatched path now returns 405 where it returned 404. That reaches applications sharing the HTTP port, not just A2A paths.

@ehsavoie

Copy link
Copy Markdown
Collaborator Author

One thing worth a look: the catch-all ^/(?.*)$ matches every path and is POST only, so any non-POST request to any unmatched path now returns 405 where it returned 404. That reaches applications sharing the HTTP port, not just A2A paths.

@omatheusmesmo Yes but we can't just filter on the tenant. You application would have to have something after the second / Maybe we could make that multitenancy configurable so that the catch all route would only be activated by setting a configuration property? WDYT ?

@ehsavoie

Copy link
Copy Markdown
Collaborator Author

@omatheusmesmo would the changes I've added in the right direction ?

- Catch-all regex ^/(?<tenant>.*)$ captures multi-segment URL tenants
- Blank/absent params.tenant falls back to URL path tenant (SDK extension)
- URL and body tenants must agree or InvalidParamsError is returned

BREAKING CHANGE: POSTing to /tenantA with params.tenant set to a different
value previously succeeded (body tenant silently won). It now fails with
InvalidParamsError (-32602).

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
- Add `quarkus.a2a.multitenancy.enabled` property to disable tenant routing
- Multi-segment paths (e.g. /org/team) now return 404

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
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.

[Bug]: JSON-RPC server documents tenant-prefixed routing but registers no route that can match it

2 participants