Repository navigation
fix(protocol): strip trailing slashes from base_url in protocol client - #520
Open
saiyam-jain-dev wants to merge 3 commits into
Open
saiyam-jain-dev wants to merge 3 commits into
saiyam-jain-dev wants to merge 3 commits into
Conversation
Author
|
Added test_invoke_extension_ensures_leading_slash_on_relative_endpoint asserting that endpoints lacking a leading slash are properly formatted with exactly one slash. |
andrewpark-scaleai
approved these changes
Nov 6, 2026
andrewpark-scaleai
left a comment
Contributor
There was a problem hiding this comment.
LGTM. I ran test_client.py (45 passed), and 3 of the new tests fail against main, so they cover the bug.
Two optional follow-ups:
- A few other places still join
base_urlby concatenation:env_gateway_provider.py:1674,1678,env_provider.py:125, andwebsite/conformance.py:90. A trailing slash still produces//there. It might be worth normalizingbase_urlonce where it enters, or noting the remaining gap in the description. - If a card leaves out
endpoint,invoke_extensionnow raisesAttributeErroronNone.startswith. Previously it builthttp://hostNone. A clearValueErrorwould be friendlier.
Author
|
Added an explicit unit test verifying that invoke_extension raises ValueError when an extension card omits endpoint. Noted the other concatenation locations (env_gateway_provider.py, env_provider.py, website/conformance.py) for a separate follow-up normalization pass. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
In agentenv-protocol's client, _rpc, get_card, and invoke_extension concatenated endpoints directly onto base_url. When callers pass a base_url with a trailing slash (such as http://host:port/), the constructed URLs contain duplicate slashes (//agentenv, //.well-known/agent-env.json, //endpoint). This can cause 404s or redirects on strict HTTP servers and reverse proxies, and breaks prefix matching in request_headers.
While fetch_interface already stripped trailing slashes, the other request methods did not.
This change:
How it was tested


Confidence Score: 5/5
The PR appears safe to merge; no blocking issues were found.Summary
Normalizes request URLs when
base_urlends with slashes.The earlier missing-slash test concern is addressed by
test_invoke_extension_ensures_leading_slash_on_relative_endpoint. Since the previous review, only the missing-endpoint test was added. No new actionable issues were found. Tests were inspected, not run.Reviews (3) · Last reviewed commit: "test(protocol): assert invoke_extension ..." · Reviewed by Greptile