Skip to content

fix(a2aclient): preserve REST endpoint query parameters - #480

Closed
Harshil-1603 wants to merge 1 commit into
a2aproject:mainfrom
Harshil-1603:fix/rest-endpoint-query
Closed

Harshil-1603 wants to merge 1 commit into
a2aproject:mainfrom
Harshil-1603:fix/rest-endpoint-query

Conversation

@Harshil-1603

Copy link
Copy Markdown
Contributor

REST requests currently replace the advertised endpoint's query string with the operation's query parameters. An endpoint such as https://host/agent?api_key=... therefore loses its authentication parameter, including for operations with no query parameters.

Merge the operation parameters into a copy of the endpoint query. Explicit operation parameters override endpoint defaults, repeated unrelated values survive, and the caller's endpoint URL remains unchanged.

Both new HTTP regression cases fail before the fix. The full shuffled race-enabled suite, root and example-module builds, go mod tidy -diff, golangci-lint 2.11.4, and git diff --check pass locally. Tests use a local HTTP server; no external service credentials are involved.

AI assistance: this patch and its validation were prepared with OpenAI Codex (GPT-6).

@yarolegovich

Copy link
Copy Markdown
Member

Why would anyone publish an api key in a public agent card? The spec already provides mechanism (securitySchemes) for advertising how api key needs to be passed in the query.

yarolegovich added a commit that referenced this pull request Nov 4, 2026
REST calls interpolate task and push-config IDs into a path before
parsing it as a URL, so reserved characters such as `/`, `?`, `#`, and
`%` change the route or query. The native client's tenant segment can be
affected in the same way.

Escape identifier segments in the native and v0.3 clients, preserve
those escapes when joining the endpoint path, and escape native tenant
IDs. Route-pattern builders retain their existing behavior. Real HTTP
regressions check that Go's ServeMux receives the original opaque IDs
and that operation query parameters remain intact.

Validation: regression fails on the base revision and passes after the
fix; full `go test -race -mod=readonly -count=1 -shuffle=on ./...`; `go
mod tidy -diff`; `go build -mod=readonly ./...`; `go vet ./...`;
golangci-lint v2.11.4 (0 issues); separate `examples/clustermode` build;
`git diff --check`.

This is independent of #480, which preserves endpoint query parameters.
Both touch URL construction, but this PR changes path-segment handling
only.

AI assistance: prepared with Codex and verified using the checks above.

---------

Co-authored-by: Harshil <[email protected]>
Co-authored-by: Yaroslav Shevchuk <[email protected]>
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