Repository navigation
Description
Problem
Lines cited at dcafadf.
- A display string is the data model. Each provider turns its base URL into
"<type> (<host>)"text withurlparse(...).netloc, and the client later parses that text back to find the server.- Built at ai/client/unified.py:276-277 (one base URL) and :285 (the Ollama URL list), joined at :288-291; ai/client/ollama.py:354-356; ai/client/openai.py:138; ai/client/claude.py:103.
- Read back by
_extract_server_from_backend_info(unified.py:61-67,split("(", 1)[1].split(")", 1)[0]) at :137, :451 and :878, then split a second time by_server_span_attributes(:70-90,urlsplit(f"//{netloc}")) at :138 and :821.
- Credentials go along.
urlparse(...).netlockeeps userinfo. An offline probe at dcafadf withai.ollama_urls = ["<masked-url> founduser:pw` in:- the reply's
backend_info,ollama (user:pw@example.com:11434).devops ai(commands/ai.py:678, :684),devops analyze(commands/analyze.py:313, :402, :497) and review metadata and progress lines (ai/review/runner.py:1191-1194, :1299-1300; ai/review/pipeline.py:1871-1878) all print it; - the spend ledger's
serverandbackend_infocolumns (unified.py:451, :468 into ai/spend/ledger.py:659-674).devops ai cost report --by server(s.server, commands/ai_cost.py:127) anddevops ai cost prometheus(theserverlabel, ai/spend/prometheus.py:79) show theservercolumn. No command reads the storedbackend_infoback (the ledger only names it in its INSERT, ledger.py:70-76), but the database file holds it; - the
serverlabel of the request, token and spend counters (ai/spend/ledger.py:692-702); - the
backendfield of thellm_response_receivedspan event (unified.py:117-128, :152); - the on-disk response-cache entry (unified.py:533-549).
- the reply's
- Other providers leak the same way. With
gateway_url = "http://<masked-user>:<masked-password>@example.com:4000/v1", the display readsgateway (user:pw@example.com:4000)(unified.py:276-277). Spanserver.addressis the only value that comes out clean, becauseurlsplit().hostnamedrops userinfo. - Userinfo is valid configuration, so refusing it is not the fix.
get_ollama_urls(config/settings.py:502-514) accepts it. An offline probe showed that httpx2 sends it asAuthorization: Basic …, which is how a client reaches an Ollama behind an authenticating reverse proxy. - Two served_by displays read the stored text. served_by is the gateway's
x-litellm-model-api-basereply header, stored as received.devops ai cost report --by backendshowsurlparse(b.served_by).netloc or b.served_by(commands/ai_cost.py:212). For ledger rows written before fix(security): URL credential masking uses urllib and httpx2, so passwords containing '@' and non-http schemes are masked and IPv6 hosts stay intact #1109 strips userinfo where the header enters (ai/client/openai.py:175, :205), this keeps the userinfo.devops review benchmarklabels backends with_backend_host(commands/review.py:1308-1311, used at :1318 and :1349):urlparse(served_by).hostname or served_by.hostnamedrops userinfo, but a value without a scheme falls back to the raw text. An offline probe gaveu:pw@example.com:11434back whole.
- The port is guessed away. The text drops the scheme, so
_server_span_attributeswrites noserver.portfor a URL without an explicit port (docstring at unified.py:71-77). For example,claude (api.anthropic.com)getsserver.addressonly. - Replacement:
httpx2.URL(base).origin. httpx2 is a direct, exact-pinned dependency (httpx2==2.13.0, pyproject.toml:19).httpx2.Originis public (listed inhttpx2.__all__), hashable and comparable. An offline probe gave:http://<masked-user>:<masked-password>@example.com:11434→Origin(scheme='http', host='example.com', port=11434);https://api.anthropic.com/v1→ port 443;http://[2001:db8::1]:11434→ host2001:db8::1;http://<masked-user>:<masked-password>@example.com:11434→ hostexample.com, because httpx2 splits at the last '@', as it does when it sends.httpx2.URL(u).originraisesValueErrorfor a URL with no scheme andhttpx2.InvalidURL(not aValueErrorsubclass) for a malformed one such ashttp://[::1.
- Display text uses httpx2's own authority serialiser:
httpx2.URL(scheme=scheme, host=host, port=port).netloc.decode("ascii").- It gives
example.com:11434,[2001:db8::1]:11434andapi.anthropic.com, and brackets IPv6 itself. httpx2.Origintakes a URL, not a host and port, so a bare served_byhost:porthas no Origin. The serialiser takes the parts instead. With a scheme it drops that scheme's default port; without one it keeps any port (httpx2.URL(host="example.com", port=80).netlocisexample.com:80).- For every URL without userinfo this matches today's
urlparse().netloctext, with three exceptions, all measured with httpx2 2.13.0:- the host is lowercased:
http://Example.COM:11434givesexample.com:11434, where today showsExample.COM:11434; - an IDN host prints as its A-label:
http://bücher.example:11434givesxn--bcher-kva.example:11434; - an explicit default port is dropped:
http://example.com:80andhttps://example.com:443giveexample.com.http://example.com:443keeps its port.
- the host is lowercased:
- It gives
Acceptance criteria
- The field.
LLMResponse(ai/client/models.py:88-138) gainsorigin: httpx2.Origin | None.- The Ollama, OpenAI-compatible and Claude paths set it with
httpx2.URL(url).originfrom the URL they called:basein ollama.py (:354),self._api_base()in openai.py (:169),basein claude.py (:33-36). - Replies with no endpoint leave it
None: cache hits, pydantic-ai conversions (models.py:193) and test fakes.
- The Ollama, OpenAI-compatible and Claude paths set it with
- One label helper, next to
LLMResponse, takes a host, a port and an optional scheme and returnshttpx2.URL(scheme=scheme, host=host, port=port).netloc.decode("ascii").- For an origin it is called with
o.host,o.portando.scheme. - For a bare served_by authority it is called with no scheme, so a bare
:80or:443stays in the label. - Every
"<type> (<host>)"string uses it: unified.py:291, ollama.py:356, openai.py:138, claude.py:103.
- For an origin it is called with
- Display.
LLMClientderives its configured origins once, withhttpx2.URL(u).origin.backend_hostandbackend_info(unified.py:260-291) are display text, formatted from those origins through the label helper.- A configured URL that has no origin, or that httpx2 cannot parse (
ValueErrororhttpx2.InvalidURL), displaysunknown(CONST_AI_BACKEND_HOST_UNKNOWN, config/constants.py:534-536), never the raw value.
- No parse-back. Nothing reads host data back out of display text.
- These values come from an origin: the ledger's
servervalue (unified.py:451, :878), the counters'serverlabel, and spanserver.address/server.port(unified.py:137-139, :821). _extract_server_from_backend_infoand_server_span_attributesare deleted.
- These values come from an origin: the ledger's
- A dispatched reply with no origin (a test fake, or a later adapter that sets none) falls back to the client's configured origins.
- The ledger
serverand the counter label are the client's configured label, asself.backend_hostis today (unified.py:451). - Span
server.*comes from the configured origin when exactly one is configured, as the stream span already does (unified.py:821). With several or none configured, the span gets noserver.*.
- The ledger
- Port.
server.portis set wheneverserver.addressis: 443 forhttps://api.anthropic.com, 11434 for the Ollama default. - Table test. Offline and parametrised.
- Replies come from
route_client(tests/llm_stream_fakes.py:85-102) or anhttpx2.MockTransport. - The config sets
allow_private_network=True, or the test setsDEVOPS_CLI_AI_ALLOW_PRIVATE_NETWORK=trueas tests/test_ai_gateway_base_url.py:16-18 does. Without it, the provider paths'validate_base_url(ai/client/network.py:348-385) resolves every non-loopback host through_resolve_host_ips(core/validation.py:251), soexample.comwould hit DNS and2001:db8::1would be refused as non-public. - No DNS query is made.
- Replies come from
| Configured URL | backend_info today |
backend_info after |
Ledger server and counter label after |
Span server.address, server.port after |
|---|---|---|---|---|
ollama http://<masked-user>:<masked-password>@example.com:11434 |
ollama (user:pw@example.com:11434) |
ollama (example.com:11434) |
example.com:11434 |
example.com, 11434 |
gateway http://<masked-user>:<masked-password>@example.com:4000/v1 |
gateway (user:pw@example.com:4000) |
gateway (example.com:4000) |
example.com:4000 |
example.com, 4000 |
ollama http://[2001:db8::1]:11434 |
ollama ([2001:db8::1]:11434) |
unchanged | [2001:db8::1]:11434 |
2001:db8::1, 11434 |
ollama http://Example.COM:11434 |
ollama (Example.COM:11434) |
ollama (example.com:11434) |
example.com:11434 |
example.com, 11434 |
ollama http://example.com:80 |
ollama (example.com:80) |
ollama (example.com) |
example.com |
example.com, 80 |
claude default https://api.anthropic.com |
claude (api.anthropic.com) |
unchanged | api.anthropic.com |
api.anthropic.com, 443 (today: no port) |
ollama http://example.com:11434 and http://example.com:11435, streamed |
ollama (example.com:11434, example.com:11435) |
unchanged | unchanged | neither, as today |
- Credentials. In the two userinfo rows:
- the mocked server still receives
Authorization: Basic dXNlcjpwdw==; pwappears in none of these: the reply'sbackend_info, the ledger record, the counter labels, the span attributes and events, or the response-cache entry.
- the mocked server still receives
- served_by displays read the value through one parse, next to the label helper.
- An absolute URL goes through
httpx2.URL(s).origin. - A bare
host:portgoes through thehostnameandportofurlsplit("//" + s), or through fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112's shared "URL or bare authority" reader if it has landed. fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112 accepts that form for served_by, because the value comes from a header. - A value that neither parser accepts shows
unknown, never the stored text. - The cost report (commands/ai_cost.py:212) shows the label helper's text. tests/test_ai_served_by.py:173-190 stays green and gains a row for
http://<masked-user>:<masked-password>@example.com:11434, which showsexample.com:11434, and a row for a bareexample.com:11434. - The review benchmark (commands/review.py:1308-1311) keeps showing the host only, as today, and keeps its in-cluster shortening. tests/test_review_profile.py:373-379 stays green and gains a row for a bare
u:pw@example.com:11434, which showsexample.com.
- An absolute URL goes through
- No construct left.
rg -n 'urlparse|_extract_server_from_backend_info|_server_span_attributes' src/devops_cli/ai/client/unified.py src/devops_cli/ai/client/ollama.py src/devops_cli/ai/client/openai.py src/devops_cli/ai/client/claude.py src/devops_cli/commands/ai_cost.py src/devops_cli/commands/review.pyprints nothing.rg -n '\.netloc' src/devops_cli/ai/client src/devops_cli/commands/ai_cost.py src/devops_cli/commands/review.pyprints only the label helper's call on anhttpx2.URL.
- Tests updated.
- tests/test_ai_client_telemetry.py:204-225 (
test_server_attributes_come_from_one_backend_netloc) is rewritten over origins, with the host-list case still yielding neither attribute. - tests/test_telemetry.py:270-310 and :588-608 call
_set_response_span_attributeswithout a client, so their replies carry an origin. In :588-608 the port-lesshttps://example.comreply now getsserver.port443 from its scheme.
- tests/test_ai_client_telemetry.py:204-225 (
- Tests that pass unchanged, because the values they assert do not change:
- tests/test_ai_client_telemetry.py:87-120, whose
_replyfake (:57-72) sets no origin, so it pins the fallback above; :143-176 (stream spans); :185-201; :242-268; - tests/test_ai_gateway.py:452-473 (
backend_hoststaysexample.com), tests/test_ai_gateway_base_url.py:28-32 (gateway.example.com:4000) and tests/test_ai_client_providers_and_embeddings.py:258-260 ("11434" in client.backend_host).
- tests/test_ai_client_telemetry.py:87-120, whose
- Release.
- New tests are offline and take well under 1 s together.
uv run devops cipasses.- the credential fix;
- the
server.portchange; - the three label changes (lowercased host, IDN A-label, explicit
:80/:443dropped), which start new ledgerservergroups and counter series for such configs; - that earlier ledger rows and response-cache entries keep the text they were written with, and that
devops ai cost reset(commands/ai_cost.py:691-713) anddevops ai cache clear(commands/ai_cache.py:75-93) remove them.
- Pending a person: if
ai.ollama_urls,ai.gateway_urlorai.api_base_urlever helduser:password, rotate that password. Ledger rows, response-cache entries and exported counter series written before this change hold it (see the key question on rows already written).
Key questions
-
What does the field hold? Proposed:
httpx2.Origin, fromhttpx2.URL(base).origin.- It is public in httpx2 2.13.0, which is already a direct dependency. It carries scheme, host and port, and never userinfo.
- Not a
str: text invites the next parse-back. - Not pydantic's URL types: for
http://example.com\@169.254.169.254/, pydantic reads hostexample.comwhile httpx2 sends to 169.254.169.254 (offline probe). The field must come from the parser of the client that sends.
-
What text do the display, the ledger's
servercolumn and the counter label carry? Proposed: host[:port] as httpx2 serialises an authority.- That equals today's text except in the three cases above: the host is lowercased, an IDN host prints as its A-label, and an explicit default port is dropped. Configs with such URLs start new ledger
servergroups and new counter series; every other config keeps its values. - Pricing overrides are stored and looked up lowercased (ai/spend/pricing.py:402, :272, :324), so the lowercased host does not change which
devops ai cost set-priceoverride applies. An override keyed on an explicit:80/:443or on a Unicode host name stops matching. - Pricing's local-server check (ai/spend/pricing.py:104-127) lowercases and reads only the host, so the case and default-port changes do not move it. An IDN host's A-label no longer equals the Unicode name
_is_configured_ai_server_host(pricing.py:63-87) reads from settings, so an IDN-named configured server could be priced as remote. Proposed: accept this edge, and let the changelog name it. - Printing the full origin (
http://example.com:11434) would show the scheme, but it would split ledger history and relabel series for every config. The field already holds the scheme for any reader that needs it.
- That equals today's text except in the three cases above: the host is lowercased, an IDN host prints as its A-label, and an explicit default port is dropped. Configs with such URLs start new ledger
-
Should configured URLs with userinfo be refused? Proposed: no, not in this item.
- Userinfo is working Basic-auth configuration (see Problem).
- Whether URL settings reject or validate userinfo belongs with refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000's validated URL settings.
-
What does a stream record when several Ollama URLs are configured? Proposed: the same as today.
- The stream span names no server; tests/test_ai_client_telemetry.py:143-176 pin this.
- The ledger
serveris the configured labels joined with ", ", which pricing already reads as a list (ai/spend/pricing.py:120-127). - The stream span opens (unified.py:821) before a URL is leased (ai/client/ollama.py:419-422), so naming the leased server is a separate change.
-
What happens to rows already written? (owner decision) Proposed: no in-place rewrite.
- Rewriting stored
backend_infowould need the parse-back this item deletes, and the project is pre-1.0. - The pull request body tells anyone who configured userinfo to rotate the password, run
devops ai cost resetand rundevops ai cache clear. - The served_by displays already read through the new parse, so old served_by values show no userinfo.
- Rewriting stored
-
How does this fit refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001's adapters? Proposed: this item owns the field on
LLMResponse. refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001's adapters set it where they know the base URL; until they do, their replies use the fallback above. Whichever of the two lands second adapts. -
How does this meet feat(ai): model prompt and reply text kept out of telemetry by default #606? Proposed: feat(ai): model prompt and reply text kept out of telemetry by default #606 (model prompt and reply text kept out of telemetry) and this item both edit
_set_response_span_attributes(ai/client/unified.py:131-150). feat(ai): model prompt and reply text kept out of telemetry by default #606 states thatbackend_infois not sensitive; it is, because it carries the server URL and with it any userinfo this item keeps out of spans. feat(ai): model prompt and reply text kept out of telemetry by default #606 lands after fix(security): URL credential masking uses urllib and httpx2, so passwords containing '@' and non-http schemes are masked and IPv6 hosts stay intact #1109, and whichever of feat(ai): model prompt and reply text kept out of telemetry by default #606 and this item lands second keeps one span-attribute function that writes only the origin field.
Strategic alignment
- Priority P2. Credentials leak only when a configured AI URL carries userinfo. When one does, they reach terminal output, the spend ledger, metric labels, span events and the response cache.
- Library first. The parser of the client that sends (httpx2) produces the origin once, and httpx2's own serialiser prints it. Display, spans and the ledger read the structured value, and two string parsers are deleted.
- Size: small to medium, about seven source files and five test files.
- Proposed milestone: backlog (P2). A person plans it on the board. It is best scheduled next to refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001 (see the last key question).
- Dependencies: none hard. Coordinate with:
- fix(security): URL credential masking uses urllib and httpx2, so passwords containing '@' and non-http schemes are masked and IPv6 hosts stay intact #1109: it strips served_by userinfo at openai.py:175 and :205, in the same file.
- fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112: it sets the rule for reading a bare
host:portserved_by value. - feat(ci): hand-rolled URL and address parsing fails
devops ci, AGENTS.md makes the library the rule, and reviews stop discarding the findings #1107: none of itsnet-*rules match the lines this item deletes (split("("),urlparse(...).netlocor.path,urlsplit(f"//{netloc}"),urlparse(...).hostname or served_by). This item therefore removes no marker and leaves the ceiling as it is. The in-cluster DNS suffix test this item keeps at commands/review.py:1311 matches feat(ci): hand-rolled URL and address parsing failsdevops ci, AGENTS.md makes the library the rule, and reviews stop discarding the findings #1107'snet-domain-suffixrule as written; its replacement belongs to that rule's burn-down.
- Related: refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001, refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000, fix(security): URL credential masking uses urllib and httpx2, so passwords containing '@' and non-http schemes are masked and IPv6 hosts stay intact #1109, fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112, feat(ci): hand-rolled URL and address parsing fails
devops ci, AGENTS.md makes the library the rule, and reviews stop discarding the findings #1107.
Proposed design
Problem statement
The AI client stores server URLs as display strings built with urlparse().netloc. When a configured URL carries userinfo, those credentials appear in terminal output, the spend ledger, metric labels, span events, and the on-disk response cache. Two string parsers read host data back out of that text. The fix replaces the string data model with httpx2.URL(base).origin, a structured value that never carries userinfo, and deletes the parse-back helpers.
Acceptance criteria
- Criterion 1: LLMResponse gains a field origin of type httpx2.Origin | None.
Verification: Inspect ai/client/models.py for the new field. Run the test suite for the models module. - Criterion 2: The Ollama, OpenAI-compatible and Claude paths set origin with httpx2.URL(url).origin from the URL they called.
Verification: Inspect ai/client/ollama.py, ai/client/openai.py and ai/client/claude.py for the origin assignment. Run tests/test_ai_gateway.py and tests/test_ai_client_providers_and_embeddings.py. - Criterion 3: Replies with no endpoint leave origin as None.
Verification: Run tests/test_ai_client_telemetry.py:87-120, whose _reply fake sets no origin. - Criterion 4: One label helper takes a host, a port and an optional scheme and returns httpx2.URL(scheme=scheme, host=host, port=port).netloc.decode('ascii').
Verification: Inspect ai/client/models.py or ai/client/unified.py for the helper. Run the table test. - Criterion 5: LLMClient derives its configured origins once with httpx2.URL(u).origin.
Verification: Inspect ai/client/unified.py for the origin derivation in init or a property. Run tests/test_ai_gateway_base_url.py. - Criterion 6: A configured URL that httpx2 cannot parse displays the constant CONST_AI_BACKEND_HOST_UNKNOWN, never the raw value.
Verification: Add a test with a malformed URL and assert the display is 'unknown'. Run tests/test_ai_gateway.py. - Criterion 7: The functions _extract_server_from_backend_info and _server_span_attributes are deleted.
Verification: Run: rg -n '_extract_server_from_backend_info|_server_span_attributes' src/devops_cli/ai/client/unified.py. Expect no output. - Criterion 8: The ledger server value, the counter server label, and span server.address and server.port come from an origin, not from parsed display text.
Verification: Run tests/test_ai_client_telemetry.py and tests/test_telemetry.py. Inspect the span attributes in the test output. - Criterion 9: A dispatched reply with no origin falls back to the client's configured origins for the ledger and counter, and to the configured origin for span attributes when exactly one is set.
Verification: Run tests/test_ai_client_telemetry.py:87-120. Assert the fallback values match the configured label. - Criterion 10: server.port is set whenever server.address is, including the scheme default (443 for https, 80 for http).
Verification: Run the table test row for claude defaulthttps://api.anthropic.comand assert server.port is 443. - Criterion 11: The table test is offline, parametrised, and makes no DNS query.
Verification: Run the new table test. Confirm no network calls by running with --timeout or in an air-gapped environment. The test uses route_client or httpx2.MockTransport. - Criterion 12: In the userinfo rows, the mocked server receives Authorization: Basic dXNlcjpwdw==, and the password appears in none of: backend_info, the ledger record, counter labels, span attributes, or the response-cache entry.
Verification: Run the table test userinfo rows. Assert the password string is absent from all listed outputs. - Criterion 13: The served_by displays in the cost report and the review benchmark read the value through one parse and show no userinfo.
Verification: Run tests/test_ai_served_by.py:173-190 and tests/test_review_profile.py:373-379. Add and pass the new userinfo rows. - Criterion 14: No construct left: rg for urlparse, _extract_server_from_backend_info, _server_span_attributes in the named files prints nothing. rg for .netloc prints only the label helper's call.
Verification: Run: rg -n 'urlparse|_extract_server_from_backend_info|_server_span_attributes' src/devops_cli/ai/client/unified.py src/devops_cli/ai/client/ollama.py src/devops_cli/ai/client/openai.py src/devops_cli/ai/client/claude.py src/devops_cli/commands/ai_cost.py src/devops_cli/commands/review.py. Expect no output. Run: rg -n '.netloc' src/devops_cli/ai/client src/devops_cli/commands/ai_cost.py src/devops_cli/commands/review.py. Expect only the label helper. - Criterion 15: tests/test_ai_client_telemetry.py:204-225 is rewritten over origins. tests/test_telemetry.py:270-310 and :588-608 carry an origin and the port-less reply gets server.port 443.
Verification: Run: uv run pytest tests/test_ai_client_telemetry.py tests/test_telemetry.py -v. All pass. - Criterion 16: Tests that pass unchanged: tests/test_ai_client_telemetry.py:87-120, :143-176, :185-201, :242-268; tests/test_ai_gateway.py:452-473; tests/test_ai_gateway_base_url.py:28-32; tests/test_ai_client_providers_and_embeddings.py:258-260.
Verification: Run: uv run pytest tests/test_ai_client_telemetry.py tests/test_ai_gateway.py tests/test_ai_gateway_base_url.py tests/test_ai_client_providers_and_embeddings.py -v. All pass without modification. - Criterion 17: The full CI pipeline passes.
Verification: Run: uv run devops ci. All checks pass.
Key questions
- What does the field hold?: httpx2.Origin, from httpx2.URL(base).origin. It is public in httpx2 2.13.0, carries scheme, host and port, and never userinfo. Not a str, because text invites the next parse-back. Not a pydantic URL type, because for a URL like
http://example.com@169.254.169.254/pydantic reads the wrong host while httpx2 sends to the right one. The field must come from the parser of the client that sends. (proposed) [sources: pyproject.toml:19] - What text do the display, the ledger's server column and the counter label carry?: host[:port] as httpx2 serialises an authority. This equals today's text except in three cases: the host is lowercased, an IDN host prints as its A-label, and an explicit default port is dropped. Configs with such URLs start new ledger server groups and new counter series. Pricing overrides are stored and looked up lowercased, so the lowercased host does not change which override applies. An override keyed on an explicit :80/:443 or on a Unicode host name stops matching. The IDN A-label edge is accepted and named in the changelog. (proposed) [sources: src/devops_cli/ai/spend/pricing.py:402, src/devops_cli/ai/spend/pricing.py:104]
- Should configured URLs with userinfo be refused?: No, not in this item. Userinfo is working Basic-auth configuration. Whether URL settings reject or validate userinfo belongs with refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000's validated URL settings. (proposed) [sources: src/devops_cli/config/settings.py:502]
- What does a stream record when several Ollama URLs are configured?: The same as today. The stream span names no server. The ledger server is the configured labels joined with ', '. The stream span opens before a URL is leased, so naming the leased server is a separate change. (proposed) [sources: tests/test_ai_client_telemetry.py:143, src/devops_cli/ai/client/ollama.py:419]
- What happens to rows already written?: No in-place rewrite. Rewriting stored backend_info would need the parse-back this item deletes, and the project is pre-1.0. The pull request body tells anyone who configured userinfo to rotate the password, run devops ai cost reset and run devops ai cache clear. The served_by displays already read through the new parse, so old served_by values show no userinfo. (proposed) [sources: src/devops_cli/commands/ai_cost.py:691, src/devops_cli/commands/ai_cache.py:75]
- How does this fit refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001's adapters?: This item owns the field on LLMResponse. refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001's adapters set it where they know the base URL. Until they do, their replies use the fallback to the client's configured origins. Whichever of the two lands second adapts. (proposed) [sources: src/devops_cli/ai/client/models.py:88]
- How does this meet feat(ai): model prompt and reply text kept out of telemetry by default #606?: feat(ai): model prompt and reply text kept out of telemetry by default #606 and this item both edit _set_response_span_attributes. feat(ai): model prompt and reply text kept out of telemetry by default #606 states that backend_info is not sensitive; it is, because it carries the server URL and with it any userinfo. feat(ai): model prompt and reply text kept out of telemetry by default #606 lands after fix(security): URL credential masking uses urllib and httpx2, so passwords containing '@' and non-http schemes are masked and IPv6 hosts stay intact #1109, and whichever of feat(ai): model prompt and reply text kept out of telemetry by default #606 and this item lands second keeps one span-attribute function that writes only the origin field. (proposed) [sources: src/devops_cli/ai/client/unified.py:131]
- Is httpx2 a direct dependency of this project?: Yes. httpx2==2.13.0 is listed in pyproject.toml:19. httpx2.Origin is public, listed in httpx2.all, hashable and comparable. [sources: pyproject.toml:19]
- What is the value of CONST_AI_BACKEND_HOST_UNKNOWN?: The string 'unknown', defined at src/devops_cli/config/constants.py:900. [sources: src/devops_cli/config/constants.py:900]
Open questions
- It is public in httpx2 2.13.0, which is already a direct dependency. It carries scheme, host and port, and never userinfo.
- Not a
str: text invites the next parse-back. - Not pydantic's URL types: for
http://example.com\@169.254.169.254/, pydantic reads hostexample.comwhile httpx2 sends to 169.254.169.254 (offline probe). The field must come from the parser of the client that sends. - That equals today's text except in the three cases above: the host is lowercased, an IDN host prints as its A-label, and an explicit default port is dropped. Configs with such URLs start new ledger
servergroups and new counter series; every other config keeps its values. - Pricing overrides are stored and looked up lowercased (ai/spend/pricing.py:402, :272, :324), so the lowercased host does not change which
devops ai cost set-priceoverride applies. An override keyed on an explicit:80/:443or on a Unicode host name stops matching. - Pricing's local-server check (ai/spend/pricing.py:104-127) lowercases and reads only the host, so the case and default-port changes do not move it. An IDN host's A-label no longer equals the Unicode name
_is_configured_ai_server_host(pricing.py:63-87) reads from settings, so an IDN-named configured server could be priced as remote. Proposed: accept this edge, and let the changelog name it. - Printing the full origin (
http://example.com:11434) would show the scheme, but it would split ledger history and relabel series for every config. The field already holds the scheme for any reader that needs it. - Userinfo is working Basic-auth configuration (see Problem).
- Whether URL settings reject or validate userinfo belongs with refactor(config): a settings field is the one declaration, and the option, env and config-show registries become views of it #1000's validated URL settings.
- The stream span names no server; tests/test_ai_client_telemetry.py:143-176 pin this.
- The ledger
serveris the configured labels joined with ", ", which pricing already reads as a list (ai/spend/pricing.py:120-127). - The stream span opens (unified.py:821) before a URL is leased (ai/client/ollama.py:419-422), so naming the leased server is a separate change.
- Rewriting stored
backend_infowould need the parse-back this item deletes, and the project is pre-1.0. - The pull request body tells anyone who configured userinfo to rotate the password, run
devops ai cost resetand rundevops ai cache clear. - The served_by displays already read through the new parse, so old served_by values show no userinfo.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNew
- StatusShow more project fieldsNew
Activity
fix(ai): embedding requests reach the spend ledger and the AI usage c…
fix(ai): the spend series exists at $0, a gateway call counts as loca…
dan-petty commentedon Oct 28, 2026
Refine cannot set this item to Ready at 69636b6 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
str: text invites the next parse-back.http://example.com\@169.254.169.254/, pydantic reads hostexample.comwhile httpx2 sends to 169.254.169.254 (offline probe). The field must come from the parser of the client that sends.servergroups and new counter series; every other config keeps its values.devops ai cost set-priceoverride applies. An override keyed on an explicit:80/:443or on a Unicode host name stops matching._is_configured_ai_server_host(pricing.py:63-87) reads from settings, so an IDN-named configured server could be priced as remote. Proposed: accept this edge, and let the changelog name it.http://example.com:11434) would show the scheme, but it would split ledger history and relabel series for every config. The field already holds the scheme for any reader that needs it.serveris the configured labels joined with ", ", which pricing already reads as a list (ai/spend/pricing.py:120-127).backend_infowould need the parse-back this item deletes, and the project is pre-1.0.devops ai cost resetand rundevops ai cache clear.fix(ai): a reply names its server by the origin of the URL called, so…
chore(main): release 0.10.1 (#2485)
fix(rag): name the Qdrant span server by host and port (#2705)
fix(ai): name each prewarm server by host and port (#2737)