Repository navigation
Identify Posit Assistant in Bedrock, Vertex, and local model requests - #139
Merged
Merged
Conversation
The registry now injects the default product User-Agent into every credential variant except OAuth, so Bedrock, Vertex, Ollama, and LM Studio requests (chat and model discovery) identify Posit Assistant. AWS, Google Cloud, and local credentials gain an optional customHeaders field that the registry populates; credential shaping never sets it, and the AWS store branch now projects its documented fields so injected headers cannot be persisted. Ollama's client restores its own User-Agent over supplied headers, so OllamaClient merges the identity in a fetch wrapper instead. AWS SDK model listing uses customUserAgent; Mantle discovery signs the header. Part of posit-dev/assistant#2685
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.
This PR adds the Posit Assistant product User-Agent to every chat and model-list request sent to Amazon Bedrock, Google Vertex AI, Ollama, and LM Studio, so that administrators can tell Posit Assistant traffic apart from other tools, for example by searching CloudTrail for
PositAssistant. (Direct providers that use API keys have sent this identity since #113; these four did not, because their credentials had nowhere to carry the header.)A Bedrock chat request now arrives with a User-Agent like this, the same format the other providers already use:
The provider registry already adds the product identity before it sets up each request. It now does this for every kind of credential except OAuth sign-ins, so a future credential type gets the identity by default. Each of the four providers passes the header through to both its chat client and its model listing. The change applies to every host that uses the bridge: Positron, RStudio, the TUI, standalone, desktop, and Connect.
Edge and fallback behavior:
ollama-js/...token rather than replacing it.PositAssistant/1.4.1-posit_positron/2026.10.0--linux-, which still matches a search forPositAssistant.Part of posit-dev/assistant#2685
Verification
New wire tests capture the outgoing request on each route and check the URL, the request count, and the product token: Bedrock Converse, Bedrock Anthropic, Mantle chat and responses, AWS SDK model listing, Mantle model listing, Vertex Gemini and Anthropic chat, Vertex model listing, Ollama chat, Ollama model list and model details, and LM Studio chat and model list. Each test also checks the authorization scheme, which confirms the request took the intended auth path.
Unit tests can't prove that Bedrock still accepts the signed request with the added header. A live Bedrock call from Positron is still pending and will happen before this merges.
Not included