Repository navigation
fix(ai): a reply names its server by the origin of the URL called, so a password in an AI URL stays out of every record - #2488
Conversation
…called Plan the change 1110-reply-server-origin and add the tests that fail on main: a password in a configured AI URL reaches the backend_info text, the spend ledger, the counter labels, the spans and the response cache; a span has no server.port for a URL without a port; and the served_by displays show the stored text.
A reply now carries httpx2.URL(url).origin of the URL that the provider called. The display text, the spend ledger server, the counter server label and the span server.address and server.port come from that origin, so the userinfo of a configured AI URL stays out of them. The span server.port is now the default port of the scheme when the URL has none. A streamed Ollama call keeps the origin of the leased server. Delete _extract_server_from_backend_info, _server_span_attributes and the urlparse(...).netloc reads of AI URLs.
…s endpoint The ledger server and backend_info of an embedding request, and the server.address and server.port of its ai.rag.ollama_embed_batch span, now come from the httpx2 origin of the endpoint. A password in ai.ollama_urls no longer reaches the spend ledger, the counter labels or the span through an embedding request. The span helper moves next to the label helper, so the chat client and the embedding engine share it.
…erinfo devops ai cost report --by backend and devops review benchmark read a stored served_by value with one parse next to the label helper: httpx2 for an absolute URL and read_url_or_authority for a bare host:port. The cost report shows host:port and the review benchmark shows the host. Both show unknown for a value that names no server, and never the stored text. Delete the urlparse and urlsplit reads of served_by.
…w-up issues The comment of CONST_AI_BACKEND_HOST_UNKNOWN names each case that shows it. The change folder names the follow-up issues for the Qdrant span and the pricing read of a stored served_by value.
…, with no patch of devops-cli The span test sends each call through the `transport=` parameter of `LLMClient` to an httpx2 `MockTransport`. It does not replace `_ollama_messages` or `track_request_spend`. The dispatch span names the server that answered: with two Ollama URLs, the server that refuses the connection is not named. A URL with no port gets the default port of its scheme. The stream span names a server only when one server is configured. The cost report test writes to the shared `spend_ledger` fixture and does not patch `get_spend_ledger`.
…for the benchmarks The spec of `ai-reply-server` now says that the table of `devops ai cost report --by backend` shows the label. The `--json` and `--yaml` forms export the stored values as data. The design records this, and it records that `devops ai cost reset` removes an old row that holds userinfo. The spec has no scenario for a dispatched reply with no origin, because no public path gives such a reply. New scenarios pin the server that answered from two Ollama URLs and the stream span of one Ollama URL. The design says why the fallback stays. `devops ai benchmark` and the embedding benchmark name each server by the text of its configured URL. They are not sites of #1110, so the design and the tasks name the follow-up #2481. The span sentence in docs/TELEMETRY.md and the requirement sentences of the spec are now at most 25 words, as ASD-STE100 requires. The design uses "A URL" and "does not match".
Test resultsLocal runs on head Targeted tests:
The rebase had one conflict in Fail-to-pass
Pending a person
|
🤖 I have created a release *beep* *boop* --- ## [0.10.1](v0.10.0...v0.10.1) (2026-10-28) ### Bug Fixes * **ai:** a reply names its server by the origin of the URL called, so a password in an AI URL stays out of every record ([#2488](#2488)) ([3ec083f](3ec083f)), closes [#1110](#1110) * **ai:** the AI service clients dial through the egress-checked factory and check the address at the connect ([#2484](#2484)) ([08d70ca](08d70ca)) ### Code Refactoring * **config:** each setting declares its variable on its settings field, and the option, variable and secret registries are derived from it ([#2466](#2466)) ([daaffc6](daaffc6)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
The AI client named the server of a reply with display text, and that text kept the userinfo of the configured URL. Each provider wrote
"<type> (<host>)"withurlparse(...).netloc, which keepsuser:password@. The client then read the host back out of that text for the spend ledger, the counter label and the span. Thus a password inai.ollama_urls,ai.gateway_urlorai.api_base_urlwent to the terminal output ofdevops ai,devops analyzeand the review. It also went to the spend ledger (serverandbackend_info), to theserverlabel of the AI counters, to thellm_response_receivedspan event and to the response cache. A streamed Ollama call and an embedding request kept the userinfo in the same way.devops ai cost report --by backendand the review benchmark showed a stored served_by value with its userinfo.A reply now holds its server as an httpx2 origin:
LLMResponse.originishttpx2.URL(url).originof the URL that the provider called. The Ollama, OpenAI-compatible and Claude paths set it. An origin has a scheme, a host and a port, and never userinfo.authority_labelandorigin_labelinai/client/models.pywritehost[:port]with the authority serialiser of httpx2. Every"<type> (<host>)"text uses them.LLMClientgets the origins of its configured URLs one time. A configured URL with no origin showsunknown.server, the counterserverlabel and the spanserver.addressandserver.portcome from the origin of the reply. A span that hasserver.addressalso hasserver.port. When the URL has no port,server.portis the default port of the scheme.served_by_authorityreads a stored served_by value for the table ofdevops ai cost report --by backendand for the review benchmark. A value that it cannot read showsunknown.The change deletes
_extract_server_from_backend_info,_server_span_attributesand eachurlparse(...).netlocandurlsplit(...).netlocread of an AI URL. Userinfo in a configured URL stays valid, because httpx2 sends it as Basic authentication. The new specai-reply-serverholds this behavior.docs/TELEMETRY.mdsays that the span server comes from the origin of the URL.The label is the text that httpx2 writes. Thus the host is in lower case, an IDN host is its A-label, and the label has no default port of the scheme. A configured URL with an upper-case host, an IDN host or an explicit
:80or:443starts new ledgerservergroups and new counter series. A price override keyed on:80,:443or a Unicode host does not match. Pricing compares the server host with the Unicode host of the settings, so it can treat a configured server with an IDN name as remote.Ledger rows, response-cache entries and exported counter series from before this change keep the text that they hold. If a configured AI URL held a password, change that password, then run
devops ai cost resetanddevops ai cache clear. The JSON and YAML forms of the cost report export the stored values as they are.Other issues hold the related work: the
qdrant.upsert_pointsspan (#2459), a stored served_by thatpricing.is_localcannot read (#2462), and the server names ofdevops ai benchmarkand the embedding benchmark (#2481).Closes #1110
Change:
openspec/changes/archive/2026-10-28-1110-reply-server-origin/