Skip to content

fix(rag): Qdrant log lines, errors and cache key name the server by host and port, never by the URL with its userinfo #2709

Description

@dan-petty

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_collections in qdrant.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 configured qdrant.url to the log.
  • QdrantClient.__init__ in qdrant.py: InvalidURLError(base_url, reason="missing scheme or host") puts the URL in the error message and in details["url"]. Check what validate_configured_service_url writes in its own error too.
  • _verify_single_collection_for_search in retriever.py: the cache key is str(qdrant.base_url). The key stays in memory. Check that no export or log shows it.

Reproduction Steps

  1. Set qdrant.url to an http URL on example.com:6333 with a fake user name, a fake password and a path.
  2. Make the server unreachable, and run a RAG lookup with debug logging on.
  3. 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 with origin_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

  1. added
    source/agent
    type/security
    status/new
    value/high
    effort/low
    on Oct 29, 2026
  2. dan-petty commented on Oct 29, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/security. Prevents userinfo (credentials) from leaking into log lines, error messages, and in-memory cache keys.
    • Priority: P1-High. Credentials in logs and error output are a direct security exposure on every debug run.
    • Value: High. Stops password leakage in four output channels that a user or operator can read.
    • Effort: Low. Four known lines need the same substitution to an existing helper; the candidate names the helper and its location.
    • Related: fix(rag): the Qdrant upsert span names its server by host and port, never by the full URL with its userinfo #2459, which asks for a different change. 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.
  3. added
    priority/p1-high
    on Oct 29, 2026
  4. devops-cli-service commented on Oct 29, 2026

    @devops-cli-service
    Contributor

    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.

    • What does validate_configured_service_url write in its own error message? (missing verified source)
  5. added
    type/bug
    status/in-progress
    status/in-review
    and removed
    type/security
    status/new
    status/in-progress
    on Oct 30, 2026
  6. removed
    status/in-review
    on Oct 30, 2026
  7. added a commit that references this issue on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p1-highsource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions