Repository navigation
Description
Problem Description
Four places in src/devops_cli/ai/rag/ still name the Qdrant server by the whole configured URL. The URL can hold userinfo, which the client sends as Basic authentication, and a path. The change for #2459 fixes the qdrant.upsert_points span only.
QdrantClient.list_collectionsinqdrant.py:logger.debug("Failed to list Qdrant collections from %s: %s", self.base_url, exc)writes the full URL to the log.- The Qdrant client of
investigator.py:logger.debug("Qdrant vector store unreachable at %s, ...", qdrant_url)writes the configuredqdrant.urlto the log. QdrantClient.__init__inqdrant.py:InvalidURLError(base_url, reason="missing scheme or host")puts the URL in the error message and indetails["url"]. Check whatvalidate_configured_service_urlwrites in its own error too._verify_single_collection_for_searchinretriever.py: the cache key isstr(qdrant.base_url). The key stays in memory. Check that no export or log shows it.
Reproduction Steps
- Set
qdrant.urlto anhttpURL onexample.com:6333with a fake user name, a fake password and a path. - Make the server unreachable, and run a RAG lookup with debug logging on.
- Read the log lines of the Qdrant client and of the investigator.
Expected vs Actual Behavior
- Expected: a log line, an error and a key name the server by
host[:port], as the AI client does withorigin_label, and hold no userinfo. - Actual: each of the first three shows the whole URL, with its userinfo and its path.
Environment Diagnostics
Found while the change for #2459 was implemented, at origin/main b4669f65. #2459 sets server.address and server.port from origin_span_attributes(get_url_origin(url)), and from parse_service_url for a k8s:// address. A fix here can use origin_label (ai/client/models.py) and get_url_origin (http/urls.py) for an HTTP URL. A k8s:// address needs the <service>.<namespace> text, so the fix needs one label helper for both forms.
Logs, Traces, or Terminal Output
None. The defect is in the code lines above.
Proposed design
Problem statement
Four places in the RAG module name the Qdrant server by its full configured URL. The URL can hold userinfo and a path. This leaks credentials into log lines, error messages, and an in-memory cache key. The fix replaces the full URL with a host:port label, or a service.namespace label for k8s addresses, matching the pattern the AI client already uses.
Acceptance criteria
Requirement: Log lines use host:port label
The debug log in QdrantClient.list_collections and in investigator.py SHALL name the server by host:port, or by service.namespace for a k8s address, and SHALL NOT include userinfo or a path.
Scenario: Unreachable server with userinfo in URL
- WHEN The Qdrant server is unreachable and the configured URL contains a user name, a password, and a path
- THEN The log line shows only host:port and contains no user name, no password, and no path
Requirement: Error message omits the URL
The InvalidURLError raised in QdrantClient.init SHALL NOT include the configured URL in its message or in its details dictionary.
Scenario: URL missing scheme
- WHEN The configured URL has no scheme
- THEN The error message and details contain no URL text and no userinfo
Requirement: Cache key uses label
The cache key in _verify_single_collection_for_search SHALL use the host:port label, or the service.namespace label for a k8s address, and SHALL NOT use str(qdrant.base_url).
Scenario: Cache key with userinfo URL
- WHEN The Qdrant base URL contains a user name and a password
- THEN The cache key contains only host:port and no userinfo
Requirement: Unified label helper
A single label helper SHALL produce the correct display text for both an HTTP URL and a k8s:// address, and SHALL return unknown for a URL with no origin.
Scenario: k8s address label
- WHEN The input is a k8s:// address with a service name and a namespace
- THEN The helper returns the text service.namespace
Existing Tool Considered
No alternatives check has run. The project already provides origin_label in ai/client/models.py and get_url_origin in http/urls.py, which together produce the host:port text for an HTTP URL. The #2481 change added server_label(url) in ai/benchmark/labels.py that composes them. The fix reuses these helpers and adds one small label helper for the k8s:// form. No external library is needed. The written cost is one helper of about 8 lines, plus four call-site edits in three files.
Key questions
- Where should the unified label helper live?: In the RAG module, as a private helper in qdrant.py or in a small shared module under ai/rag/. The benchmark already has its own server_label in ai/benchmark/labels.py. A RAG-specific helper avoids coupling the RAG module to the benchmark module. (best practice) [sources: openspec/changes/archive/2026-10-29-2481-benchmark-server-labels/design.md, openspec/changes/archive/2026-10-28-1110-reply-server-origin/design.md]
- Chosen: Private helper in ai/rag/qdrant.py. Chosen. The RAG module is the only consumer. It keeps the helper close to its use and avoids a new shared module for one function.
- Rejected: Shared helper in ai/client/models.py next to origin_label. Rejected. origin_label takes an origin object, not a URL string. Adding a URL-level helper there mixes concerns with the AI client.
- Rejected: Reuse server_label from ai/benchmark/labels.py. Rejected. It handles only HTTP URLs and does not cover the k8s:// form. Importing the benchmark module into RAG adds an unwanted dependency.
- What text does the helper produce for a k8s:// address?: The body records the decision: the text is .. The helper parses the k8s:// URL and joins the service and namespace with a dot. (best practice) [sources: openspec/changes/archive/2026-10-29-2459-qdrant-span-host-label/design.md]
- Chosen: service.namespace text. Chosen. The body states this form. It matches the k8s convention and is short enough for a log line or cache key.
- Rejected: Full k8s:// URL. Rejected. It may contain userinfo and is longer than needed for identification.
- What does the helper return for a URL with no origin?: The text unknown, matching the constant CONST_AI_BACKEND_HOST_UNKNOWN used by the AI client and the benchmark server_label. (best practice) [sources: openspec/changes/archive/2026-10-28-1110-reply-server-origin/design.md, openspec/changes/archive/2026-10-29-2481-benchmark-server-labels/design.md]
- Chosen: Return unknown. Chosen. It matches the existing pattern in the AI client and the benchmark. It avoids leaking any part of the URL.
- Rejected: Return empty string. Rejected. An empty label is ambiguous in a log line and in a cache key.
Open questions
- What does validate_configured_service_url write in its own error message? (missing verified source)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Oct 29, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
Prevents userinfo (credentials) from leaking into log lines, error messages, and in-memory cache keys.Credentials in logs and error output are a direct security exposure on every debug run.Stops password leakage in four output channels that a user or operator can read.Four known lines need the same substitution to an existing helper; the candidate names the helper and its location.Both name the Qdrant server by host and port instead of the full URL, but #2459 changes the upsert span and the candidate changes four other lines in logs, errors, and a cache key.devops-cli-service commentedon Oct 29, 2026
Refine cannot set this item to Ready at 244bafb 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.
chore(main): release 0.21.4 (#2741)